File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
How classpath works for executable Jars
Joined: Mar 22, 2005
Nov 02, 2006 11:20:00
I've found that when I create a
batch application and Jar it up as an executable jar (Main-class indicated in manifest, run with "java -jar")
That my external dependant Jar files are never found unless I add them to the class-path in the executable Jar's manifest file.
I always get ClassNoDefFound errors if I try to define the class in any of the following ways:
- System environment variable "CLASSPATH"
- java -classpath parameter
I am wondering if there is something special about executable JAR files where you are required to specify your classpath inside of the manifest only or what else might be going on here.
author and iconoclast
Joined: Jul 08, 2003
Nov 02, 2006 12:34:00
Yes. CLASSPATH environment variables and the -classpath switch are both ignored when Java is running an executable jar.
Moving to Java in General (Beginner).
[Jess in Action]
I agree. Here's the link:
subject: How classpath works for executable Jars
Using a jar in classpath on command line
Can't find jar file in CLASSPATH in Fedora 5
Imbedded jar file
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015