Re: My shell can't find Java
From: John Fereira (jaf30_at_cornell.edu)
Date: 07/31/04
- Next message: Jim Sculley: "Re: Talking to Network Cameras."
- Previous message: Anony!: "Re: searching elements of an array within another array"
- In reply to: Oscar kind: "Re: My shell can't find Java"
- Next in thread: Steve Horsley: "Re: My shell can't find Java"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 31 Jul 2004 12:41:54 GMT
Oscar kind <oscar@danwa.net> wrote in news:p57st1-3ff.ln1@odin.asgard:
> IOANNS MANOLOUDIS <alien@mail.otenet.gr> wrote:
>> I am using Mandrake linux 10. I downloaded java with netbeans from Sun
>> and i installed it in /usr/local
>> Each time I type java I get an unknown command error.
>> I know that I need to make some modifications to some environmental
>> variable. Pleeeeeeeeeeeease can you tell me how can i do that?
>> I need to make it working so that every application that uses java
>> (such as Kdevelop or Openoffice) can find it.
>
> You need to add the java executables to your ${PATH}. Personally, I've
> done this (as root), because /usr/local/bin is first in my ${PATH}:
>
> cd /usr/local/bin/
> ln -s /usr/local/j2sdk1.4.2/bin/* .
>
> This method has the advantage I don't have to clutter my ${PATH} with
> all installed programs, but if I ever use a differnt java version (1.5
> comes to mind), I'll have to adjust the links.
Here's how I do it.
First, how you set environment variable depends on what shell you're using.
If you're not sure try typing echo $SHELL
If you're using sh or (more likely) bash the syntax (typically found in
.profile in your home directory) is
PATH=/usr/local/bin:/usr/bin:/usr/local/j2sdk1.4.2/bin
export PATH
If you're using csh (or tcsh) (typically done in a .login file in your home
directory) use:
setenv PATH /usr/local/bin:/usr/bin:/usr/local/j2sdk1.4.2
When adding directory PATHS for applications that I might update or require
different versions I use a separate variable.
JAVA_HOME=/usr/local/j2dk1.4.2
PATH=:/usr/local/bin:/usr/bin:${JAVA_HOME}/bin
export JAVA_HOME PATH
The, if I want to change versions I just change the value of JAVA_HOME with
changing the order of my search path. Note that some applications require
that the JAVA_HOME variable be set (i.e. Tomcat)
If you need to switch versions of compilers back and forth depending on what
you're compiling, put these statements in a separate files (one for each
version). Then use the "." command to read the file and put the environment
in your current shell. For example, if the commands are located in a file
called setpath.sh you can execute the following:
. setpath.sh
You can also use the . command in your .profile file so that you can
"include" you path setting commands at startup.
- Next message: Jim Sculley: "Re: Talking to Network Cameras."
- Previous message: Anony!: "Re: searching elements of an array within another array"
- In reply to: Oscar kind: "Re: My shell can't find Java"
- Next in thread: Steve Horsley: "Re: My shell can't find Java"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|