RHEL 4 does not understand -jar when executing a java file and upgrading doesn't work.

I've been trying to get this to work in RHEL 4 all day:
http://kolmafia.sourceforge.net/scripting.html

After running up2date and after running the latest java runtime environment RPM as follows:

[root@plain /]# rpm -Uvh jre-1_5_0_06-linux-i586.rpm
Preparing...                ########################################### [100%]
        package jre-1.5.0_06-fcs is already installed

It still shows the older version! (below)

[root@plain kol]# java -version
java version "1.4.2"
gcj (GCC) 3.4.5 20051201 (Red Hat 3.4.5-2)

AND I continue to get this undesired result:
[root@plain kol]# java -jar -Duser.dir=~/kol ~/kol/KoLmafia-7.5.jar --CLI
Warning: -jar not understood. Ignoring.
/usr/bin/java: line 67: /tmp/javaK25549: Permission denied
/usr/bin/java: line 67: /tmp/javaK25549: Success

1. How does one update things to the latest version in RHEL 4
2. How does one get the -jar parameter to be recognized by java?

Any experienced input is helpful.

Thanks!
David
davidpestaAsked:
Who is Participating?
 
makhanConnect With a Mentor Commented:
ok.. here is what u should do now.

give the command below

which java

it will post the output from where the java executable is being picked up

we can do a symlink to this  for the new version.

regards

makhan
0
 
makhanCommented:
1. check out which is your default java installation

env | grep JAVA_HOME

if you do not find any such variable then check out your PATH

env | grep PATH

see if there is any java dir in this path

normally it should be in /usr/java/<your java version>

set the default path to the version you require by

PATH=$PATH:/usr/java/<your javar version>/bin

now give

java -version and check

you should see the desired version.

next  use the java command

java -jar </PATH/your jar file name>

hth

makhan

0
 
davidpestaAuthor Commented:
I think we're close.  Here is what I did:

[root@plain /]# env | grep JAVA_HOME

[root@plain /]# env | grep PATH
PATH=/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin

[root@plain /]# java -version
java version "1.4.2"
gcj (GCC) 3.4.5 20051201 (Red Hat 3.4.5-2)
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[root@plain /]# cd usr/java

[root@plain java]# ls
jre1.5.0_06

[root@plain java]# PATH=$PATH:/usr/java/jre1.5.0_06/bin

[root@plain java]# env | grep PATH
PATH=/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin:/usr/java/jre1.5.0_06/bin

[root@plain java]# java -version
java version "1.4.2"
gcj (GCC) 3.4.5 20051201 (Red Hat 3.4.5-2)
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

It still seems to be using the OLD java, even though I have the new java in the path.

Do I need to uninstall the old java?  If so, how?

Thanks!
David
0
 
davidpestaAuthor Commented:
Wonderful, works perfect now.
Here's what I did:

[root@plain bin]# rm /usr/bin/java
rm: remove symbolic link `/usr/bin/java'? y
[root@plain bin]# ln -s /usr/java/jre1.5.0_06/bin/java /usr/bin/java

This was very good for me to learn, thank you!

David
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.