472,352 Members | 1,670 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,352 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 14593
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...
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: ...
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...
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 -...
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...
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...
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...
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...
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: ...
1
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand....
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python...

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.