bash 'export' command not working

Joined
Jun 27, 2011
Messages
7
Reaction score
0
Points
1
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.jar:$CLASSPATH
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!
 
Joined
Feb 14, 2004
Messages
4,781
Reaction score
166
Points
63
Location
Groves, Texas
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.
 
OP
M
Joined
Jun 27, 2011
Messages
7
Reaction score
0
Points
1
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!
 
Joined
Feb 14, 2004
Messages
4,781
Reaction score
166
Points
63
Location
Groves, Texas
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.
 
OP
M
Joined
Jun 27, 2011
Messages
7
Reaction score
0
Points
1
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.
 
Joined
Feb 14, 2004
Messages
4,781
Reaction score
166
Points
63
Location
Groves, Texas
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.
 
Joined
Feb 26, 2010
Messages
2,116
Reaction score
123
Points
63
Location
Rocky Mountain High, Colorado
Your Mac's Specs
1.8 GHz i7 MBA 11" OSX 10.8.2
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
 
OP
M
Joined
Jun 27, 2011
Messages
7
Reaction score
0
Points
1
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!
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top