Re: moving CLASSPATH
vjp2.at@at.BioStrategist.dot.dot.com wrote:
I want to move an exe
program which uses a registry definition of java [sic] classpath
Unfortunately It does not ask for install directory so I can't use
PortableApps Launcher
I have the classpath from the registry and set it in the batch file as an
environment variable but it doesn't find it.
THis is a long shot but, Is it possible to run some Java program to specify
the classpath then run the exe?
Terrible idea.
set classpath=lib\a.jar;lib\b.jar;lib\c.jar
Should I put set myhome=. and put myhome in front of each occurance of lib???
First, don't use CLASSPATH.
Second, "classpath" is not correct. You only get away with it because Windows
is lax. It's "CLASSPATH". But you shouldn't use it anyway.
You used relative directories. That means that *every* Java program in that
system must run from a directory with a "lib/" subdirectory with those three
JARs in it if they are to run. That's exemplary of why you should not use
CLASSPATH. It's too global. Don't use it.
Use the "-classpath" (a.k.a. "-cp") option to the Java tools ("java" and
"javac", here).
Why are you using Java if you're packaging to an EXE?
If you must use CLASSPATH, which is a bad idea, at least specify absolute
directories for the path roots.
It's better to package your application as a JAR (which controls its own
classpath and ignores CLASSPATH) than as an EXE. Use the JAR format. That's
what it's for. You can associate JAR files with "java" (or "javaw") to launch
them on double-click, package them in a CMD file to make them act like native
executables, or write a thin executable wrapper to launch the JAR. All of
which make it easier to shun CLASSPATH as you should.
--
Lew
Honi soit qui mal y pense.
http://upload.wikimedia.org/wikipedia/commons/c/cf/Friz.jpg