I get an error during Compile
Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard
I get an error during Compile
I have two files that I am trying to compile. Toys820 class contains the methods used by the program and ToysStart820 to output messages to the output screen.
I compile Toys820 with no problem and it also runs OK. When I try to compile ToysStart820 I get the following error messages:
C:\ABC\Susana's School\CS151\ToysStart820.java:50: cannot resolve symbol
symbol : class Toys820
location: class ToysStart820
Toys820 firstToy = new Toys820();
^
C:\ABC\Susana's School\CS151\ToysStart820.java:50: cannot resolve symbol
symbol : class Toys820
location: class ToysStart820
Toys820 firstToy = new Toys820();
^
C:\ABC\Susana's School\CS151\ToysStart820.java:52: cannot resolve symbol
symbol : class Toys820
location: class ToysStart820
Toys820 secondToy = new Toys820();
^
C:\ABC\Susana's School\CS151\ToysStart820.java:52: cannot resolve symbol
symbol : class Toys820
location: class ToysStart820
Toys820 secondToy = new Toys820();
^
C:\ABC\Susana's School\CS151\ToysStart820.java:54: cannot resolve symbol
symbol : class Toys820
location: class ToysStart820
Toys820 thirdToy = new Toys820();
^
C:\ABC\Susana's School\CS151\ToysStart820.java:54: cannot resolve symbol
symbol : class Toys820
location: class ToysStart820
Toys820 thirdToy = new Toys820();
^
6 errors
Tool completed with exit code 1
I am running windos XP.
Please help.
I compile Toys820 with no problem and it also runs OK. When I try to compile ToysStart820 I get the following error messages:
C:\ABC\Susana's School\CS151\ToysStart820.java:50: cannot resolve symbol
symbol : class Toys820
location: class ToysStart820
Toys820 firstToy = new Toys820();
^
C:\ABC\Susana's School\CS151\ToysStart820.java:50: cannot resolve symbol
symbol : class Toys820
location: class ToysStart820
Toys820 firstToy = new Toys820();
^
C:\ABC\Susana's School\CS151\ToysStart820.java:52: cannot resolve symbol
symbol : class Toys820
location: class ToysStart820
Toys820 secondToy = new Toys820();
^
C:\ABC\Susana's School\CS151\ToysStart820.java:52: cannot resolve symbol
symbol : class Toys820
location: class ToysStart820
Toys820 secondToy = new Toys820();
^
C:\ABC\Susana's School\CS151\ToysStart820.java:54: cannot resolve symbol
symbol : class Toys820
location: class ToysStart820
Toys820 thirdToy = new Toys820();
^
C:\ABC\Susana's School\CS151\ToysStart820.java:54: cannot resolve symbol
symbol : class Toys820
location: class ToysStart820
Toys820 thirdToy = new Toys820();
^
6 errors
Tool completed with exit code 1
I am running windos XP.
Please help.
Problems with Textpad finding .class files
I actually have the same problem and have set the CLASSPATH environment setting to no evail. So if anyone knows the answer to this problem, it's more than one person having this problem.
err.. fixed the prob
Now I feel stupid, I should have looked further into it but you can set Textpad so that it finds your .class at a set location . Here's a URL to the posts wher I found the info: http://www.textpad.com/forum/viewtopic. ... lass+path.
I shoudln't have opened my mouth so soon
In order to run a compile Java prog I had to move the .class file over to where I specified .class files are supposed to be else it would give me a "java.lang.NoClassDefFoundError" runtime error. This sucks.
OK. After dealing with this issue, I have found an answer to my problem. Here is what I did:
The procedure is the same for all tools. For example, to add the "classpath" command line switch to the Compile Java command:
In Texpad, from the Configure menu, choose Preferences.
On the Preferences dialog box, click the "+" next to Tools.
Select "Compile Java".
In the Parameters box, type:
-classpath "$FileDir;path" $File
where path is a fully qualified folder name. Place quotes around it, as shown, if it contains spaces.
Click OK.
Warning: Do not check the Capture Output option for the Run Java Application command, if your application reads from stdin. This will cause the application to lock up, as stdin cannot be reassigned to the Command Results window.
Here is the link if you have any other questions.
http://www.textpad.com/support/faq/java.html
I hope this helps.
The procedure is the same for all tools. For example, to add the "classpath" command line switch to the Compile Java command:
In Texpad, from the Configure menu, choose Preferences.
On the Preferences dialog box, click the "+" next to Tools.
Select "Compile Java".
In the Parameters box, type:
-classpath "$FileDir;path" $File
where path is a fully qualified folder name. Place quotes around it, as shown, if it contains spaces.
Click OK.
Warning: Do not check the Capture Output option for the Run Java Application command, if your application reads from stdin. This will cause the application to lock up, as stdin cannot be reassigned to the Command Results window.
Here is the link if you have any other questions.
http://www.textpad.com/support/faq/java.html
I hope this helps.
-
- Posts: 2
- Joined: Wed Apr 06, 2005 2:36 am
Ok, my initial problem was the same as the initial poster. Everytime I compile my driver class, it doesnt recognize any of the classes (which are in the same folder) that it has to rely on. Therefore, it marks each use of that class as in error.
So, I went ahead and went into preferences and put -classpath "$FileDir;path" $File into the parameter area (like posted in this thread), with path being the general folder where I keep all my folders (school assignments, so they're all separated into diff folders depending on assignment #).
Now, it finally compiles, but when I try to run it I get "java.lang.NoClassDefFoundError". What we be the solution to this?
And any quick help would be appreciated, as I'm in a Java class and really need this to start working...
So, I went ahead and went into preferences and put -classpath "$FileDir;path" $File into the parameter area (like posted in this thread), with path being the general folder where I keep all my folders (school assignments, so they're all separated into diff folders depending on assignment #).
Now, it finally compiles, but when I try to run it I get "java.lang.NoClassDefFoundError". What we be the solution to this?
And any quick help would be appreciated, as I'm in a Java class and really need this to start working...
- s_reynisson
- Posts: 939
- Joined: Tue May 06, 2003 1:59 pm
For all your java tools or did you just do it for the compile tool?
johnny181 wrote:...So, I went ahead and went into preferences and put -classpath "$FileDir;path" $File into the parameter area (like posted in this thread), with path being the general folder where I keep all my folders (school assignments, so they're all separated into diff folders depending on assignment #)...
Then I open up and see
the person fumbling here is me
a different way to be
the person fumbling here is me
a different way to be
- talleyrand
- Posts: 624
- Joined: Mon Jul 21, 2003 6:56 pm
- Location: Kansas City, MO, USA
- Contact:
My Java is getting rusty but you will probably want to add the class path to the java command in a similar manner to what you did with javac command. The error you are getting means that it can't find the file you are referencing.johnny181 wrote:Now, it finally compiles, but when I try to run it I get "java.lang.NoClassDefFoundError". What we be the solution to this?
[edit type=clarity]Since you are explicitly setting the classpath for the javac command, you will need to do the same for the java command vs setting the global environmental variable which would satiate both needs[/edit]
I choose to fight with a sack of angry cats.