Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » can't run a jar with classpath
can't run a jar with classpath [message #510637] Thu, 28 January 2010 02:32 Go to next message
Eclipse UserFriend
Hi,
I developed a jar file that has h2.jar in the classpath.
I run the program in eclipse and everything goes well.
When I execute jar out of my project, and put it in c:
including the h2.jar, and call:
C:\>java -jar myJar.jar classpath c:\h2.jar
I get: org.h2.DriverLjava.lang.StackTraceElement;@173a10f .
Actually it doesn't find the jar.

Thanks

I solved it !
The solution for anyone who will need it:
I added a manifest file that includes the filepath and it has been resolved.
Thanks.

[Updated on: Thu, 28 January 2010 03:55] by Moderator

Re: can't run a jar with classpath [message #510652 is a reply to message #510637] Thu, 28 January 2010 03:34 Go to previous message
Eclipse UserFriend
moshi wrote:
> Hi, I developed a jar file that has h2.jar in the classpath. I run the
> program in eclipse and everything goes well. When I execute jar out of
> my project, and put it in c: including the h2.jar, and call: C:\>java
> -jar myJar.jar classpath c:\h2.jar I get:
> org.h2.DriverLjava.lang.StackTraceElement;@173a10f . Actually it
> doesn't find the jar.
> AnyBody has a clue ?
That's not really an Eclipse question. If you specify -jar then takes
the classpath from the JAR's manifest.mf and ignores -classpath. It
might be simpler if you just select your project and then use File >
Export... > Runnable JAR file.

Dani
> I tried 2 different ways of calling:
> java -jar myJar.jar -classpath h2.jar and also:
> java -classpath h2.jar -jar myJar.jar
> Thanks
Previous Topic:The refactor-rename of java package--encoding problem
Next Topic:Text formatting problem: Missing context menu and max line length parm
Goto Forum:
  


Current Time: Mon Mar 24 23:08:04 EDT 2025

Powered by FUDForum. Page generated in 0.02717 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top