?
Solved

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

Posted on 2006-05-15
4
Medium Priority
?
273 Views
Last Modified: 2013-12-16
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
0
Comment
Question by:davidpesta
  • 2
  • 2
4 Comments
 
LVL 6

Expert Comment

by:makhan
ID: 16688391
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
 

Author Comment

by:davidpesta
ID: 16692023
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
 
LVL 6

Accepted Solution

by:
makhan earned 2000 total points
ID: 16696996
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
 

Author Comment

by:davidpesta
ID: 16699812
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

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Suggested Courses
Course of the Month13 days, 20 hours left to enroll

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question