Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / January 2005

Tip: Looking for answers? Try searching our database.

JTidy APi, Exception in thread "main" java.lang.NoClassDefFoundError:

Thread view: 
thufir - 17 Jan 2005 12:00 GMT
As I read
<http://sourceforge.net/docman/display_doc.php?docid=1298&group_id=13153>
it takes three args from the command line:  url, output and error.
This class has a main method, I don't get the error :(

Microsoft Windows 2000 [Version 5.00.2195]
(C) Copyright 1985-2000 Microsoft Corp.

C:\>javac @comp

C:\>java @run
Exception in thread "main" java.lang.NoClassDefFoundError: @run

C:\>type comp
-d C:\java\classes\
-g
-sourcepath C:\java\sources\
-classpath
.;C:\java\classes\;C:\java\classes\org\w3c\tidy\Tidy.jar

C:\java\sources\atreides\jtidy\Test16.java

C:\>type run
C:\java\sources\atreides\jtidy\Test16.java
http://thufir.lecktronix.net/xhtml/ C:\fooOut.txt C:\fooError.txt
thanks,

Thufir Hawat
Gordon Beaton - 17 Jan 2005 12:21 GMT
> As I read
><http://sourceforge.net/docman/display_doc.php?docid=1298&group_id=13153>
[quoted text clipped - 8 lines]
> C:\>java @run
> Exception in thread "main" java.lang.NoClassDefFoundError: @run

Read the documentation for "java".

This has nothing to do with the code you are trying to run. AFAIK,
argument files such as @run are not supported by java, only javac.

/gordon

Signature

[  do not email me copies of your followups  ]
g o r d o n + n e w s @  b a l d e r 1 3 . s e

thufir - 17 Jan 2005 17:01 GMT
[..]
> This has nothing to do with the code you are trying to run. AFAIK,
> argument files such as @run are not supported by java, only javac.

You're correct, "java" doesn't support arg files :(
However, I still get the same error. (?)

I've tried some variations.  Test16.java doesn't belong to any packages
at this moment, it's just an exact copy/paste from the JTidy site.  I'm
thinking it might need to be in package atreides.jtidy, though.  On the
other hand, at least it compiled :)

C:\>java C:\java\classes\atreides\jtidy\Test16.class
Exception in thread "main" java.lang.NoClassDefFoundError:
C:\java\classes\atreides\jtidy\Test16/class

C:\>java C:\java\sources\atreides\jtidy\Test16.java
http://thufir.lecktronix.net/xhtml/ C:\fooOut.txt
Exception in thread "main" java.lang.NoClassDefFoundError:
C:\java\sources\atreides\jtidy\Test16/java

C:\>java C:\java\sources\atreides.jtidy.Test16.java
http://thufir.lecktronix.net/xhtml/ C:\fooOut.txt
Exception in thread "main" java.lang.NoClassDefFoundError:
C:\java\sources\atreides/jtidy/Test16/java

thanks,

Thufir Hawat
Ian Shef - 17 Jan 2005 19:28 GMT
"thufir" <thufir.hawat@mail.com> wrote in news:1105981301.532569.156070
@f14g2000cwb.googlegroups.com:

> [..]
>> This has nothing to do with the code you are trying to run. AFAIK,
[quoted text clipped - 25 lines]
>
> Thufir Hawat

The program "java" does not want an extension on the class file name.
Try this:
C:\>java C:\java\classes\atreides\jtidy\Test16

Notice that the error message you got before from:
    C:\>java C:\java\classes\atreides\jtidy\Test16.class
was:
    Exception in thread "main" java.lang.NoClassDefFoundError:
    C:\java\classes\atreides\jtidy\Test16/class

which ended with "Test16/class".  This is because to "java", the refence to
"Test16.class" means find the package Test16 and use the class file called
class (actually class.class).

Signature

Ian Shef     805/F6      *    These are my personal opinions    
Raytheon Company         *    and not those of my employer.
PO Box 11337             *
Tucson, AZ 85734-1337    *

