Results 1 to 9 of 9
-
06-27-2011, 12:03 PM #1
- Member Since
- Jun 27, 2011
- Posts
- 7
- Rep Power
- 0
bash 'export' command not working
Hello,
Not sure if this is the right place to put this, but here goes.
Attempting to install jdbc driver so I can connect my java programs to a mysql server.
This is what I have done:
- downloaded mysql-connector-java-5.1.16.zip file from mysql.com.
- Following instructions to install using a bash shell, I typed into my terminal:
sudo export set CLASSPATH=/path/mysql-connector-java-5.1.16-bin.jarCLASSPATH
Password:
This is the error I get:
sudo: export: command not found
export is among my commands on my machine.
I have tried various ways of typing the export command: using no 'sudo' results in nothing I think, just returns to current directory. If that means it was successful I do not no how to check. I did try to run my java program but did not connect successfully.
I am really stuck, lost, where is my 'export' command?
Any questions or advice, please help, Thanks!
- 06-27-2011, 02:38 PM #2
- Member Since
- Feb 14, 2004
- Location
- Groves, Texas
- Posts
- 4,781
- Your Mac's Specs
- 21in. iMac 10.11 --- HP Linux Mint 18
- Rep Power
- 21
export is a bash builtin - it's built into bash. If it doesn't work there's something wrong with bash.
You might be better off putting that command into .bashrc or .bash_profile.
To see if it worked at all type in Terminal: env
You'll get a whole list of stuff.
edit: you shouldn't need to use sudo to put something in your environment, unless it's somehow affecting all users or the system itself.
06-27-2011, 05:58 PM #3
- Member Since
- Jun 27, 2011
- Posts
- 7
- Rep Power
- 0
Thanks Cradom,
It in fact did work, it is in my list of environment variables.
So where do you think would be a good place to store my jar file? Right now it is in my 'downloads' folder.
Thanks again for the pointer!
06-28-2011, 04:33 AM #4
- Member Since
- Feb 14, 2004
- Location
- Groves, Texas
- Posts
- 4,781
- Your Mac's Specs
- 21in. iMac 10.11 --- HP Linux Mint 18
- Rep Power
- 21
Pretty much anywhere in your user folder. If you don't have one, make a folder named Apps and put it in there.
Is this a clickable app or a command line app? If command line, you need to put wherever it is in your $PATH.
06-28-2011, 12:50 PM #5
- Member Since
- Jun 27, 2011
- Posts
- 7
- Rep Power
- 0
The problem I am having now is with some java code, getting a class not found exception when trying to load the jdbc driver, I think. I don't really understand the 'Class.forName() method. Read some things on it but still not quite sticking. I posted another thread named 'jdbc driver install location?' that has the java code. The post is under 'operating systems' as well.
I think the problem is the driver files are in the wrong location but maybe it is something else. I do know that the jdbc driver package is not meant to be clickable but that is about it for my knowledge.
06-28-2011, 02:19 PM #6
- Member Since
- Feb 14, 2004
- Location
- Groves, Texas
- Posts
- 4,781
- Your Mac's Specs
- 21in. iMac 10.11 --- HP Linux Mint 18
- Rep Power
- 21
Oh, wait, it's a driver? Missed that. Probably should go in the System somewhere then, don't know where.
Some one a whole lot more knowledgeable than me should help with this.
06-28-2011, 02:38 PM #7
- Member Since
- Jun 27, 2011
- Posts
- 7
- Rep Power
- 0
No worries, thanks for your help.
06-28-2011, 03:26 PM #8
- Member Since
- Feb 26, 2010
- Location
- Rocky Mountain High, Colorado
- Posts
- 2,116
- Your Mac's Specs
- 1.8 GHz i7 MBA 11" OSX 10.8.2
- Rep Power
- 13
Put it in /etc/bashrc or try sudo -E and do the export in your own environment. That being said - you could just use macports to install
sudo port search jdbc
will show you the available setups - I thought I saw jdbc
07-05-2011, 11:55 AM #9
- Member Since
- Jun 27, 2011
- Posts
- 7
- Rep Power
- 0
Okay, to anyone who wants to know, I figured out my problem. exporting to my classpath worked fine. After that, I placed a copy of the jar file and put it in:
Library/Java/Extensions
Everything works great.
I found some placed the jar file in: Library/Java/Home/lib. Didn't work for me, maybe depends on JDK version you are running or something.
Anyway, thanks for the help!
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
Learning the Command Line - Bash Prompts (1)
By vansmith in forum macOS - Operating SystemReplies: 0Last Post: 04-15-2014, 06:45 PM -
Bash command not found
By danipoak in forum macOS - Development and DarwinReplies: 10Last Post: 12-18-2013, 12:43 PM -
-bash g++:command not found
By Brightsun in forum macOS - Development and DarwinReplies: 4Last Post: 04-22-2012, 09:20 AM -
bash: make: command not found
By yousemeti in forum macOS - Development and DarwinReplies: 9Last Post: 02-29-2012, 05:28 PM -
bash command window size
By wfs123 in forum macOS - Operating SystemReplies: 0Last Post: 08-07-2011, 04:51 PM