I want to make a kml file from a java code using jdom-1.1.jar
library file. It gives no compile time error to my program but showing a run time error:
C:\ProgramFiles\Tomcat\tomcat-5.5.9\webapps\jsp-examples>java KmlSample
Exception in thread "main" java.lang.NoClassDefFoundError: org/jdom/Content
Caused by: java.lang.ClassNotFoundException: org.jdom.Content
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
Could not find the main class: KmlSample. Program will exit.
how can i resolve such error..
You definitily have to tell Java where to find the jdom library (and other libraries you may need). Assuming you have the library in some folder
/dev/lib
, then the correct command would be like this:This command further assumes that the file
KmlSample.class
is at the current location and that the classKmlSample
is defined in the default namespace (KmlSample.java
does not have apackage
statement) and theKmlClass
has a correctmain
method (entry point).Edit
This should work (or at least it should produce a different error message)
Make sure, the current directory (from where you execute java in the above example) contains the file
KmlSample.class
(have a look at the upper section of my answer). You mentioned aKmlSample.java
file at that location - have you compiled the source?