Help building application

A

Adam

Hello,

I am fairly new to Java. I recently switched from C++ to Java for a
project I am working on. I was looking for a decent HTML parser when I came
across the htmlparser 1.5 project on Sourceforge.net. I understand the
logic, but I am having build problems with my own classes. If I put my class
in the jar file along with all the other parser classes, everything works
well, but I prefer not to do it that was. When I have a separate .class file
and try to run it through the JVM I get the following error:
"java.lang.NoClassDefFoundError: AdamParser (wrong name:
org/htmlparser/AdamParser)". All I want to do is test my ideas the simplest
way possible. I was hoping some more experienced Java programmer could help
me.

TIA,
Adam
 
R

Roedy Green

I am fairly new to Java. I recently switched from C++ to Java for a
project I am working on. I was looking for a decent HTML parser when I came
across the htmlparser 1.5 project on Sourceforge.net. I understand the
logic, but I am having build problems with my own classes. If I put my class
in the jar file along with all the other parser classes, everything works
well, but I prefer not to do it that was. When I have a separate .class file
and try to run it through the JVM I get the following error:
"java.lang.NoClassDefFoundError: AdamParser (wrong name:
org/htmlparser/AdamParser)". All I want to do is test my ideas the simplest
way possible. I was hoping some more experienced Java programmer could help
me.

If you want multiple jars, you must insert a reference to the
additional jars inside the first jar's manifest Class-Path entry.
You also might want to include an index to all the jars in the first
jar.

See http://mindprod.com/jgloss/jar.html
http://mindprod.com/jgloss/jarexe.html
 
A

Adam

Hello Roedy,

What I was hoping for was to use the Java HTML Parser just like a library
in any other language (i.e. C, C++) where I have my own file or files that
get linked with the library. The only way I can get this to work is to put
my new class file into the Jar file. It works, but it is inconvenient for
me. I can compile my classes OK, but I can't run them.

Thanks,
Adam
 
R

Raymond DeCampo

Adam said:
Hello Roedy,

What I was hoping for was to use the Java HTML Parser just like a library
in any other language (i.e. C, C++) where I have my own file or files that
get linked with the library. The only way I can get this to work is to put
my new class file into the Jar file. It works, but it is inconvenient for
me. I can compile my classes OK, but I can't run them.

Please do not top post, especially in reply to a bottom posted reply.

It sounds like you are having classpath issues. Consult Roedy's site
for information on classpath (see links below).

If you want multiple jars, you must insert a reference to the
additional jars inside the first jar's manifest Class-Path entry.
You also might want to include an index to all the jars in the first
jar.

See http://mindprod.com/jgloss/jar.html
http://mindprod.com/jgloss/jarexe.html

HTH,
Ray
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,040
Latest member
papereejit

Latest Threads

Top