I want to access classfiles libraries on the system from inside my jarfile application (Windows NT). It seems I automatically have access to the java runtime, no matter what the classpath variable is like, but I haven't succeeded in getting access to my other classfile libraries. If unpack my jarfile and then run the application I have access, but not if I run the application directly from the jarfile (by doubleclicking or writing java -jar <name of jar>. I get java.lang.ClassNotFoundException Any ideas to help?
Running from an executable jar is a different thing from running from nat a jar in that, when you run from the jar file, the CLASSPATH environment variable is ignored (as you found out). To solve this problem, include the following entry in you manifest file: Class-Path: <directory1> <directory2> <directory3>
Note the spelling and hyphenation of "Class-Path". Also note that the path entries are separated by spaces and not by ; (or : ) Also, these directories are relative to the location of the jar file, not the directory from which you run the "java" command.
Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.
This is definately a Classpath issue. RunnningJars with the -jar option, the Classpath is Automatically : your java lib directory, the current directory and the Jar you are running! Not your system Classpath variable!!! There are two ways to set the classpath for -jar, one is to include the -cp on the command line (Not likely you can use this with double click to start) The second is to include the entry "Class-Path :" in your Manifest file. Details on this can be found at http://java.sun.com/j2se/1.4.1/docs/guide/jar/jar.html#Main%20Attributes