Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » iText »

[iText-questions] cannot run HelloWorld

Martin Korous

2007-07-02

Replies:

Hello,

I cant run HelloWorld (http://itext.ugent.be/library/com/lowagie/examples/general/HelloWorld.java), compile is OK
I tried jar and source too

1] jar file
//compile without error
javac -classpath lib/itext-2.0.4.jar HelloWorld.java

//run with noclassdefound
java -classpath lib/itext-2.0.4.jar HelloWorld
Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorld

2] same with source code:
I have unpack source into /usr/local/lib/java
download missing source of package bouncycastle into /usr/local/lib/java

//compile without error
javac -classpath /usr/local/lib/java/ HelloWorld.java

//run with noclassdefound
java -classpath /usr/local/lib/java/ HelloWorld    
Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorld (wrong name: com/lowagie/examples/general/HelloWorld)
    at java.lang.ClassLoader.defineClass0(Native Method)
    at java.lang.ClassLoader.defineClass (ClassLoader.java:539)
    at java.security.SecureClassLoader.defineClass (SecureClassLoader.java:123)
    at java.net.URLClassLoader.defineClass (URLClassLoader.java:251)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass (URLClassLoader.java:187)
    at java.lang.ClassLoader.loadClass (ClassLoader.java:289)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
    at java.lang.ClassLoader.loadClass (ClassLoader.java:235)
    at java.lang.ClassLoader.loadClassInternal (ClassLoader.java:302)

same after
export CLASSPATH=".:/usr/local/lib/java"
and compile and run without options -classpath

I am sure that path to lib (jar and source) is right (compile is ok)

java version "1.4.2_12" (slackware linux)
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_12-b03)
Java HotSpot(TM) Client VM (build 1.4.2_12-b03, mixed mode)

same problem (only source) on other machine with
java version "1.5.0_11" (gentoo linux)
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_11-b03)
Java HotSpot(TM) Client VM (build 1.5.0_11-b03, mixed mode)

can anyone help me please?

regards
Martin Korous

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
iText-questions mailing list
iText-questions@(protected)
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/
©2008 junlu.com - Jax Systems, LLC, U.S.A.