hello...
in this case my situation is quite different from the others who have faced the same problem and asked for help in this forum....
i have all my java files in the D:\SNMP folder
in this folder i created a subfolder (lib) to store the SNMP4J.jar file...
so i can use it for my project...
i compiled this file by the following command...
javac -classpath ./classes/;./lib/SNMP4J.jar Testsnmp.java
it compiled succesfully....
now i run this program by....
java -classpath ./classes/;./lib/SNMP4J.jar Testsnmp
now it generates the NOClassDefFound error...
So i thought there must be some problem in my JDK...
so i devoloped a simple hello world program..in the same folder..
and it runs succesfully
[javac Hello.java
java Hello]
Now i used Winrar to extract the jar file.(which i certeinly dont like to do)
and placed the org folder in the SNMP folder...and compile with javac and it runs succesfully by "java Testsnmp" command...
Now the problem is i am using another java package which also have org folder...so i cant have 2 org folder in my project folder(SNMP)....
now how can i run the program without unpacking the jar file...
help me out of it....
sam
3 Replies - 4753 Views - Last Post: 22 March 2007 - 07:51 AM
#1
Exception in thread "main" java.lang.NoClassDefFoundError
Posted 10 March 2007 - 07:44 AM
Replies To: Exception in thread "main" java.lang.NoClassDefFoundError
#2
Re: Exception in thread "main" java.lang.NoClassDefFoundError
Posted 21 March 2007 - 01:13 PM
I have just re-installed jdk1.6.0 and jakarta tomcat5.0.28 for the umteenth time. I am trying to verify the jdk installation in or to be able to run .java, .jsp files on tomcat. I have added the classpath for JAVA_HOME=c:\Program Files\Java\jdk1.6.0. I saved the java file HelloWorld into a folder called Java on c:\, so c:\Java is the file path.
When I ran javac c:\Java\HelloWorld.java, all seemed ok, no error messages. But when I executed
java c:\Javac\HelloWorld.java I got the error message
Exception in thread "main" java.lang.NoClassDefFoundError c:\Java|helloWorld/class
can anyone advise what I might be doing wrong.
RPJD
When I ran javac c:\Java\HelloWorld.java, all seemed ok, no error messages. But when I executed
java c:\Javac\HelloWorld.java I got the error message
Exception in thread "main" java.lang.NoClassDefFoundError c:\Java|helloWorld/class
can anyone advise what I might be doing wrong.
RPJD
#3
Re: Exception in thread "main" java.lang.NoClassDefFoundError
Posted 22 March 2007 - 04:44 AM
rpjd, on 21 Mar, 2007 - 01:13 PM, said:
I have just re-installed jdk1.6.0 and jakarta tomcat5.0.28 for the umteenth time. I am trying to verify the jdk installation in or to be able to run .java, .jsp files on tomcat. I have added the classpath for JAVA_HOME=c:\Program Files\Java\jdk1.6.0. I saved the java file HelloWorld into a folder called Java on c:\, so c:\Java is the file path.
When I ran javac c:\Java\HelloWorld.java, all seemed ok, no error messages. But when I executed
java c:\Javac\HelloWorld.java I got the error message
Exception in thread "main" java.lang.NoClassDefFoundError c:\Java|helloWorld/class
can anyone advise what I might be doing wrong.
RPJD
When I ran javac c:\Java\HelloWorld.java, all seemed ok, no error messages. But when I executed
java c:\Javac\HelloWorld.java I got the error message
Exception in thread "main" java.lang.NoClassDefFoundError c:\Java|helloWorld/class
can anyone advise what I might be doing wrong.
RPJD
Deleted jdk1.6.0 and installed j2sdk1.4.2_13 instead. from my HelloWorld dir I ran
java -classpath . HelloWorld
this gave me "HelloWorld"
from my JAVA_HOME dir I ran
javac c:\ProjectFolderName\HelloWorld.java
this compiled ok
then ran
java c:\ProjectFolderName\HelloWorld.java
and got
Exception in thread "main" java.lang.NoClassDefFoundError.
Can someone please explain?
RPJD
#4
Re: Exception in thread "main" java.lang.NoClassDefFoundError
Posted 22 March 2007 - 07:51 AM
Why don't you post the code you are using (Not the commands you are using to compile) and see if we can help.
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote




|