LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how do I set the java version to the version that I've just installed(Jdk) (http://www.linuxquestions.org/questions/linux-newbie-8/how-do-i-set-the-java-version-to-the-version-that-ive-just-installed-jdk-890743/)

iansu 07-09-2011 05:09 AM

how to set the java version to the version that I want?
 
jdk-6u26-linux-i586-rpm.bin
It is the version that I 've installed.
---------------------------------------------------------------------
It still shows this :
java -version
java version "1.4.2"
gij (GNU libgcj) version 4.1.2 20070626 (Red Hat 4.1.2-14)

Copyright (C) 2006 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.
----------------------------------------------------------------------
How can I set my jdk version to the version that I want?
Thanks!

iansu 07-09-2011 05:34 AM

how do I set the java version to the version that I've just installed(Jdk)
 
I've just installed this jdk version : jdk-1.6.0_26-fcs
=================================================================
When I see the java version,it still shows the below version 1.4
java -version
java version "1.4.2"
gij (GNU libgcj) version 4.1.2 20070626 (Red Hat 4.1.2-14)

Copyright (C) 2006 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.
===================================================================
How can I change the java version to the version that I've just intalled(jdk1.6).Thank you very much.I am just a beginner linux.
===================================================================
Then I decided to reinstall and the result and status are like that :

[root@localhost 32]# chmod a+x jdk-6u26-linux-i586-rpm.bin
[root@localhost 32]# ls -l
total 78868
-rwxr-xr-x 1 root root 80669688 Jul 9 21:41 jdk-6u26-linux-i586-rpm.bin
[root@localhost 32]# ./jdk-6u26-linux-i586-rpm.bin
Unpacking...
Checksumming...
Extracting...
UnZipSFX 5.50 of 17 February 2002, by Info-ZIP (Zip-Bugs@lists.wku.edu).
inflating: jdk-6u26-linux-i586.rpm
inflating: sun-javadb-common-10.6.2-1.1.i386.rpm
inflating: sun-javadb-core-10.6.2-1.1.i386.rpm
inflating: sun-javadb-client-10.6.2-1.1.i386.rpm
inflating: sun-javadb-demo-10.6.2-1.1.i386.rpm
inflating: sun-javadb-docs-10.6.2-1.1.i386.rpm
inflating: sun-javadb-javadoc-10.6.2-1.1.i386.rpm
Preparing... ########################################### [100%]
1:jdk ########################################### [100%]
Unpacking JAR files...
rt.jar...
jsse.jar...
charsets.jar...
tools.jar...
localedata.jar...
plugin.jar...
javaws.jar...
deploy.jar...

Java(TM) SE Development Kit 6 successfully installed.

Product Registration is FREE and includes many benefits:
* Notification of new versions, patches, and updates
* Special offers on Oracle products, services and training
* Access to early releases and documentation

Product and system data will be collected. If your configuration
supports a browser, the JDK Product Registration form will
be presented. If you do not register, none of this information
will be saved. You may also register your JDK later by
opening the register.html file (located in the JDK installation
directory) in a browser.

For more information on what data Registration collects and
how it is managed and used, see:
http://java.sun.com/javase/registrat...onPrivacy.html

Press Enter to continue.....






[root@localhost 32]# java -version
java version "1.4.2"
gij (GNU libgcj) version 4.1.2 20070626 (Red Hat 4.1.2-14)

Copyright (C) 2006 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.
====================================================================
My java version shows still 1.4 how do i change to 1.6(That i just installed)?

knudfl 07-09-2011 07:26 AM

1) su

2)
/usr/sbin/alternatives --install /usr/bin/java java /usr/java/jdk1.6.0_26/bin/java 2

3) /usr/sbin/alternatives --config java
.... And then select the new "sun java".

.

Thor_2.0 07-09-2011 07:28 AM

Quote:

jdk-1.6.0_26-fcs
A clue? Are you using Fedora? If so, try galternatives. Yum-install it if need be. track the JDK. In the entry, the newly installed version should be available, check mark it, give it a high ranking and, if needed, delete the entry of the old version.

That should do...

Luck

Thor

Thor_2.0 07-09-2011 12:24 PM

Hi,

Use galternatives, after install of the other JVM, navigate to the item in question, add your alternative and rate it as high as possible.

You may possibly want do delete the other one, it will not delete the JVM, just the choice the system has...

Luck

Thor

Tinkster 07-09-2011 04:58 PM

Merged the two VERY closely related threads.

Thor_2.0 07-09-2011 05:03 PM

@ Tinkster
Wow! I have just (almost) been wetting myself :D thinking I messed answers up! Thanks!


All times are GMT -5. The time now is 10:38 AM.