NOTHING WORKS! error in running Java application
Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard
NOTHING WORKS! error in running Java application
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
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
Re: NOTHING WORKS! error in running Java application
Make sure that your system CLASSPATH includes the current working directory: "."
So your PATH should look something like: .;c:\mydir1;c:\mydir2
So your PATH should look something like: .;c:\mydir1;c:\mydir2
Re: NOTHING WORKS! error in running Java application
What does the MyName class look like?
Re: NOTHING WORKS! error in running Java application
Hi expert,
I have same problem. But I am running under NT4.0.
Can anyone help me?
Thanks
I have same problem. But I am running under NT4.0.
Can anyone help me?
Thanks
Re: NOTHING WORKS! error in running Java application
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.
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.
Re: NOTHING WORKS! error in running Java application
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.
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.
Re: NOTHING WORKS! error in running Java application
I have the same problem with the "Exception in thread "
Where do I find the CLASS PATH ?
Where do I find the CLASS PATH ?
Re: NOTHING WORKS! error in running Java application
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
Thank you all for trying to help
krys
Re: NOTHING WORKS! error in running Java application
Just prefix your classpath statement with ".;", then java will look in the current directory first for your classes.
Graham.
Graham.
Re: NOTHING WORKS! error in running Java application
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).
Re: NOTHING WORKS! error in running Java application
do not select "capture messages" in configure->preferences->run java application
and i think now it must work.
and i think now it must work.
Re: NOTHING WORKS! error in running Java application
Thanks, Vlad. I had the same problem as the person above; your suggestion worked for me.
Regards,
Nathaniel
Regards,
Nathaniel
Re: NOTHING WORKS! error in running Java application
Thank you so much!!!
I spent the better part of 2 evenings trying to figure this f@%# thing out!
Again, thank you!
l8r
I spent the better part of 2 evenings trying to figure this f@%# thing out!
Again, thank you!
l8r