>>java -cp c:\;c:\jconn2.jar -jar ConnectTest.jar
>>[. . .]
[quoted text clipped - 3 lines]
>>Class-Path: c:/jconn2.jar c:/
>>Main-Class: connectTest.ConnectTest
You can use a URL, so
Class-Path: file:///c:/jconn2.jar file:///c:/path/to/some/other.jar
should work. But I don't know if a directory URL would work, i.e. like
Class-Path: file:///c:/
> Follow-up....I found a combination that works for this specific test
> case. If the two jar files are in the same directory, and my manifest
[quoted text clipped - 7 lines]
>
> java -jar ConnectTest.jar -cp .
All commandline parameters after the "-jar Your.jar" option will be
taken as program parameters. Your commandline would effectively pass two
arguments, "-cp" and ".", to the main program.
When you use the -jar option, other class path settings on the
commandline or in the CLASSPATH environment variable are ignored.
<http://java.sun.com/j2se/1.5.0/docs/tooldocs/windows/java.html#options>
> Then it works. Now the follow-up question -- I physically moved the
> jconn2.jar file to simplify the problem for this test case. In real
[quoted text clipped - 6 lines]
>
> How does one do that?
AFAIK, this isn't possible. Though a environment dependent classpath
isn't possible in this way, you could use an absolute file://-URL (as
described above).

Signature
Regards,
Roland de Ruiter
` ___ ___
`/__/ w_/ /__/
/ \ /_/ / \
Larry Coon - 10 Jun 2005 19:29 GMT
> All commandline parameters after the "-jar Your.jar" option will be
> taken as program parameters. Your commandline would effectively pass two
[quoted text clipped - 3 lines]
> commandline or in the CLASSPATH environment variable are ignored.
> <http://java.sun.com/j2se/1.5.0/docs/tooldocs/windows/java.html#options>
Ah, thanks. Turns out the -cp option was superfluous. It ran
just fine with:
java -jar ConnectTest.jar
> AFAIK, this isn't possible. Though a environment dependent classpath
> isn't possible in this way, you could use an absolute file://-URL (as
> described above).
Seems odd to me that this wouldn't be a fundamental thing that's
done all the time -- install a 3rd party library (in this case,
Sybase's implementation of JDBC, which is implemented in jconn2.jar)
and deploy a Java app which requires it. The natural thing to be
able to do (or so I thought) is install the library, point an env
variable so your app (or the JRE) can find it, and you're off &
running. The env variable is necessary because the library might
be in different places on different clients. Is what I'm trying to
do not as common as I think it is, or am I approaching it the wrong
way?
ninja java - 11 Jun 2005 18:07 GMT
You could look into using jnlp. It has many capabilities for
referencing other jar file libraries.
ninja java - 11 Jun 2005 18:02 GMT
Actually you can dynamically set the classpath. Just edit the class
path system property.
System.setProperty("java.class.path",
System.getProperty("java.class.path") + ";" + newClasspath);
this can work with jar files or directories.
I hope this helped.