classpath for jar files
How to set the lib classpath for JAVA program?
I have JAVA program that connect to sql2000 database. It requires a driver (i.e. msbase.jar, mssqlserver.jar, msutil.jar). It is working when I run it with classpath set on the command line, e.g.
javac -classpath ".;./lib/msbase.jar;./lib/mssqlserver.jar;./lib/msutil.jar" MyProgram.java
java -classpath ".;./lib/msbase.jar;./lib/mssqlserver.jar;./lib/msutil.jar" MyProgram
However, it won't work if i move the lib directory to somewhere else and change the above command line to where those .jar located
or
when the "main()" is not on "MyProgram.java", i.e. I have "MyProgram.java" as runnable where the "main()" code calling it.
Is there a better way to set the classpath, i.e. code it into my program so it can find those lib jar files? If so, please advice.
I tried to create "CLASSPATH" environment variable on Windows but it still does not work.
Thanks in advance.

