Results 1 to 6 of 6
Thread: java:34:cannot find symbol
- 11-09-2008, 02:25 PM #1
Member
- Join Date
- Nov 2008
- Posts
- 4
- Rep Power
- 0
java:34:cannot find symbol
Hi,
I trying to compile a java file but get the following error:
SimpComp.java:34:cannot find symbol.
I believe it has something to do with my classpaths. I don't really understand this yet, being new to java. This is what I've done so far:
Using: Coco Compiler, Java, and JGrasp
Setup:
1. Java Classpath I created an environment variable, Classpath= C:\Program Files\Java\jdk1.6.0_07\bin
2. Coco I created an environment variable, CocoJTHome=C:\Coco
3. I commented out the package //package SimpComp; I think this may be where the problem is coming from because the class files are not being found.
I am writing a compiler in Coco and using jGrasp to check the SimpComp.atg file - and this will parse correctly. I compiled all of the .java files to create class files.
When I try to execute a java file SimpComp.java file I get the following error:
SimpComp.java:34:cannot find symbol - there are 10 errors listed.
How do I fix this error? How do I set up the classfiles to be found? I attached all of the files.
Thanks!! MissyMadi
- 11-09-2008, 02:40 PM #2
Please always post the full text of the error message.SimpComp.java:34:cannot find symbol.
What is on line 34?
- 11-09-2008, 03:32 PM #3
Member
- Join Date
- Nov 2008
- Posts
- 4
- Rep Power
- 0
Cannot Find Symbol
C:\Coco\CocoJT\SimpCompCodeGen>javac SimpComp.java
SimpComp.java:30: cannot find symbol
symbol: variable Scanner
location: class SimpComp
Scanner.Init(inputName);
SimpComp.java:31: cannot find symbol
symbol: variable Errors
location: class SimpComp
Errors.Init(inputName, dir, mergeErrors);
SimpComp.java:33: cannot find symbol
symbol: variable Parser
location: class SimpComp
Parser.symTab=new SymbolTable();
....
SimpComp.java:39: package Parser does not exist
Parser.symTab.PrintTable();
Zipped Word file attached with a print screen capture with full error list.
- 11-09-2008, 04:16 PM #4
Where are the symbols: Scanner, Errors and Parser defined?
If they are classes you are referencing, you need to find what package they are in and add import statements for them.
Look in the Java API doc for each of Sun's classes to find the package for that class.
For the other symbols/class references, why are you using them if you don't know what they are or where they come from?
- 11-09-2008, 04:51 PM #5
Member
- Join Date
- Nov 2008
- Posts
- 4
- Rep Power
- 0
Java Classes
The Parser, Scanner and Errors are defined in the SymbolTypes.java and SymbolTypes class files.
The question I have is where and how do I reference the class files so that when I compile the Scanner.java, Parser.java and SimpComp.java files the classes can be found. The Parser.java file is looking for symbols which are located in the SymbolTable.java file.
This project is from a class I'm taking and we were instructed to comment out the package //package SimpComp; because the class files would have the wrong path. But I'm not sure where to go from there. Where do I reference the class files.
I am new to Java and I find the paths to the class files setup confusing. Could you give me some examples?
Thanks, MissyMadi
- 11-09-2008, 06:53 PM #6
If you are not going to use packages, comment out the package statements in ALL of your source files and also comment out any import statements that refer to those packages. Put all of your source in the same folder and the compiler should find them when it needs them. You can compile the utility classes first then the main class. Or do a javac *.java to compile them all.
Similar Threads
-
cannot find symbol symbol :constructor Error. Please help! =(
By KalEl in forum New To JavaReplies: 9Last Post: 10-18-2008, 08:26 PM -
'Cannot find symbol' error
By minihazard10 in forum New To JavaReplies: 6Last Post: 10-10-2008, 04:05 AM -
cannot find symbol symbol : class Item location: package platypos.services.order
By officialhopsof in forum New To JavaReplies: 3Last Post: 05-01-2008, 08:30 AM -
[SOLVED] Java Error: Cannot find Symbol...
By bobleny in forum New To JavaReplies: 8Last Post: 04-15-2008, 06:35 AM -
Error: cannot find symbol
By cachi in forum AWT / SwingReplies: 1Last Post: 08-06-2007, 08:12 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks