Page 1 of 1

I get an error during Compile

Posted: Thu Aug 28, 2003 2:53 am
by sckaray
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. :oops:

Problems with Textpad finding .class files

Posted: Thu Aug 28, 2003 2:24 pm
by laosland
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

Posted: Thu Aug 28, 2003 2:34 pm
by laosland
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

Posted: Thu Aug 28, 2003 3:20 pm
by laosland
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. :oops:

Posted: Thu Aug 28, 2003 5:32 pm
by laosland
Try setting your CLASSPATH = . and let me know if that works.

Posted: Thu Aug 28, 2003 8:41 pm
by sckaray
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. :D

Posted: Wed Apr 06, 2005 3:58 am
by DarkIncognito
what is a "fully qualified folder name"?

nm, got it.

Posted: Fri Aug 26, 2005 7:55 am
by johnny181
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... :(

Posted: Fri Aug 26, 2005 9:55 am
by s_reynisson
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 #)...

Posted: Fri Aug 26, 2005 2:23 pm
by talleyrand
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?
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.

[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]