What is Eclipse doing right (that my system isnt)? [message #257696] |
Thu, 05 June 2008 10:29  |
Eclipse User |
|
|
|
Originally posted by: pncaton.gmail.com
I inherited from another developer a package of classes that run queries
against an eXist database. I first worked on the code in Eclipse, and as
"Referenced Libraries" I linked to four Jar files that came with eXist,
including the xmldb.jar. The code compiled and ran with no problems.
Later I made a Jar file from my classes. I set the system classpath to
include the same four Jar files that were in the Eclipse build path. When
I tried to run the code from the command line, I got a
java.lang.NoClassDefFoundError referring to
org/xmldb/api/base/XMLDBException.
So then I tried running the code with the -classpath option and the full
classpath specified. Still the same error.
This is on a MacBook Pro, Mac OS 10.4, Java 1.5.0_13. Eclipse says it is
using JVM 1.5.0 (MacOS X Default) as its system library.
How is Eclipse able to run this code and the command line isn't, even
though they are supposedly both using the same classpath and same JVM?
Puzzled and hoping an Eclipse maven can shed some light on this,
Moominpapa.
|
|
|
Re: What is Eclipse doing right (that my system isnt)? [message #257700 is a reply to message #257696] |
Thu, 05 June 2008 12:15   |
Eclipse User |
|
|
|
Originally posted by: wegener.cboenospam.com
You can see the command line that Eclipse uses to run your application by
opening up the Debug perspective. Once it is open, run your application.
This should create an entry in the Debug view. Right click on this entry
and select Properties. The Properties dialog will give the command line
used to run the application. Hopefully, this can help give you some clues
as to what is wrong.
"Moominpapa" <pncaton@gmail.com> wrote in message
news:26166ef5db579527101b743f4d9ccdb8$1@www.eclipse.org...
> I inherited from another developer a package of classes that run queries
> against an eXist database. I first worked on the code in Eclipse, and as
> "Referenced Libraries" I linked to four Jar files that came with eXist,
> including the xmldb.jar. The code compiled and ran with no problems.
>
> Later I made a Jar file from my classes. I set the system classpath to
> include the same four Jar files that were in the Eclipse build path. When
> I tried to run the code from the command line, I got a
> java.lang.NoClassDefFoundError referring to
> org/xmldb/api/base/XMLDBException.
>
> So then I tried running the code with the -classpath option and the full
> classpath specified. Still the same error.
>
> This is on a MacBook Pro, Mac OS 10.4, Java 1.5.0_13. Eclipse says it is
> using JVM 1.5.0 (MacOS X Default) as its system library.
>
> How is Eclipse able to run this code and the command line isn't, even
> though they are supposedly both using the same classpath and same JVM?
>
> Puzzled and hoping an Eclipse maven can shed some light on this,
>
> Moominpapa.
>
|
|
|
|
Re: What is Eclipse doing right (that my system isnt)? [message #257718 is a reply to message #257715] |
Fri, 06 June 2008 10:28  |
Eclipse User |
|
|
|
Originally posted by: eclipse-news.rizzoweb.com
Moominpapa wrote:
> Thanks Dave, that did help narrow down the problem area. I find that I
> can run the program as classes from either inside Eclipse or from the
> command line. I have also found that whether I create a Jar file using
> the Eclipse wizard or via the command line I cannot run the Jar version
> of the program with getting the original class-not-found error that
> refers to one of the external Jar files the program depends on. It
> definitely isn't a classpath issue, or that Eclipse is using a different
> version of Java from the system. Unfortunately I'm a relative newbie at
> Java, so I don't always understand the implications of certain
> techniques, but I wonder if it is any coincidence that this particular
> external Jar contains a class that is loaded dynamically by one of the
> program classes. Eclipse shows a "Class is a raw type" warning about it,
> but it clearly doesn't stop the program running as a classes. Could it
> affect the Jar version, though?
When you try to run the JARed version, what is the classpath set to?
|
|
|
Re: What is Eclipse doing right (that my system isnt)? [message #257722 is a reply to message #257715] |
Fri, 06 June 2008 10:24  |
Eclipse User |
|
|
|
pncaton@gmail.com (Moominpapa) writes:
> Thanks Dave, that did help narrow down the problem area. I find that I
> can run the program as classes from either inside Eclipse or from the
> command line. I have also found that whether I create a Jar file using
> the Eclipse wizard or via the command line I cannot run the Jar
> version of the program with getting the original class-not-found error
> that refers to one of the external Jar files the program depends
> on. It definitely isn't a classpath issue, or that Eclipse is using a
> different version of Java from the system. Unfortunately I'm a
> relative newbie at Java, so I don't always understand the implications
> of certain techniques, but I wonder if it is any coincidence that this
> particular external Jar contains a class that is loaded dynamically by
> one of the program classes. Eclipse shows a "Class is a raw type"
> warning about it, but it clearly doesn't stop the program running as a
> classes. Could it affect the Jar version, though?
If you mean that when you use "java -jar file.jar" on the command
line...
"When you use this option, the JAR file is the source of all user
classes, and other user class path settings are ignored."
See
< http://java.sun.com/javase/6/docs/technotes/tools/windows/ja va.html>
--
Owen Rees; speaking personally, and not on behalf of HP.
========================================================
Hewlett-Packard Limited. Registered No: 690597 England
Registered Office: Cain Road, Bracknell, Berks RG12 1HN
|
|
|
Powered by
FUDForum. Page generated in 0.09735 seconds