I am new to Linux and know very little about it.
I have installed Ubuntu (8.04), MySQL and NetBeans (because I want to develop some database applications in Java under Linux).
I have downloaded the MySQL Connector/J jar file into a directory I created called /jconnector. Java needs to know the location of the Connector jar file by means of a CLASSPATH environment variable. I have done this by using
However, when I try to connect to JDBC from Java, it fails. So I got my Java program to display the contents of the CLASSPATH environment variable by using the following (Java) code:
The output from this is
Yet if I do
at a terminal window, the expected path is displayed correctly.
Presumably my understanding of Linux environment variables is wrong. Can anyone tell me why my Java code doesn't pick up the CLASSPATH environment variable?
Andrew
Hampshire, UK
I have installed Ubuntu (8.04), MySQL and NetBeans (because I want to develop some database applications in Java under Linux).
I have downloaded the MySQL Connector/J jar file into a directory I created called /jconnector. Java needs to know the location of the Connector jar file by means of a CLASSPATH environment variable. I have done this by using
Code:
export set CLASSPATH=/jconnector/mysql-connector-java-5.1.7-bin.jar
Code:
String classp = System.getProperty("CLASSPATH");
System.out.println("CLASSPATH set to " + classp);
CLASSPATH set to null
Yet if I do
Code:
echo $CLASSPATH
Presumably my understanding of Linux environment variables is wrong. Can anyone tell me why my Java code doesn't pick up the CLASSPATH environment variable?
Andrew
Hampshire, UK