• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Tim Holloway
  • Carey Brown
  • salvin francis

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

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • 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
  • 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: 11445
18
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • 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: 65447
248
  • Mark post as helpful
  • send pies
  • 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
  • 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: 65447
248
  • Mark post as helpful
  • send pies
  • 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.
 
Evacuate the building! Here, take this tiny ad with you:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!