The Notebook Review forums were hosted by TechTarget, who shut down them down on January 31, 2022. This static read-only archive was pulled by NBR forum users between January 20 and January 31, 2022, in an effort to make sure that the valuable technical information that had been posted on the forums is preserved. For current discussions, many NBR forum users moved over to NotebookTalk.net after the shutdown.
Problems? See this thread at archive.org.

    How to set java path in linux?

    Discussion in 'Linux Compatibility and Software' started by wearetheborg, Jul 17, 2009.

  1. wearetheborg

    wearetheborg Notebook Virtuoso

    Reputations:
    1,282
    Messages:
    3,122
    Likes Received:
    0
    Trophy Points:
    105
    All right, so my debian install has placed sun java etc in non-standard places, how do I set the path ?
    I set
    Code:
    export JAVA_HOME=/usr/lib/jvm/java-6-sun
    export PATH=/home/wearetheborg/bin:$JAVA_HOME/bin:$PATH
    
    but there a bunch of files (eg junit.jar) in /usr/share/java -- how do I include them so that java apps can find them ?
     
  2. Budding

    Budding Notebook Virtuoso

    Reputations:
    1,686
    Messages:
    3,982
    Likes Received:
    0
    Trophy Points:
    105
    I've moved this thread to the Linux forum since you will most likely get more help there.
     
  3. archer7

    archer7 Notebook Evangelist

    Reputations:
    289
    Messages:
    647
    Likes Received:
    0
    Trophy Points:
    30
    I think what you're looking for is the CLASSPATH variable.
     
  4. helikaon

    helikaon Notebook Consultant

    Reputations:
    269
    Messages:
    288
    Likes Received:
    0
    Trophy Points:
    30
    Hi, i written something about java installation in this post here on forums:
    http://forum.notebookreview.com/showthread.php?t=355974&highlight=java+64bit

    You can have more versions of jre on your box and switch between them by alternatives command.
    The PATH variable just says which folders should be searched for runnable binaries and scripts. If you need these paths you wrote up in your post available for all users, paste it in the /etc/profile file, if only for one user (you) paste it in the ~/.bash_profile (you can setup any variable and propagate it to system this way).
    I don't think the /usr/share/java folder will help you by adding it to PATH, but you can try. Just add this folder to your second row you posted in your post.

    gl&hf :)
     
  5. wearetheborg

    wearetheborg Notebook Virtuoso

    Reputations:
    1,282
    Messages:
    3,122
    Likes Received:
    0
    Trophy Points:
    105
    I think archer7 is right. The JAVA_HOME variable selcts the correct jre, but the problem is with the misc jar files which contain diff packages.

    BTW debian does not have the alternatives command ...
     
  6. helikaon

    helikaon Notebook Consultant

    Reputations:
    269
    Messages:
    288
    Likes Received:
    0
    Trophy Points:
    30
    Well hope, you're gonna solve it, i'd have to 'see' problem myself, this i'm a bit 'shootin at stars' :.)
    btw.
    I just had look on uncle google, so how about command 'update-alternatives'? Just saw something like that with Debian mentioned, maybe i'm not right, i dont use debian or its derivated distros, ehh :)
     
  7. wearetheborg

    wearetheborg Notebook Virtuoso

    Reputations:
    1,282
    Messages:
    3,122
    Likes Received:
    0
    Trophy Points:
    105
    Thanks ! that seems to work to use the correct version of java and I will use it in the future to install suns-java versions.
    Currently I've using sun-java by modifying JAVA_HOME.

    The links you cited mentioned that CLASSPATH may still needed to be tinkered with to get the jar files on javas search path.
     
  8. chrixx

    chrixx Product Specialist NBR Reviewer

    Reputations:
    641
    Messages:
    1,859
    Likes Received:
    0
    Trophy Points:
    55
    If you have classes in jar which need to be loaded onto the classpath, then you either set the CLASSPATH to point to the jar file or use the -cp option.