Classpath reading in Linux

0

$ $CLASSPATH
$ $ source .profile
$ $CLASSPATH
> bash: :/usr/java/connectors/mysql-connector-java-5.1.23-bin.jar: No such file or directory
$ /usr/java/connectors/mysql-connector-java-5.1.23-bin.jar 
> no main manifest attribute, in /usr/java/connectors/mysql-connector-java-5.1.23-bin.jar

What I'm having trouble understanding is, when I run it from $CLASSPATH (to see if it has been set) why it's not being detected. Shouldn't it be the same if I type it in? I'm getting two different results.

the connector is 0777 with owner root:root.

James Bone

Posted 2013-03-05T06:03:44.743

Reputation: 111

What does '$' and '>' at the beginning of the line mean? – None – 2013-03-05T06:06:05.493

$ means "this is something I'm typing as my user (not root)"

means "this is something the console has returned"

– None – 2013-03-05T06:12:16.697

So you typed $CLASSPATH, then you typed .profile, then you typed CLASSPATH (without $) and got error message? So that is CLASSPATH command? – None – 2013-03-05T08:24:48.463

sorry the third line has $CLASSPATH, it's an environment variable I set in profile... that should also be "$ source profile" I'll edit now. – James Bone – 2013-03-05T11:43:22.400

Are you exporting the CLASSPATH environment variable? Either in your script or on the command line you need: export CLASSPATH – Paul Bone – 2013-03-06T05:59:58.950

Answers

0

While it doesn't solve the problem as I'd like I have found a solution.

In this instance I'm trying to add a JDBC connector so I can use it in my Java programming. In Eclipse I've been able to go configure build path -> add variable -> configure, then define CLASSPATH as the .jar file.

If anyone still has an answer for the posted question I would be very interested to know.

James Bone

Posted 2013-03-05T06:03:44.743

Reputation: 111