Gordon Beaton - 17 Jan 2005 19:35 GMT
> You're correct, "java" doesn't support arg files :(
> However, I still get the same error. (?)

Please read the relevant documentation, a tutorial or some
introduction to java. Did you actually read the documentation for
"java" as I suggested in my previous reply?

If you had, maybe you'd have seen that it takes a *classname*, not a
filename. If you need to specify a path so the JVM can find the
classfile, do so using the classpath argument.

If Test16 doesn't belong to any package, you can run it like this:

 java -classpath c:\java\classes\atreides\jtidy Test16

(followed by any arguments)

/gordon

Signature

[  do not email me copies of your followups  ]
g o r d o n + n e w s @  b a l d e r 1 3 . s e

thufir - 18 Jan 2005 00:17 GMT
[..]
> Please read the relevant documentation, a tutorial or some
> introduction to java. Did you actually read the documentation for
> "java" as I suggested in my previous reply?
[..]

I read it, including the .class was an error on my part :(

I think I've read everything regarding packages and environmental
variable on sun's website.  I'll be reading it again, and googling
(sp).

Until I get some insight into this here are my most recent errors, if
anyone would care take a look:

C:\>java -classpath C:\java\classes\atreides\jtidy\ Test16
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
at Test16.main(Test16.java:56)

C:\>java C:\java\classes\atreides\jtidy\ Test16
Exception in thread "main" java.lang.NoClassDefFoundError:
C:\java\classes\atreides\jtidy\

C:\>java C:\java\classes\atreides\jtidy\Test16
Exception in thread "main" java.lang.NoClassDefFoundError:
C:\java\classes\atreides\jtidy\Test16

thanks,

Thufir Hawat
thufir - 18 Jan 2005 02:16 GMT
A bit of experimentation produced:

C:\>type comp
-d C:\java\classes\
-g
-sourcepath C:\java\sources\
-classpath .;C:\java\classes\;C:\java\classes\org\w3c\tidy\Tidy.jar

C:\java\sources\atreides\hello\HelloWorldSwing.java

C:\>javac @comp

C:\>java -classpath C:\java\classes\ atreides.hello.HelloWorldSwing

While I don't understand a bit of it, it does what I want :)
thanks for all the help,

Thufir Hawat
Jean Pierre Daviau - 19 Jan 2005 23:13 GMT
On winXP after I removed the line at the top of the file
package ..........

c:\jdk1.1.8\bin\javac  -classpath
.;c:\ant\ant.jar;c:\jdk1.1.8\lib\Tidy.jar;c:\jdk1.1.8\lib\classes.zip
Test16.java

No problem

>A bit of experimentation produced:
>
[quoted text clipped - 14 lines]
>
> Thufir Hawat
thufir - 20 Jan 2005 04:18 GMT
> On winXP after I removed the line at the top of the file
>  package ..........
>
> c:\jdk1.1.8\bin\javac  -classpath
> .;c:\ant\ant.jar;c:\jdk1.1.8\lib\Tidy.jar;c:\jdk1.1.8\lib\classes.zip

> Test16.java
>
> No problem

Thanks :)

I believe I've got it now.

--
Thufir Hawat
Jean Pierre Daviau - 19 Jan 2005 23:19 GMT
Hi,
       Test16 t1 = new Test16(args[0], args[1], args[2], true);
       Test16 t2 = new Test16(args[3], args[4], args[5], false);

By the way ??? You dont specify a usage for the arguments.

JP
thufir - 20 Jan 2005 04:16 GMT
> Hi,
>         Test16 t1 = new Test16(args[0], args[1], args[2], true);
[quoted text clipped - 3 lines]
>
> JP

I don't specify a usage for the arguments because it's not my code ;)

see
<http://sourceforge.net/docman/display_doc.php?docid=1298&group_id=13153>

Also, I think I got it working, I didn't include enough path info for
the "java" command.  And, I edited the code a bit and have a newer
thread that makes more sense, but, I think it's moot :)
thanks,

Thufir Hawat


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.