Thread: Classpath

    #1
  1. No Profile Picture
    Techie
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2001
    Posts
    13
    Rep Power
    0

    Talking Classpath


    I downloaded the JDK and I cant get my java and javac to work. It keeps telling me 'command not found' even when I am in the bin directory. I am running RH Linux and tried setting the CLASSPATH in the sh shell by typing

    CLASSPATH=the java home

    export CLASSPATH

    Well I dont know whot else to do. HELP!!
  2. #2
  3. No Profile Picture
    Moderator =(8^(|)
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Feb 2002
    Location
    Sacramento, CA
    Posts
    1,710
    Rep Power
    14
    You need to set the PATH variable, not the CLASSPATH (although you will need the classpath set later). From within the bin directory, did you type "java", or "./java". Red Hat doesn't include the current directory in the path by default.

    **edit**
    Also, you don't want to point the PATH or CLASSPATH to the root directory. The PATH needs to point to /bin, and the CLASSPATH needs to point to /lib.
  4. #3
  5. No Profile Picture
    Techie
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2001
    Posts
    13
    Rep Power
    0

    Unhappy


    I did set the PATH, but it just doesnt stick.
    When I restart the comp, it isnt there anymore

    I used

    PATH=

    export PATH
  6. #4
  7. No Profile Picture
    Techie
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2001
    Posts
    13
    Rep Power
    0
    Originally posted by bricker42
    You need to set the PATH variable, not the CLASSPATH (although you will need the classpath set later). From within the bin directory, did you type "java", or "./java". Red Hat doesn't include the current directory in the path by default.

    **edit**
    Also, you don't want to point the PATH or CLASSPATH to the root directory. The PATH needs to point to /bin, and the CLASSPATH needs to point to /lib.
    Ok, I fixed the PATH to point to javahome/bin and the java commands are running by editing the $PATH in .bash_profile. Do I have to do CLASSPATH? How do i make i stick?
  8. #5
  9. No Profile Picture
    Moderator =(8^(|)
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Feb 2002
    Location
    Sacramento, CA
    Posts
    1,710
    Rep Power
    14
    Look at the syntax in your .bash_profile for how the path is set. You should be able to copy that basic format for your classpath.

    The problem with persistence that you're having is that when you log out all your environment variables are erased. You need to put commands into a script (.bash_profile) that is run every time you login.
  10. #6
  11. No Profile Picture
    Techie
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2001
    Posts
    13
    Rep Power
    0
    Originally posted by bricker42
    Look at the syntax in your .bash_profile for how the path is set. You should be able to copy that basic format for your classpath.

    The problem with persistence that you're having is that when you log out all your environment variables are erased. You need to put commands into a script (.bash_profile) that is run every time you login.

    I pointed the the PATH to .bash_profile, I also set the CLASSPATH to bin. The commands are now working but I keep getting an error telling me that the package system does not exist.
  12. #7
  13. No Profile Picture
    Moderator =(8^(|)
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Feb 2002
    Location
    Sacramento, CA
    Posts
    1,710
    Rep Power
    14
    http://java.sun.com/products/jdk/1.2...ml#Environment

    That's for setting the path, right below it is the classpath. You're pointing to the wrong directories.

    The instructions are for solaris, but they covers csh and bash, so they should work fine for you.

IMN logo majestic logo threadwatch logo seochat tools logo