
Originally Posted by
theDaveTheRave
if it was such a simple thing, why is it that on the MySQL site and on all the other forums they are saying that you need to edit the classpath and stuff.... which for me didn't work!
Putting all kinds of libraries in jre/lib/ext is not recommended, because these libraries will now be loaded for every Java application that you load - and sometimes that is not what you want, especially if a Java application has a different version of the same libraries (the lib you'd have in jre/lib/ext could interfere with the application, leading to weird and hard to solve problems).
You can set the classpath of a Java application on the commandline with the "-cp" switch:
Code:
# Compile with:
javac -cp blabla.jar:. MyProgram.java
# Run with:
java -cp blabla.jar:. MyProgram
Or you can set the CLASSPATH environment variable in your .profile, for example. Add a line like this to .profile:
Code:
export CLASSPATH=/home/user/bla/blabla.jar:.
(Log out and back in again to make sure it's activated).
Note that entries in the classpath are separated with ':', and '.' means "the current directory".
Bookmarks