473,554 Members | 2,153 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

JDOM: java.lang.NoCla ssDefFoundError : 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.NoCla ssDefFoundError : 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\end orsed

Is this not enough ?

Bernd
Jul 20 '05 #1
3 15105
org.jdom.Conten t 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\end orsed. Make
certain your CLASSPATH is pointing to a valid jdom.jar file.
Jul 20 '05 #2
gi************* ******@yahoo.co m (GIMME) wrote in message news:<3f******* *************** ****@posting.go ogle.com>...
org.jdom.Conten t 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\end orsed. 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("myRoot Element");
Document doc = new Document(root);
root.setText("T his is a root element");
System.out.prin tln(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.NoCla ssDefFoundError :
org/jdom/Element
at example1.main(e xample1.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.NoCla ssDefFoundError :
org/jdom/Element
at example1.main(e xample1.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:\Projec t\WEBELocal\Vig nette\Portal
set JAVA_HOME=C:\Ap ps\jdk1.3.1_07

set JARS=C:\Project \WEBELocal\Vign ette\Portal\por tal\WEB-INF\lib
set CLASSES=C:\Proj ect\WEBELocal\V ignette\Portal\ portal\WEB-INF\classes

set CLASSPATH=.
set CLASSPATH=%CLAS SPATH%;C:\bin
set CLASSPATH=%CLAS SPATH%;%CLASSES %
set CLASSPATH=%CLAS SPATH%;%JARS%\e picentric.jar
set CLASSPATH=%CLAS SPATH%;%JARS%\b sf.jar
set CLASSPATH=%CLAS SPATH%;%JARS%\b sfengines.jar
set CLASSPATH=%CLAS SPATH%;%JARS%\c ollections.jar
set CLASSPATH=%CLAS SPATH%;%JARS%\c os.jar

set ANT_HOME=%PROOT %\samples\carto ol\jakarta-ant-1.5

C:\WINDOWS\syst em32\COMMAND.CO M /E:4096 /c C:\cygwin\cygwi n.bat
Jul 20 '05 #4

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

Similar topics

11
167073
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 gives me the same exception. What could be the problem? Thanks in advance, Lem
0
4488
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 java.lang.Class.getDeclaredConstructors0(Native Method) at java.lang.Class.privateGetDeclaredConstructors(Class.java:1590) at...
2
3070
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, if I run it, I get:
1
6906
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
4432
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 try to run it, I get "exception in class main". Can anyone help me, please?
2
5842
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"); Document doc = new Document(root); ... // add some elements appended to root XMLOutputter out = new XMLOutputter();
2
1733
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 exception(java.lang.NoClassDefFoundError " Iam geeting the following error Exception in thread "main" java.lang.NoClassDefFoundError:...
5
2720
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, Exception in thread "main" java.lang.NoClassDefFoundError: MysqlConnect Coding Part: import java.sql.*; import java.lang.*;
4
14707
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 "appframework-1.0.3.jar;swing-worker-1.1.jar";CurrentStrobe.jar com.visionpro.currentstrobe.CurrentStrobeApp However, the statement below produces the error: java -cp...
0
7605
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7530
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8047
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7570
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6156
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3570
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2022
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1141
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
845
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.