I get an error during Compile

Using the Java SDK with TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
sckaray
Posts: 2
Joined: Thu Aug 28, 2003 2:37 am

I get an error during Compile

Post 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:
laosland
Posts: 7
Joined: Thu Aug 28, 2003 2:02 pm

Problems with Textpad finding .class files

Post 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.
laosland
Posts: 7
Joined: Thu Aug 28, 2003 2:02 pm

err.. fixed the prob

Post 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.
laosland
Posts: 7
Joined: Thu Aug 28, 2003 2:02 pm

I shoudln't have opened my mouth so soon

Post 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:
laosland
Posts: 7
Joined: Thu Aug 28, 2003 2:02 pm

Post by laosland »

Try setting your CLASSPATH = . and let me know if that works.
sckaray
Posts: 2
Joined: Thu Aug 28, 2003 2:37 am

Post 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
DarkIncognito
Posts: 2
Joined: Wed Apr 06, 2005 2:36 am

Post by DarkIncognito »

what is a "fully qualified folder name"?

nm, got it.
johnny181
Posts: 1
Joined: Fri Aug 26, 2005 7:51 am

Post 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... :(
User avatar
s_reynisson
Posts: 939
Joined: Tue May 06, 2003 1:59 pm

Post 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 #)...
Then I open up and see
the person fumbling here is me
a different way to be
User avatar
talleyrand
Posts: 624
Joined: Mon Jul 21, 2003 6:56 pm
Location: Kansas City, MO, USA
Contact:

Post 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]
I choose to fight with a sack of angry cats.
Post Reply