LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   i'm lost with Java home (https://www.linuxquestions.org/questions/linux-software-2/im-lost-with-java-home-432232/)

paul_mat 04-06-2006 04:53 AM

i'm lost with Java home
 
hi there, i'm trying to install a program with java ... i think

i'm running centOS and i have install java by yum

yum install java*

i'm pretty sure i have java this is what i get wheni run locate.

[root@centos html]# locate bin/java
/usr/sbin/javaconfig
/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre/bin/java
/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/bin/javadoc
/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/bin/java
/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/bin/javah
/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/bin/javac
/usr/bin/javadoc
/usr/bin/java
/usr/bin/javah
/usr/bin/javac

this is the command the readme tells me to run

[root@centos html]# java -jar VirusHammer.jar
Warning: -jar not understood. Ignoring.
Exception in thread "main" java.lang.NoClassDefFoundError: VirusHammer.jar
at gnu.gcj.runtime.FirstThread.run() (/usr/lib/libgcj.so.5.0.0)
at _Jv_ThreadRun(java.lang.Thread) (/usr/lib/libgcj.so.5.0.0)
at _Jv_RunMain(java.lang.Class, byte const, int, byte const, boolean) (/usr/lib/libgcj.so.5.0.0)
at __gcj_personality_v0 (/var/www/html/java.version=1.4.2)
at __libc_start_main (/lib/tls/libc-2.3.4.so)
at _Jv_RegisterClasses (/var/www/html/java.version=1.4.2)

this is what i get when I run which java

[root@centos html]# which java
/usr/bin/java

i'm run the following commands in the hope that it will fix it

[root@centos html]# export JAVA_HOME=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre/bin/java
[root@centos html]# echo $JAVA_HOME
/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre/bin/java

Still nothing, help me please ...

timmeke 04-06-2006 05:14 AM

Try executing:
Code:

java -?
to see what options your java program supports.

Also, $JAVA_HOME shouldn't point to the "java" program, but rather to the directory where you installed
the Java JDK or JRE.
In your case, set it as follows:
export JAVA_HOME=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre/.

timmeke 04-06-2006 05:18 AM

JAVA_HOME needs to point to a directory where you installed Java JDK or JRE, not to the "java" program.
So, $JAVA_HOME/bin/java is the location of the java program.

In other words, do:
Code:

export JAVA_HOME=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre/
if you only installed the jre.
Or
Code:

export JAVA_HOME=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/
if you have the full JDK.

Also, run
Code:

java -?
to get a list of options for "java" and see if there's a "-jar" option.

And finally, as "which java" indicates, the /usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre/bin/java isn't used, but
/usr/bin/java instead.
Can you do an "ls -l /usr/bin/java " to see if it's a symbolic link to another program?

paul_mat 04-06-2006 05:37 AM

okay timmeke thanks all that information is very helpful.

using the command ls -l /usr/bin/java i found out that it is a like to the alternatives configuration and i've already set alternatives --config java.

i ran the command

Quote:

export JAVA_HOME=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre/
and tried to isntall my program

and

Quote:

export JAVA_HOME=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/
and tried to install it again

but each time i got the same error message

timmeke 04-06-2006 09:05 AM

http://www.centos.org/modules/newbb/...=2475&forum=28
seems to deal with your problem.


All times are GMT -5. The time now is 12:57 AM.