Ask Your Question
1

Remove openjdk and install Oracle jdk

asked 2014-05-03 23:27:39 -0500

gabreeiel gravatar image

updated 2014-05-04 10:09:58 -0500

remjg gravatar image

Hello friends, I wonder how can I remove the openjdk that already comes with Fedora, and install the Oracle jdk. I wait for reply, thanks.

edit retag flag offensive close merge delete

Comments

hello, I wonder why you need to do this. Found any issue with openjdk?

tonioc gravatar imagetonioc ( 2014-05-05 06:24:50 -0500 )edit

Yes, I had some problems, specifically this problem: "Exception in thread "main" java.lang.UnsupportedClassVersionError: IMC : Unsupported major.minor version 52.0". When I run the program already compiled.

gabreeiel gravatar imagegabreeiel ( 2014-05-05 13:05:49 -0500 )edit

I've been using openjdk for years with no issue. I suppose you are trying to run on a JRE with lower release than the one used to compile. Are you trying to run code compiled on the same machine? To check the release of both JDK and JRE.

$ rpm -qa |grep openjdk $ javac -version $ java -version

tonioc gravatar imagetonioc ( 2014-05-05 13:21:33 -0500 )edit

Sorry I'm new to linux, and typed it appeared: [root@gabrielAcer5733 ~]# rpm -qa |grep openjdk java-1.7.0-openjdk-1.7.0.60-2.4.7.0.fc20.x86_64 java-1.7.0-openjdk-headless-1.7.0.60-2.4.7.0.fc20.x86_64 [root@gabrielAcer5733 ~]# javac -version bash: javac: Command not found... The command is similar: 'java' [root@gabrielAcer5733 ~]# java -version java version "1.7.0_55" OpenJDK Runtime Environment (fedora-2.4.7.0.fc20-x86_64 u55-b13) OpenJDK 64-Bit Server VM (build 24.51-b03, mixed mode)

gabreeiel gravatar imagegabreeiel ( 2014-05-05 14:51:07 -0500 )edit

Probably you need also 'java-1.7.0-openjdk-devel' for javac. (syntax $ sudo yum install java-1.7.0-openjdk-devel).

kdg1955 gravatar imagekdg1955 ( 2014-05-05 17:21:47 -0500 )edit

3 Answers

Sort by ยป oldest newest most voted
1

answered 2014-05-05 04:14:51 -0500

kdg1955 gravatar image

updated 2014-05-05 04:24:09 -0500

You 'll find a lot of dependencies that make your life difficult. To see a list of dependencies

$> rpm -e --test java-<java-version>-openjdk

You can removing the package by 'force', but not recommended. Or install both and use 'alternatives' (in /usr/sbin) to redirect java to Oracle JDK (ditto for javac, jar,...), see also 'man alternatives'. But every update of 'openjdk' will undo this. And again this is not my recommendation.

I suggest you install both and initialise the variable 'JAVA_HOME' for the applications that require Oracle JDK and launch java with $JAVA_HOME/bin/java (ditto for javac, jar, ...). I thus work with Java 8 (Oracle JDK) and Java 1.7 (OpenJDK). Another note: I downloaded the TAR package of Oracle SDK and not the rpm version. But maybe this works just as well.

edit flag offensive delete link more

Comments

Thanks, I had some problems with openjdk, I will try to install Oracle JDK by TAR

gabreeiel gravatar imagegabreeiel ( 2014-05-05 12:59:23 -0500 )edit
1

answered 2014-05-06 05:35:35 -0500

tonioc gravatar image

version 52 in the error message means the java code you try to run was created (compiled) with java 1.8. The default JRE in F20 is 1.7. You should either build the code with java 1.7, or install java 1.8 (you don't need to remove 1.7 for this):

yum install java-1.8.0-openjdk
edit flag offensive delete link more
0

answered 2014-05-06 10:19:08 -0500

gabreeiel gravatar image

Thanks for those who commented, all were useful. Got it solve the problem by changing the environment variables for openjdk 1.8.Thanks my friends.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2014-05-03 23:27:39 -0500

Seen: 22,627 times

Last updated: May 06 '14