Click to See Complete Forum and Search --> : getting Java registered on the PATH


ralph-hogaboom
01-05-2003, 02:14 PM
Hi all,

I'm using Red Hat 8.0. Trying to install Java via rpm. I've got 1.4, and 1.4.1_xx installed, but java only works if i specifically call the java path and then my program name

$ /usr/java/j2re1.4.1_01/bin/java some-java-program.jar

If i try to install a new program, for example, that requires my system to know where the jre is, then i get this message:

No Java virtual machine could be found from your PATH environment variable. You must install a VM prior to running this program.

How can I set the JRE in my PATH?

ralph-hogaboom
01-05-2003, 02:41 PM
alright .... figured it out. duh.

at the shell, become root:

[ralph@localhost ralph]$ su
Password:
[root@localhost ralph]# vi .bashrc

Then add the following lines to the bottom of .bashrc -

PATH="$PATH:/usr/java/j2sdk1.4.1_01/jre/bin:."
export PATH

Then save by typing

:wq

Then logout & log back in (or restart BASH, if you know how to do that - I don't).

Hope this helps another newbie.
Ralph Hogaboom

Legithrandil
01-14-2003, 06:37 PM
well, I tried this, and, after restarting BASH got this message:

-bash: /home/legithrandil/.bashrc: line 12: syntax error: unexpected end of file
-bash-2.05b$

obviously, this isn't good, so I took out the lines about Java. Same error message, except it was now at line 10.
Her is my bashrc file:

#.bashrc

#User Specified aliases and functions


#Source global definitions
if [ -f /etc/bashrc]; then
./etc/bashrc
~
~
~

JCool451
01-15-2003, 06:31 AM
Search the web about setting the path. I have the same exact problem. If I fix it I'll tell you. Infact...

JCool451
01-15-2003, 06:37 AM
What's da deal wit Java? (http://linuxnewbie.org/forum/showthread.php?s=&threadid=82686) This is when I posted. Tell me if it helps.

mdwatts
01-15-2003, 07:23 AM
Originally posted by Legithrandil
well, I tried this, and, after restarting BASH got this message:

-bash: /home/legithrandil/.bashrc: line 12: syntax error: unexpected end of file
-bash-2.05b$

obviously, this isn't good, so I took out the lines about Java. Same error message, except it was now at line 10.
Her is my bashrc file:

#.bashrc

#User Specified aliases and functions


#Source global definitions
if [ -f /etc/bashrc]; then
./etc/bashrc
~
~
~

What is on line 10?

Post line 7 to 12 so we can have a look.

Did you use a Linux text editor to modify .bashrc?

Legithrandil
01-15-2003, 10:47 AM
lines 7-end are all tildes (~). I used vi to edit the file.

I fixed this problem by copying the root copy of .bashrc. and it works fine. no java tho. I'll post it's output after I get home from school.

glyph
01-19-2003, 03:15 AM
i found a file in my /ect/profile.d directory called 'alljava.sh' (i use suse 8.1). i just opened the file with an editor and changed the paths in the file to the new version of java. hope this helps.