Results 1 to 9 of 9
  1. #1


    Member Since
    Jun 27, 2011
    Posts
    7
    Question 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!

  2. #2

    cradom's Avatar
    Member Since
    Feb 14, 2004
    Location
    Groves, Texas
    Posts
    4,478
    Specs:
    21in. iMac 10.11 --- HP win 10
    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.

  3. #3


    Member Since
    Jun 27, 2011
    Posts
    7
    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!

  4. #4

    cradom's Avatar
    Member Since
    Feb 14, 2004
    Location
    Groves, Texas
    Posts
    4,478
    Specs:
    21in. iMac 10.11 --- HP win 10
    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.

  5. #5


    Member Since
    Jun 27, 2011
    Posts
    7
    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.

  6. #6

    cradom's Avatar
    Member Since
    Feb 14, 2004
    Location
    Groves, Texas
    Posts
    4,478
    Specs:
    21in. iMac 10.11 --- HP win 10
    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.

  7. #7


    Member Since
    Jun 27, 2011
    Posts
    7
    No worries, thanks for your help.

  8. #8

    IvanLasston's Avatar
    Member Since
    Feb 26, 2010
    Location
    Rocky Mountain High, Colorado
    Posts
    2,116
    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

  9. #9


    Member Since
    Jun 27, 2011
    Posts
    7
    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

  1. Learning the Command Line - Bash Prompts (1)
    By vansmith in forum OS X - Operating System
    Replies: 0
    Last Post: 04-15-2014, 06:45 PM
  2. Bash command not found
    By danipoak in forum OS X - Development and Darwin
    Replies: 10
    Last Post: 12-18-2013, 11:43 AM
  3. -bash g++:command not found
    By Brightsun in forum OS X - Development and Darwin
    Replies: 4
    Last Post: 04-22-2012, 09:20 AM
  4. bash: make: command not found
    By yousemeti in forum OS X - Development and Darwin
    Replies: 9
    Last Post: 02-29-2012, 04:28 PM
  5. bash command window size
    By wfs123 in forum OS X - Operating System
    Replies: 0
    Last Post: 08-07-2011, 04:51 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •