LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-09-2009, 06:24 PM   #1
htamayo
Member
 
Registered: Jan 2005
Location: san salvador, el salvador
Distribution: Debian Stable, UbuntuStudio Karmic Koala
Posts: 190

Rep: Reputation: 30
problem in set the $PATH and $CLASSPATH in my .bashrc


Hi, I'm trying to communicate my j2eesdk -not openjdk- with mysql through mysql-connector-java, so I have to setup an specific data in my $PATH and $CLASSPATH vars in .bashrc, here it is:

Code:
#j2ee
export PATH=/niit/j2eesas/jdk/bin:$PATH
JAVA_HOME="/niit/j2eesas/"
export JAVA_HOME
CLASSPATH=/niit/j2eesas/lib/j2ee.jar:/niit/j2eesas/jdk/jre/lib/ext/mysql-connector-java-5.1.7-bin.jar
export CLASSPATH
after reboot my system, checking these vars, I've got this:

Code:
tamayo@gxa16b14:~$ $CLASSPATH
bash: /niit/j2eesas/lib/j2ee.jar:/niit/j2eesas/jdk/jre/lib/ext/mysql-connector-java-5.1.7-bin.jar: file or directory doesn't exist
I know that the file mysql-connector-java-5.1.7-bin.jar is in the correct directory -the directory that is written in the CLASSPATH var; but I don't understand why it didn't find, and obviously testing this config from within a JAVA program I got the same: ClassDefNotFound

My question is:
what am I doing wrong in setting my $CLASSPATH var? I have to point to mysql-connec-java.jar to communicate mysql and java and the correct setup of the CLASSPATH is very important. any suggestions are welcome

REgards
 
Old 04-09-2009, 06:51 PM   #2
jay73
LQ Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 133Reputation: 133
What is niit? Is that your user? If so, you would have to use /home/niit/etc instead.

Also, don't forget the $ sign if you export a variable that is not defined in the same statement.
 
Old 04-09-2009, 08:39 PM   #3
TITiAN
Member
 
Registered: Mar 2008
Location: NRW, Germany
Distribution: Arch Linux, using KDE/Plasma
Posts: 392

Rep: Reputation: 49
Quote:
Originally Posted by htamayo View Post
Code:
tamayo@gxa16b14:~$ $CLASSPATH
bash: /niit/j2eesas/lib/j2ee.jar:/niit/j2eesas/jdk/jre/lib/ext/mysql-connector-java-5.1.7-bin.jar: file or directory doesn't exist
Whoops! You forgot 'echo' before your var.
(To print out a var, use 'echo $VAR', not just '$VAR'.)
 
Old 04-09-2009, 09:15 PM   #4
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,624

Rep: Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651
you DO NOT put the file name " mysql-connector-java-5.1.7-bin.jar" in the path
You put the FOLDER it is in ,in the system path .
 
Old 04-10-2009, 04:36 AM   #5
jay73
LQ Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 133Reputation: 133
Quote:
you DO NOT put the file name " mysql-connector-java-5.1.7-bin.jar" in the path
You put the FOLDER it is in ,in the system path .
Not true, that does not work for jar files.
 
Old 04-10-2009, 06:43 AM   #6
TITiAN
Member
 
Registered: Mar 2008
Location: NRW, Germany
Distribution: Arch Linux, using KDE/Plasma
Posts: 392

Rep: Reputation: 49
jar files aren't really folders, they are archives
if Bash supported extracting files from archives on the fly without explicit decompressing, that would be a nice feat, but as you can see, it doesn't
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
set up java_home path in /home/user/.bashrc but use path in /usr/lib/java vitalstrike82 Slackware 4 01-13-2009 11:25 PM
how to set up path,classpath,catalina home for java in fedora -9 vicky7038 Linux - Software 1 08-19-2008 08:41 AM
problem with $PATH, .bash_profile, and .bashrc ? Bernard Swiss Linux - General 7 10-11-2007 10:34 PM
How to set PATH and CLASSPATH environment variables bronko Linux - Newbie 2 12-20-2003 11:13 AM
set up path,classpath in linux(slaware9) for java Manjula.S Linux - Software 5 10-06-2003 11:38 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:13 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration