NOTHING WORKS! error in running Java application

Using the Java SDK with TextPad

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

Post Reply
krystalyn

NOTHING WORKS! error in running Java application

Post by krystalyn »

Hi, I am a new programming student and I just can't seem to get my textpad 4.5.0 to work.

The problem involves "running the Java Application". I have no problem compling the program.. but when it comes to running it the same error comes up
"Exception in thread "main" java.lang.NoClassDefFoundError:MyName"

"MyName" is the name of my program..

I've read the other posts with the similiar problem but nothing seems to work out for me. The .java file is the exact same as the .class file and are located in the same directory.

The difference in my problem is that when I run my program in a MS DOS window it works perfectly fine. But when I try to run the same exact program in TextPad 4.5.0 I only get the error as defined above.

Could someone please help?

Thanks
krys
Vladimir

Re: NOTHING WORKS! error in running Java application

Post by Vladimir »

Make sure that your system CLASSPATH includes the current working directory: "."
So your PATH should look something like: .;c:\mydir1;c:\mydir2
Vladimir

Re: NOTHING WORKS! error in running Java application

Post by Vladimir »

What does the MyName class look like?
John C

Re: NOTHING WORKS! error in running Java application

Post by John C »

Hi expert,
I have same problem. But I am running under NT4.0.

Can anyone help me?

Thanks
Vladimir

Re: NOTHING WORKS! error in running Java application

Post by Vladimir »

Hmm, may be a package problem.

If you have something like the following at the top of your java file:

package com.mydomain.code;

then try this:

make sure that all com.mydomain.code files are accessible from the directory your java file is stored in.

so if your file is called c:\foo.java
and it's package is com.mydomain.code

then try compiling it from DOS like so
c:\javac -d . foo.java

this will create the followind directory structure:
c:\com\mydomain\code
and foo.class will be found there.

Now go to Texpad and do:
configure->preferences->run java application
For "Parameters" make it:
-classpath . $BaseName

Now try to run it from TextPad.

If this doesn't work, I'd need to see your java file and your
configure->preferences->run java application
configure->preferences->compile java application
parameters to get a better idea.
Vladimir

Re: NOTHING WORKS! error in running Java application

Post by Vladimir »

Also try

prefixing your
configure->preferences->compile java application
expression with
"-verbose"

alsong with other stuff, this will tell you where the compiler will search for class files.
Carl Slabicki

Re: NOTHING WORKS! error in running Java application

Post by Carl Slabicki »

I have the same problem with the "Exception in thread "

Where do I find the CLASS PATH ?
krystalyn

Re: NOTHING WORKS! error in running Java application

Post by krystalyn »

I've tried and tried.. nothing really works.. except that i need to run the application using the "java" command in MS-DOS.. its okay.. I've given up.. Now i'm using Forte. It works fine just a bit more complex.

Thank you all for trying to help

krys
Graham Clark

Re: NOTHING WORKS! error in running Java application

Post by Graham Clark »

Just prefix your classpath statement with ".;", then java will look in the current directory first for your classes.

Graham.
webjr

Re: NOTHING WORKS! error in running Java application

Post by webjr »

under preferences/tools open the "Run Java Application", insure that you change the Parameters fields to look like this [ -cp . $BaseName ] , without the brackets of course. The "-cp . " force it to current folder(directory).
michel

Re: NOTHING WORKS! error in running Java application

Post by michel »

do not select "capture messages" in configure->preferences->run java application
and i think now it must work.
Nathaniel Fink

Re: NOTHING WORKS! error in running Java application

Post by Nathaniel Fink »

Thanks, Vlad. I had the same problem as the person above; your suggestion worked for me.

Regards,

Nathaniel
Ralph

Re: NOTHING WORKS! error in running Java application

Post by Ralph »

Thank you so much!!!

I spent the better part of 2 evenings trying to figure this f@%# thing out!

Again, thank you!

l8r
Post Reply