• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Compile error - Symbol not found - Cannot see one method in imported package

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am working on a newbie project and I have a problem I cannot resolve. I have deleted the Netbeans cache, recreated the problem child, and turned on/off Compile on Save(?). The problem is this: The setCell method is not seen in the BoardGameTester. I get "Symbol not found". I am going to post the problem code and the error message. Thanks in advance for your time and any help in advance. PS- Please be kind as I am new to this site. If I have posted the code incorrectly, just let me know how to do it and I will repost.

Error:
run:
Tic Tac Toe game board
Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - Erroneous sym type: Array.setCell
at boardgametester.BoardGameTester.main(BoardGameTester.java:32)
C:\Users\Chris\AppData\Local\NetBeans\Cache\8.1\executor-snippets\run.xml:53: Java returned: 1
BUILD FAILED (total time: 5 seconds)

Code:

 
Ranch Hand
Posts: 40
1
Eclipse IDE Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Reason why setCell method is not found because you have declared Board variables as array

I am sure that you do not intend to declare Board array, instead you want create Board object
try


Hope this would solve your problem
 
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch.

Ask yourself this question: What type of object is tttBoard

Hint:
Car is an object.
Car can be started
A collection of cars is called a parking lot
A parking lot cannot be started
 
Marshal
Posts: 80265
429
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch

Another minor point: Don't use \n (even though you seem to find it in all the books). The \n character is platform‑dependent and is not actually correct for Windows®. Use this (not available on Java6) instead.
 
Christopher.T Brown
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks, fellas. Vijay, you were right on the money. It fixed that error. I have since fixed an OutOfBoundsException on the array. I now have a NullPointerException. I have researched the issue, and what I've learned is that I'm referencing an object that doesn't exists. I cannot figure out what object it may be. So, here's my code and the compile error. Thanks again!





Error:
run:
Tic Tac Toe game board


Connect Four game board
Exception in thread "main" java.lang.NullPointerException
at games.board.Board.toString(Board.java:47)
at boardgametester.BoardGameTester.main(BoardGameTester.java:37)
C:\Users\Chris\AppData\Local\NetBeans\Cache\8.1\executor-snippets\run.xml:53: Java returned: 1
BUILD FAILED (total time: 0 seconds)
 
Campbell Ritchie
Marshal
Posts: 80265
429
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I can't see how you can get such an Exception from line 47; maybe the line numbers are different.

Don't write toString after System.out.print(...);
Not
System.out.println(tttBoard.toString());
but
System.out.println(tttBoard);
That calls toString behind the scenes so toString is unnecessary. If your reference happens to be null (but I cannot see it being null there) you will suffer an Exception. If you miss out toString() it will print null for a null.

I put code tags and a few spaces round your output; that is how to get it to appear correctly.
 
I didn't do it. You can't prove it. Nobody saw me. The sheep are lying! This tiny ad is my witness!
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic