473,385 Members | 1,769 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

JDOM: java.lang.NoClassDefFoundError: org/jdom/Content

When I run the successfully compiled java source shown at the end I got a runtime error:

Exception in thread "main" java.lang.NoClassDefFoundError: org/jdom/Content

Where is the missing class ?

I copied the newest jdom.jar from newest JDOM release b10 to the folder

jdk\jre\lib\endorsed

Is this not enough ?

Bernd
Jul 20 '05 #1
3 15026
org.jdom.Content is in jdom.jar.

Note that this class does not exist in some previous versions of jdom.jar
(for example the version which comes with b8 which I just checked).

Personally, I wouldn't store jdom.jar in jdk\jre\lib\endorsed. Make
certain your CLASSPATH is pointing to a valid jdom.jar file.
Jul 20 '05 #2
gi*******************@yahoo.com (GIMME) wrote in message news:<3f**************************@posting.google. com>...
org.jdom.Content is in jdom.jar.

Note that this class does not exist in some previous versions of jdom.jar
(for example the version which comes with b8 which I just checked).

Personally, I wouldn't store jdom.jar in jdk\jre\lib\endorsed. Make
certain your CLASSPATH is pointing to a valid jdom.jar file.
Hello!

I have the same problem as Bernd Oninger, I can compile but not run
the program.

Im trying to make this simple example to work...

---- example1.java ----
import org.jdom.*;

public class example1
{
public static void main(String[] args)
{
Element root = new Element("myRootElement");
Document doc = new Document(root);
root.setText("This is a root element");
System.out.println(doc);
}
}
-----------------------

To compile I use this:javac example1.java -classpath "jdom.jar"
....it works great since i have the jdom.jar-file in the same directory
(I asume that you can have the jar-file anywhere you want, as long as
the path is correct).

But when I run the program I get this:java example1 -classpath "jdom.jar"

Exception in thread "main" java.lang.NoClassDefFoundError:
org/jdom/Element
at example1.main(example1.java:7)

....why wont this work???

GIMME, when you are talking about the CLASSPATH do you mean the
enviroment variable (NOTE: Im using windows here, not linux)??? I have
tryed "set CLASSPATH ..." but its still the same problem.
THX in advance
/Richard
Jul 20 '05 #3
> To compile I use this:
>javac example1.java -classpath "jdom.jar"
...it works great since i have the jdom.jar-file in the same directory
(I asume that you can have the jar-file anywhere you want, as long as
the path is correct).


Good. Right.

But when I run the program I get this:
>java example1 -classpath "jdom.jar" Exception in thread "main" java.lang.NoClassDefFoundError:
org/jdom/Element
at example1.main(example1.java:7)

...why wont this work???


You have to have the classpath stuff up front ...

java -classpath $CLASSPATH example1
GIMME, when you are talking about the CLASSPATH do you mean the
enviroment variable (NOTE: Im using windows here, not linux)???
Yes. Although the syntax of separaters differ, back slashes instead
of forward slashes, in each instance you want an environment variable.

I have tryed "set CLASSPATH ..." but its still the same problem.

Try :

echo %CLASSPATH%
Relying on Window's environmental variables all the time can
lead to some undesirable behavior.

I use a dos batch script to set up my environmental variables
and then call cygwin. Here a sample script for you to study.
If you don't have cygwin installed delete or comment out the last
line.

@echo off

set PROOT=C:\Project\WEBELocal\Vignette\Portal
set JAVA_HOME=C:\Apps\jdk1.3.1_07

set JARS=C:\Project\WEBELocal\Vignette\Portal\portal\W EB-INF\lib
set CLASSES=C:\Project\WEBELocal\Vignette\Portal\porta l\WEB-INF\classes

set CLASSPATH=.
set CLASSPATH=%CLASSPATH%;C:\bin
set CLASSPATH=%CLASSPATH%;%CLASSES%
set CLASSPATH=%CLASSPATH%;%JARS%\epicentric.jar
set CLASSPATH=%CLASSPATH%;%JARS%\bsf.jar
set CLASSPATH=%CLASSPATH%;%JARS%\bsfengines.jar
set CLASSPATH=%CLASSPATH%;%JARS%\collections.jar
set CLASSPATH=%CLASSPATH%;%JARS%\cos.jar

set ANT_HOME=%PROOT%\samples\cartool\jakarta-ant-1.5

C:\WINDOWS\system32\COMMAND.COM /E:4096 /c C:\cygwin\cygwin.bat
Jul 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Lem | last post by:
I get the error Exception in thread "main" java.lang.NoClassDefFoundError when I type java app2 in the command prompt. I've tried moving to the jre directory and typed java c:\app2\app2, but it...
0
by: Shawn | last post by:
I am getting the following error with a Java Applet being served out by IIS over HTTPS/SSL using a Verisign certificate: java.lang.NoClassDefFoundError: javax/help/HelpSetException at...
2
by: Stefano Bianchi | last post by:
Ciao, I need to start a java form compiler from linux. The script that comes with the program simply says (after some checks): java -classpath Packager.jar:Filler.jar -jar EPT.jar However,...
1
by: ptaz | last post by:
Hi I'm trying to run a web page but I get the following error. Ca anyone please tell me a solution to this. Thanks Ptaz HTTP Status 500 - type Exception report
13
by: Ash | last post by:
Hey. Im new to Java, and am having a prroblem with the netbeans IDE. every time i try to import java.awt.* , I can't use any of the methods(like they don't exist). I can compile it fine, but when I...
2
by: zhengwt | last post by:
I used JDOM.jar to process xml-based document. Recently, I meet such a problem that I can not solve. First, I use the following code generate xml text: Element root = new Element("Root");...
2
by: sandhu236 | last post by:
hi all, I am facing problem while trying run the java .exe through the batch file created on linux platform ,I have set the class path in the bash also ...but still it is giving no class found...
5
by: Ananthu | last post by:
Hi I have done all the codings part for connecting mysql server with java application but when i try to compile,the compilation is successful and during execution i get the following message, ...
4
by: jmitch89 | last post by:
I don't why I get this error: Exception in thread "main" java.lang.NoClassDefFoundError The statement below works just fine: java -cp...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.