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 7 of 7

Thread: File Errors

  1. #1
    Junior Member monikathelover1999's Avatar
    Join Date
    Sep 2019
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default File Errors

    Hello. I'm trying to get this code to work and I need help with the RandomLocation method.

    package boardgametester;
     
    import games.board.*;
    import games.utilities.*;
     
    public class BoardGameTester {
     
        /**
         * @param args the command line arguments
         */
        public static void main(String[] args) {
            RandomLocation rl = new RandomLocation();
            Board ticTacToe = new Board(3,3);
     
            ticTacToe.setCell(Mark.CROSS, Mark.NOUGHT, rl.getRandom(3), rl.getRandom(3));
     
            System.out.println("TIC TAC TOE BOARD");
            System.out.println(ticTacToe.toString());
     
            Board connectFour = new Board(6,7);
     
            connectFour.setCell(Mark.YELLOW, Mark.RED, rl.getRandom(6), rl.getRandom(7));
     
            System.out.println("CONNECT FOUR BOARD");
            System.out.println(connectFour.toString());
     
            Board mastermind = new Board(5,8);
     
            mastermind.setCell(Mark.YELLOW, Mark.RED, Mark.GREEN, Mark.BLUE, Mark.MAGENTA, Mark.ORANGE, rl.getRandom(5), rl.getRandom(8));
     
            System.out.println("MASTERMIND BOARD");
            System.out.println(connectFour.toString());
     
    FileManager.writeToFileAsync(connectFour.toString(),
    "c4.txt");
     
    FileManager.writeToFileAsync(ticTacToe.toString(),
    "ttt.txt");
     
    FileManager.writeToFileAsync(mastermind.toString(),
    "mm.txt");
    }
    }
     
     
     
     
    run:
    Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - Erroneous sym type: games.board.Board.setCell
    	at boardgametester.BoardGameTester.main(BoardGameTester.java:20)
    Java Result: 1
    BUILD SUCCESSFUL (total time: 1 second)
    Last edited by monikathelover1999; September 10th, 2019 at 12:42 PM.

  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    22,383
    Thanks
    53
    Thanked 2,398 Times in 2,351 Posts

    Default Re: File Errors

    Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - Erroneous sym type: games.board.Board.setCell
    at boardgametester.BoardGameTester.main(BoardGameTest er.java:20)
    That says there is a compile error in the code but it does not clearly say what the error is.
    Can you copy the error message from the compiler that shows what the error is and paste it here?
    The message should show the source with a ^ under the location of the error.
    Here is a sample from the javac compiler:
    TestSorts.java:138: cannot find symbol
    symbol  : variable var
    location: class TestSorts
             var = 2;
             ^

    Also Please edit your post and wrap your code with code tags:

    [code]
    **YOUR CODE GOES HERE**
    [/code]

    to get highlighting and preserve formatting.
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Junior Member monikathelover1999's Avatar
    Join Date
    Sep 2019
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: File Errors

    I don't see anything like that in the compiler, just the output.

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    22,383
    Thanks
    53
    Thanked 2,398 Times in 2,351 Posts

    Default Re: File Errors

    The error message refers to the setCell method. Check that the parameters passed to that method are correct.

    I don't see anything like that in the compiler,
    Your IDE is hiding and ignoring the compiler error messages until it tries to execute the bad statement.
    If you don't understand my answer, don't ignore it, ask a question.

  5. #5
    Junior Member monikathelover1999's Avatar
    Join Date
    Sep 2019
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: File Errors

    Okay, is this it?
    cannot find symbol
      symbol:   method getRandom(int)
      location: variable rl of type RandomLocation

  6. #6
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    22,383
    Thanks
    53
    Thanked 2,398 Times in 2,351 Posts

    Default Re: File Errors

    Yes that looks like it.
    The error messages says the compiler can not find the method getRandom that takes an int arg in the class RandomLocation.
    Check that class's definition to see if defines that method with that arg.
    If you don't understand my answer, don't ignore it, ask a question.

  7. #7
    Junior Member monikathelover1999's Avatar
    Join Date
    Sep 2019
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: File Errors

    Ah, that method is empty which is likely the problem.

Similar Threads

  1. Replies: 7
    Last Post: May 8th, 2014, 12:51 PM
  2. Replies: 3
    Last Post: March 6th, 2012, 02:50 AM
  3. Strange errors with java.nio.file
    By jnewb in forum What's Wrong With My Code?
    Replies: 9
    Last Post: January 4th, 2012, 01:37 PM
  4. Multiple errors - Reading data from a file and using a GUI to display
    By toledospod in forum File I/O & Other I/O Streams
    Replies: 5
    Last Post: December 1st, 2011, 08:34 AM
  5. Why am I getting 62 errors?
    By DestinyChick1225 in forum What's Wrong With My Code?
    Replies: 4
    Last Post: July 1st, 2010, 04:41 AM