LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Fedora (https://www.linuxquestions.org/questions/fedora-35/)
-   -   $20 for a working JAVA!!!! (https://www.linuxquestions.org/questions/fedora-35/%2420-for-a-working-java-558899/)

Ordinary12 06-03-2007 05:33 PM

$20 for a working JAVA!!!!
 
I followed the following directions exactly, with a few modifications for the newer version of Java but I still couldn't get it to work. Can someone please tell me what I'm doing wring?

OK, here you go...........



Reconfiguring the default Java configuration for Red Hat / Fedora



This is done as root or equivalent.



First remove /var/lib/alternatives/java file by typing;



rm /var/lib/alternatives/java



When asked press the 'y' key,



Now to create the new (corrected) alternatives file for java type

the following commands as root;



/usr/sbin/alternatives --install /usr/bin/java java /usr/lib/jvm/jre-1.4.2-gcj/bin/java 1



For jre:



/usr/sbin/alternatives --install /usr/bin/java java /usr/java/jre1.6.0/bin/java 2



For jdk:



/usr/sbin/alternatives --install /usr/bin/java java /usr/java/jdk1.6.0_01/jre/bin/java 2



/usr/sbin/alternatives --config java



You should now see for example:



There are 2 programs which provide 'java'.



Selection Command

-----------------------------------------------

1 /usr/lib/jvm/jre-1.4.2-gcj/bin/java

*+ 2 /usr/java/jre1.6.0/bin/java



Enter to keep the current selection[+], or type selection number:



Type: <choose 1 or 2>



In the example above java is already configured correctly [*+ 2] to

use Sun's Java, no changes are needed, just press the Enter key here.

If you have been following the instructions then you should have

the same results (version numbers may be sightly different).



Now type; /usr/sbin/alternatives --display java



You should see for example;



java - status is manual.

link currently points to /usr/java/jre1.6.0/bin/java

/usr/lib/jvm/jre-1.4.2-gcj/bin/java - priority 1

/usr/java/jre1.6.0/bin/java - priority 2

Current `best' version is /usr/java/jre1.6.0/bin/java.



Next you might want to create (or edit) /etc/profile.d/java.sh

file, examples below:



For jre;



export JAVA_HOME="/usr/java/jre1.6.0/bin"

export JAVA_PATH="$JAVA_HOME"

export PATH="$PATH:$JAVA_HOME"



For jdk;



export JAVA_HOME="/usr/java/jdk1.6.0_01/jre/bin"

export JAVA_PATH="$JAVA_HOME"

export PATH="$PATH:$JAVA_HOME"





When done creating or editing the file type;



source /etc/profile.d/java.sh



Now any user root or other wise should be able to use the command;



which java



and the results should read something like;



/usr/bin/java



Also any user root or other wize should be able to use the command;



java -version



and the results should read something like;



java version "1.6.0"

Java(TM) SE Runtime Environment (build 1.6.0-b105)

Java HotSpot(TM) Client VM (build 1.6.0-b105, mixed mode, sharing)



That's it, all done.



See not that hard to change.

This is my Java file.

export JAVA_HOME="/usr/java/jdk1.6.0_01/jre/bin"

export JAVA_PATH="$JAVA_HOME"

export PATH="$PATH:$JAVA_HOME"


export JAVA_HOME="/usr/java/jre1.6.0/bin"

export JAVA_PATH="$JAVA_HOME"

export PATH="$PATH:$JAVA_HOME"

puntjuh 06-03-2007 06:51 PM

Might i suggest just downloading the one from the sun site, and install the RPM ? Or the .src.bin .. and install it that way, this way is long, and probably unneeded.

HERE

jay73 06-04-2007 01:40 AM

Quote:

First remove /var/lib/alternatives/java
I never had to do this - it works fine, though.

Quote:

/usr/sbin/alternatives --install /usr/bin/java java /usr/lib/jvm/jre-1.4.2-gcj/bin/java 1
I didn't have to do this either - the system was already set up to have this one.

Quote:

/usr/sbin/alternatives --install /usr/bin/java java /usr/java/jdk1.6.0_01/jre/bin/java 2
This assumes that your java is in the /usr/java directory - that is correct only if you used the java.rpm.bin - if you used the java.bin instead (which you need to extract and move around yourself), it is not unless you explicityly placed the extracted folder it under /usr/java.

Quote:

export JAVA_HOME="/usr/java/jre1.6.0/bin"
Why did you set JAVA_HOME twice? I'm sure this is awfully confusing to the system.

Ordinary12 06-04-2007 08:31 AM

The only reason I did it this way was because this was the only information I was able to find on the internet. I actually downloaded the RPM version and installed it but after I did it I followed the instructions again because that's what someone told me to do. Do I need to delete everything I did and start over or can I just download the RPM again and install it? I tried to re-install the RPM yesterday but Fedora told me there was nothing to do. I really don't want to re-install Fedora again because of this.

jay73 06-04-2007 10:15 AM

It shouldn't matter, you can simply keep your own version instead of getting rpm.bin - the main thing is you make sure that your JAVA_HOME is pointing to the exact location of your java folder. Where did you place it? That's where it should point to.

I also noticed you were using it like JAVA_HOME=/.../.../jdk/bin - which is wrong: the /bin part needs to be dropped. The only place you would actually add the "/bin" part is in the update-alternatives" commands.

hollywoodb 06-04-2007 10:23 AM

I've always followed the instructions at http://fedorasolved.org and have never had an issue.

Ordinary12 06-12-2007 07:28 PM

Hey Jay73:

I followed your directions and made sure that the Java.sh file was pointing to the right directory. It still doesn't work. I followed the directions on www.fedorasolved.org. It still didn't work. I believe this problem is something simple but I can't seem to get enough information out there for someone to help me so I've decided to ask for help over the phone. If anyone is willing to talk me through this I will reimburse them for the call. It's a temp phone I bought so it won't work after two or three day. 662-523-5678.


All times are GMT -5. The time now is 09:05 PM.