LinuxQuestions.org
Visit the LQ Articles and Editorials section
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, 07: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, 07:51 PM   #2
jay73
Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 130Reputation: 130
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, 09:39 PM   #3
TITiAN
Member
 
Registered: Mar 2008
Location: NRW, Germany
Distribution: Debian GNU/Linux with XFCE and packages from "testing"
Posts: 377

Rep: Reputation: 46
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, 10:15 PM   #4
John VV
Guru
 
Registered: Aug 2005
Posts: 13,522

Rep: Reputation: 1805Reputation: 1805Reputation: 1805Reputation: 1805Reputation: 1805Reputation: 1805Reputation: 1805Reputation: 1805Reputation: 1805Reputation: 1805Reputation: 1805
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, 05:36 AM   #5
jay73
Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 130Reputation: 130
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, 07:43 AM   #6
TITiAN
Member
 
Registered: Mar 2008
Location: NRW, Germany
Distribution: Debian GNU/Linux with XFCE and packages from "testing"
Posts: 377

Rep: Reputation: 46
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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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-14-2009 12:25 AM
how to set up path,classpath,catalina home for java in fedora -9 vicky7038 Linux - Software 1 08-19-2008 09:41 AM
problem with $PATH, .bash_profile, and .bashrc ? Bernard Swiss Linux - General 7 10-11-2007 11:34 PM
How to set PATH and CLASSPATH environment variables bronko Linux - Newbie 2 12-20-2003 12:13 PM
set up path,classpath in linux(slaware9) for java Manjula.S Linux - Software 5 10-07-2003 12:38 AM


All times are GMT -5. The time now is 05:57 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration