• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Java classpath issues

AFB

Lifer
I move the MySQL driver jar file to the lib/ext, but I get class not found when I try to use it.

This isn't very nice.

Thanks 🙂
 
Yea, you can specify the classpath with java -cp (classpath here without parentheses or . for current working directory) at command line when you run the program.

In the code you can get the classpath with String classpath = System.getProperties().getProperty("java.class.path");
 
Hmm. I just went over the java tutorial part on extensions and I'm puzzled as to why it wasn't picked up.

How are you using the driver? Are you doing the old Class.forName()/DriverManager thing or do you actually need the driver present to compile? And on that subject, are you stuck on the compile or the run?
 
Originally posted by: kamper
Hmm. I just went over the java tutorial part on extensions and I'm puzzled as to why it wasn't picked up.

How are you using the driver? Are you doing the old Class.forName()/DriverManager thing or do you actually need the driver present to compile? And on that subject, are you stuck on the compile or the run?

Class for and run, there's another way to do it?

Haven't used SQL in java before 🙂
 
Sorry, don't quite follow. You are using DriverManager or not? All I'm wondering is if you actually reference mysql classes in your code and, as a direct result, whether you can compile but then not run or if you can't even compile.
 
Originally posted by: kamper
Sorry, don't quite follow. You are using DriverManager or not? All I'm wondering is if you actually reference mysql classes in your code and, as a direct result, whether you can compile but then not run or if you can't even compile.

Yes, I am using DriverManager. It compiles, but no run.
 
The JDK installs a seperate copy of the JVM outside of the one inside the jdk folder. My guess is you don't have the jar file in the lib/ext folder of the seperate jvm install, since this will be the one used by default when executing your application.

This is why generally you include copies of the extra jars and modify the classpath. When creating your own jar file you can specify additional jar files needed to be in its classpath right in the manifest.
 
Back
Top