Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 13 of 13

Thread: Running java program

  1. #1
    Junior Member
    Join Date
    Aug 2022
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Running java program

    Hi,
    I know this is going to be a basic question for most of you, but I'm completely stumped. I'd like to run this program on my computer github.com/sixhat/ChessInfluenceViewer
    But I'm currently using a works computer and I cant install java on the machine. Is there any way to use it using an online compiler. I know there's java compilers online, but because all the files are in different folders, I'm struggling to run anything
    Thanks for any help
    Regards
    Mike

  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Running java program

    I have not heard of an online site where a java program can be executed for testing.
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Junior Member
    Join Date
    Aug 2022
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Running java program

    I downloaded eclipse and got it to work through that.. thanks anyway. If anyone knows an easy way to flip the board so you can play with black, that would be much appreciated
    Regards
    Mike

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Running java program

    way to flip the board so you can play with black,
    Have you traced the logic to find the code that sets up the board?
    If you don't understand my answer, don't ignore it, ask a question.

  5. #5
    Junior Member
    Join Date
    Aug 2022
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Running java program

    No, Ive tried but I dont really understand it.... Id like the pieces to stop overwriting another piece when it goes on the same square as well tbh

  6. #6
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Running java program

    Yes, it looks like the program has lots of bugs.
    You need to understand the program's logic before starting to make changes.
    pieces to stop overwriting another piece
    Find the code that does the move to see what values and variables are used.
    How does a square indicate it is occupied? Use that info to keep from moving a piece to an occupied square.
    If you don't understand my answer, don't ignore it, ask a question.

  7. #7
    Junior Member
    Join Date
    Aug 2022
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Running java program

    Is there a method for finding it.. ive looked through it all but I cant seem to find it

  8. #8
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Running java program

    I use print statements to trace a program's logic flow. The print outs should show where the program executes and what the values of the variables are when the print statement is executed.
    Add print statements that show the name of the method and the values of the variables that are used in the method.

    Here is a statement to print out a 2 dim array with each row on a new line:
    System.out.println(java.util.Arrays.deepToString(board).replaceAll("],", "]\n"));
    If you don't understand my answer, don't ignore it, ask a question.

  9. #9
    Junior Member
    Join Date
    Aug 2022
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Running java program

    Hi Norm
    Really appreciate all the help... I created a new package in the civ folder then added your code. This didnt work, I assumed it wouldnt because i didnt really know what I was doing. I tried googling it but still couldnt work out where to put it. You couldnt tell me where to add it please, and if it needs any modification so its specific to my code.
    Thanks
    Mike

    https://ibb.co/HKz3pWZ

  10. #10
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Running java program

    where to add it
    The code I posted was for printing out the contents of the board array any time it was changed. You need to look in the code, find where the board array is being changed and then add the statement I gave somewhere after the statement that changes the array.

    That was just a sample. You should also add print statements in other places to see what the code is doing.

    If you have questions about your code, please post the code here wrapped in code tags. No images.
    If you don't understand my answer, don't ignore it, ask a question.

  11. #11
    Junior Member
    Join Date
    Aug 2022
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Running java program

    Ok really appreciate all the help.. this is a bit over my head unfortunately

  12. #12
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Running java program

    this is a bit over my head
    Yes, You need to start at an easier level and work up to this.
    If you don't understand my answer, don't ignore it, ask a question.

  13. #13
    Member Helium c2's Avatar
    Join Date
    Nov 2023
    Location
    Kekaha, Kaua'i
    Posts
    117
    Thanks
    1
    Thanked 3 Times in 3 Posts

    Default Re: Running java program

    Let me see if I can get this straight. You want to run a computer of network using Java. Compiling your own programs too. So you'll want to re-engineer the whole computer and have clients on it. Like an Apache Tomcat. With out windows as the main operating system. I suppose you could build your own system and have others accept you through time. Of course. Lots of clients now.

Similar Threads

  1. Running my Java first program
    By gauthamtin15 in forum What's Wrong With My Code?
    Replies: 2
    Last Post: July 5th, 2014, 07:02 AM
  2. running java program without jdk installed
    By eku in forum What's Wrong With My Code?
    Replies: 4
    Last Post: January 25th, 2014, 08:28 AM
  3. Replies: 21
    Last Post: June 12th, 2013, 11:33 AM
  4. Java program not running in command prompt
    By Padmahasa in forum Computer Support
    Replies: 1
    Last Post: August 10th, 2012, 07:22 AM
  5. Java program is running .. But I am not getting my outputs in the JSP
    By sankarravi6 in forum File I/O & Other I/O Streams
    Replies: 2
    Last Post: July 30th, 2012, 07:01 PM