why java version not updated on mac machine? - java

I checked my java version from terminal .I got this information
Last login: Sun Mar 15 08:46:08 on ttys000
localhost:~ naveenkumar$ java -version
java version "1.7.0_10"
Java(TM) SE Runtime Environment (build 1.7.0_10-b18)
Java HotSpot(TM) 64-Bit Server VM (build 23.6-b04, mixed mode)
localhost:~ naveenkumar$
I install new java 1.8 JRE .close my terminal .Agan i type java -version .I found the same version .
why ? how to upgrade java version.

You installed Java 8 but it didn't overwrite this: /usr/bin/java
The easiest way for you to solve this problem is to install Java 8 JDK, not JRE. After install JDK, your path should be automatically updated.

Related

How to change the default version of java by command line in Manjaro?

I use Manjaro operating system
I have installed OpenJDK version 11 and 18 (version 11 is installed first) and when I type java --version command in terminal it shows version 11.
java --version
openjdk 11.0.15 2022-04-19
OpenJDK Runtime Environment (build 11.0.15+3)
OpenJDK 64-Bit Server VM (build 11.0.15+3, mixed mode)
How should I change the default Java version?
Is it possible to install update-alternatives on Manjaro?
in archlinux based distros you could use archlinux-java instead of update-alternatives.
use archlinux-java status to view the list of installed java versions and default one; then use archlinux-java set <JAVA_ENV>.

What version of Java is "1.8.0_191" on my Ubuntu install?

On of our (remote) developers needs to install FDT (an Eclipse based IDE) to compile some legacy ActionScript code. I've got FDT working on my Ubuntu 18.04 laptop just fine, but the dev is having trouble getting it to work on his Mac. When he has Java version 7, 8 or 9 installed he gets a message saying
we need legacy java you can download it here...
and if he uses Java version 6, it says it needs version 7 or more.
So I checked which version I have on my Ubuntu 18.04 laptop so he can get the same one, and to my surprise it says:
$ java -version
java version "1.8.0_191"
Java(TM) SE Runtime Environment (build 1.8.0_191-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.191-b12, mixed mode)
As far as I know Java is WAY ahead of version 1.8. So I logged into our production server (Ubuntu 16.04) and there we've got something similar:
$ java -version
openjdk version "1.8.0_191"
OpenJDK Runtime Environment (build 1.8.0_191-8u191-b12-0ubuntu0.16.04.1-b12)
OpenJDK 64-Bit Server VM (build 25.191-b12, mixed mode)
I checked out the OpenJDK website and there it says OpenJDK is now at version 11.
What version of Java my laptop is actually running so our dev can get the same version?
You are using Java 8.
The Mac problem is a historic one because the legacy question is for a 32-bit JVM for some programs and you need a 64-bit for Java 8.
Install the Java 6 the programs want and then install A newer java from oracle and he should be good to go.

Cant run eclipse on my Mac

I installed the latest version of Java and when I try to run eclipse it says:
Version 1.6.0_65 of the JVM is not suitable for this product. Version: 1.8 or greater is required.
I searched many forums and found the java -version command. When I run from the terminal I get:
java version "1.6.0_65" Java(TM) SE Runtime Environment (build
1.6.0_65-b14-466.1-11M4716) Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-466.1, mixed mode)
But when I open Java on my system preferences it says I have 1.8.
Why? What do I do?
It says 1.6 because it is the pre-installed version in your system. But in order to install different version of Java, you need to install the latest development kit from Oracle's website i.e. http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

Using Kubuntu, Cant set up Java 8 in eclipse

In Eclipse I do not have option java 8 in new project and java -version
java version "1.8.0_05"
Java(TM) SE Runtime Environment (build 1.8.0_05-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.5-b02, mixed mode)
says I have 8 installed. I am running Kubuntu 14.04 and installed java 8 through the repositories.
Here is the snaphot that show that I cannot compile in java 8 ... :
Eclipse doesn't have built-in support for J8. We have to wait until Luna comes next month.
However you can install it by marketplace.
Hope to help

Multiple Java installations in Mac OS X Mavericks

I downloaded JDK for Mac OS X 10.9.1 from Oracle, but I had to install another Java from Apple site once more, as I couldn't launch eclipse with it.
These are two pages that I referred.
Installing Java on OS X 10.9 (Mavericks)
http://support.apple.com/kb/DL1572?viewlocale=en_US
Now I have three java binaries installed in my computer.
Installation A
/System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)
Installation B
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode)
Installation C
/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/bin/java
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)
I found that I can easily remove Installation C, however I'm not sure if this is OK.
When I invoked java from command line, it points to Installation A.
java -version
java version "1.7.0_51"
ls -alF `which java`
lrwxr-xr-x 1 root wheel 74 Jan 15 09:12 /usr/bin/java# -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java
Is there any way to use just one JDK 1.7 for Mavericks by removing two of them safely?
EDIT
After some setup and test, I have only one Java (1.6) installed.
I have Installation B, and now Installation C is linked to Installation A.
For using eclipse, I had to make Compiler Compliance level to 1.6 to use it (from the help java.lang.UnsupportedClassVersionError Unsupported major.minor version 51.0).
EDIT2
This seems to what happened.
Installation of Apple Java
Installation A
Installation B is a symbolic link to A
Installation of Oracle Java
Installation C
Changed the Installation B that
Created a /System/Library/Frameworks/JavaVM.framework/Versions/A
Copied files from Installation C (not symbolic link)
Make a symlink Current to Versions/A
I tried to install Oracle Java only by removing Apple Java, but I got installation error, so I guess Apple Java is needed to install Oracle Java.
Specify the JVM for Eclipse
You can specify JDK version for usage with Eclipse in eclipse.ini. This will resolve problem with starting Eclipse.
-vm
/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/bin/java
Warning: Add this configuration before -vmargs.
Master your Java Environnement with jenv
It is much easier to maintain multiple JDK versions with jenv.
jenv is for a equivalent of rbenv, but for Java environnement. It allow to easily switch between several JDKs installations (already presents), and configure which one to use per project.
Eclipse JDK
Setting JDK in Eclipse
It seems like that the oracle JDK can be just removed. For eclipse, I could add Installation A as a default JRE from Java Build Path -> JRE System Library -> Installed JRES -> Add ...

Categories