Find the answer to your Linux question:
Results 1 to 3 of 3
I have read various articles on setting classpath in linux, but couldn't get through and I am still unclear as to how to set the classpath in linux? I even ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Sep 2012
    Posts
    1

    setting classpath for mysql java connector in linux


    I have read various articles on setting classpath in linux, but couldn't get through and I am still unclear as to how to set the classpath in linux?

    I even copied the 'mysql-connector-java-5.1.22-bin.jar' in my project src folder where the .class file is generated but still no success.

    I also tried setting the classpath at runtime by: export CLASSPATH=/opt/integra/middleware/LCPAnalyzer/src/mysql-connector-java-5.1.22-bin.jar

    but then i got the NoClassDefFoundError exception:

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,392
    There are two ways to set the classpath. One is to use the environment variable CLASSPATH. The other is to specify the classpath option on the Java command line. For the environment to work, you need ALL of the paths to jar files needed. When I started doing serious Java development earlier this year, this was a major part of my learning curve...
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  3. #3
    Just Joined!
    Join Date
    Apr 2012
    Location
    Australia
    Posts
    33
    CLASSPATH variable can be set in user /etc/proc file to automatically be looked for to run a java program. If its web server then put the jar in /WEB-INF/lib of the application.
    for commandline -cp or -classpath is a ; separated list after classpath.
    run on the command terminal
    java -h and look at the options.

Posting Permissions

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