How to install openJdk 8 in windows 64 bit os - java

I need to install open JDK in my Windows 64-bit os. I have used ORACLE open JDK and downloaded from the below link: https://jdk.java.net/8/
While downloading I have selected Accept License Agreement and installed.
But, after the installation when I tried checking the version using command java -version it's showing like regular JDK.
Can anyone help me to get where I went wrong? Or is there any better vendor to install open JDK in windows. Thanks.

Amazon offers an open jdk for Windows (and other OS), but just for Java 8, 11 and 16.
You can download it from here: https://aws.amazon.com/es/corretto/
After installing it and running the java -version command, you will see something like this:
>java -version
openjdk version "1.8.0_242"
OpenJDK Runtime Environment Corretto-8.242.08.1 (build 1.8.0_242-b08)
OpenJDK 64-Bit Server VM Corretto-8.242.08.1 (build 25.242-b08, mixed mode)

You need to set your java version in environment of you machine and target your JDK8 bin folder, or any JDK that you want to have at your disposal when you run java -version.

The best way to do this is to use the builds from adoptopenjdk. They're very high quality and come in multiple variants for Windows ranging from zip files to MSI installers. Dead simple to install JDK 8, 11 or 15.
But, after the installation when I tried checking the version using command java -version it's showing like regular JDK.
This is because JAVA_HOME is pointing to your old JDK. You need to go to Control Panel and change the Environment Variables. Just do a search on Windows 10 for "Environment Variables" to easily find that configuration panel.

Azul Systems provides builds of OpenJDK and relative installers, for all OSes and JDK versions.
It also provides builds of the JDK with OpenJFX included.
The installers bind JAR files to be executed by Java on Windows.
Download from azul.com website

I know this is old but should anyone run across this in search of OpenJDK 8 go here
https://developers.redhat.com/products/openjdk/download

Related

Installing Java OpenJDK with HomeBrew: why there are same versions of java on different locations?

Following the posts here and here, I had to have two different versions of Java/OpenJDK installed
brew install java
brew cask install java
now I have openjdk 13.0.2
openjdk 13.0.2 2020-01-14
OpenJDK Runtime Environment (build 13.0.2+8)
OpenJDK 64-Bit Server VM (build 13.0.2+8, mixed mode, sharing)
in two different locations
/usr/local/opt/openjdk/bin
/usr/local/opt/openjdk/libexec/openjdk.jdk/Contents/Home/bin/
and openjdk 14
openjdk 14 2020-03-17
OpenJDK Runtime Environment (build 14+36-1461)
OpenJDK 64-Bit Server VM (build 14+36-1461, mixed mode, sharing)
also in two different locations
/System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/
/Library/Java/JavaVirtualMachines/openjdk-14.jdk/Contents/Home/bin/
so my questions are
why there are two different locations for each installation of OpenJDK?
how to find out if there are more installations of JDK on my system? Ran sudo find / -name java which nuked my terminal (see log here).
How to know how those different versions of java are installed?
I understand that JDK is Java SDK and JRE (Java Runtime Environment) is an oracle thing which I think OpenJDK doesn't have (?) but looking at OpenJDK download page what are "JMC" and "Java SE"?!
what you are seeing is the way that a JDK works on macOS. but basically what you should know that we have two entities called JDK and JRE. JDK is a tool for java developers to compile and run their applications. JRE is a runtime for clients to run java applications. JDK is containing a JRE, so you don't need to install JRE when you have JDK.
A JDK is a folder that you can have based on your OS and copy paste it every where that you need and just add the bin folder to your PATH . so you might have lot of JDK folders but only the one that is added to your PATH is your current working JDK, and they are not working at the same time in one environment but you can have multiple Java versions on different user profiles.
what you have is one installation with its meta data and links all over the macOS.
you can have multiple JDK folders all around your hard disk but only one of them at the current time is working and that would be the one that you have in the user profile.
I don't know a way to find out how they are installed. you can query the tools like brew in your os to find out that if they installed any java or not but not from JDK itself.
JMC is java mission control which is a monitoring application for java application. JRE, as I said, is a runtime for running the applications and OpenJDK also includes a runtime in itself. JavaSE is the specification of Java for Standard edition since we have other editions too.

Different java versions on mac machine?

There is something going wrong with my java configuration and it is really bugging me. I am using IntelliJ IDEA and after downloading and installing java 8 I tried to configure my project to use that SDK but I could only locate version 1.6 under /Library/Java/JavaVirtualMachines/. I am new to OS X and I am really confused with the paths.
Looking on my Java control panel I can see I got installed Java 8 but after running java -version on the terminal I get 1.6.0_65.
And the which java gives back /usr/bin/java.
Please help I am completely lost
Here is an example with several Java versions installed side-by-side ...
ls /Library/Java/JavaVirtualMachines/
jdk1.7.0_25.jdk jdk1.7.0_72.jdk jdk1.8.0_05.jdk jdk1.8.0_25.jdk
User can edit ~/.profile to point explicitly at one
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_72.jdk/Contents/Home
export PATH=$JAVA_HOME/bin:$PATH
And here is result ...
java -version
java version "1.7.0_72"
Java(TM) SE Runtime Environment (build 1.7.0_72-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.72-b04, mixed mode)
Well something was wrong with the installation. I completely removed the other versions (not 1.6) and reinstalled 1.8 using the default path (as there is no option to change it during installation. Now IntelliJ can see JDK 1.8
Thanks for the help anyway

Eclipse in OS X uses different version of Java than CLI

When I type java -version in the console I get java version "1.8.0_05". The soft link /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK points to /Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents. In the java preferences window, the only listed version of Java is 1.8. JAVA_HOME is set to /Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home.
However, when I try to run Eclipse.app, I get the error: Version 1.6.0_65 of the JVM is not suitable for this product. Version: 1.7 or greater required.
I believe it is trying to use /System/Library/Java/JavaVirtualMachines and in that directory the only version is 1.6.0.jdk.
How can I get eclipse to use the correct version of Java?
I solved this issue in my mac with yosemite:
Installed JDK for MACOSX 64bits from https://jdk8.java.net/download.html
Inside the eclipse.ini I put this line:
-vm /Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home
And it worked for me!
Download the 64-bit version of Eclipse instead of the 32-bit version.
The reason is that Eclipse contains native machine code (for the GUI) which is why there is both a 32-bit and 64-bit version of Eclipse, and this explicitly require the corresponding Java version. Originally Apple created both versions up to Java 6, but Oracle only creates a 64-bit version (much to the dismay of owners of older machines). So, if you download a 32-bit version of Eclipse it will only run with an Apple JVM, which apparently is too old (which surprise me - I thought Java 6 was still supported for Eclipse 4.4)
I faced this same problem but rather than making it to use version 1.8 I changed the settings in eclipse.ini file so I can just run the program regardless which version of jvm does it want to use
Solution:
Open the directory where you have Eclipse copy in your computer.
You would see a file name eclipse press control key and click on it to see the options.
Then click on Show Originalfrom the options, there you would find eclipse.ini file open it with a text editor and change the -Dosgi.requiredJavaVersion=1.7 to -Dosgi.requiredJavaVersion=1.6
Save the file and open the ecplise.app it should open now without any error
Try adding the following lines to your eclipse.ini:
-vm
/Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home
Maybe a newer version of eclipse could help, too (if yours is out of date).
Take a look in your System Preferences -> Java. It should open the Java Control Panel. In the panel, check if you have one (or many) JDKs.
I suspect you have many and are setting the JDK in your .profile while Eclipse is reading some other Java Home.
You can change them manually by running this in your terminal
export JAVA_HOME=`/usr/libexec/java_home -v 1.8`
To check if it worked, run java -version and you should see something like
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)
Try calling Eclipse now from the command line. To call Eclipse as an App, just set the Java8 through the Java Control Panel. This will be read when Eclipse starts.
This is what I have on my Java Control Panel:
This is on my Eclipse Luna:
Download the 64-bit version of Eclipse.
This solved the problem. Thanks everyone.

Confusion about Java Versions

So I'm trying to get the latest version of Java. When I run:
java -version
I get:
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)
When I run:
javac -version
I get:
javac 1.6.0_65
Now I've just downloaded and installed JDK 8. When I go into System Preferences --> Java --> Update, I see:
Your system has the recommended vesion of Java.
Java 8 Update 05.
I guess I have a few questions:
1) Don't I want the JDK and my version of Java to match up?
2) Why does my Java Control Panel claim I have Java 8, but my work in the terminal (when checking my Java version) says otherwise?
Thanks for the help,
Mariogs
The probably "simple" answer is you have two versions of java installed. On the command line you currently use 1.6. Thus the old one is active. In system preferences you see the version of java 8.
Windows:
You can change the version of the command line to java 8. Set PATH environment variable and JAVA_HOME or via windows preferences. I recommend the first one.
Mac: /usr/libexec/java_home is the starting point for switching java versions on the command line. Check out this post to understand how to handle different java versions on the Mac. IMHO this answer is a good solution.
The Java Platform offers both the JRE and the JDK in order for users to run Java programs. The JRE stands for the Java Runtime Environment, and the JDK stands for the Java Development Kit.
The JDK is meant for Java developers - that is, those who build applications/write programs in Java. It contains tools that are needed for Java coding, including -javac to compile programs.
The JRE is meant for regular users - those who only need to run Java programs on their computer and are not interested in development.
The reason for the discrepancy in your case is because you're looking at the JRE and JDK and trying to compare the two. The current JDK that you have is Java 8, whereas the current JRE that you have is 1.6.0_65. It is problematic that your JRE version does not match your JDK version, but without your PATH variable or other information about your install, we can't help you fix your installation.
1) Yes, if you use the JDK at all, you want the JRE (runtime environment) to come from the JDK (development environment) (a JDK necessarily includes a JRE).
2) Likely your path variable is set so that you invoke Java from your Java 6 installation; you need to find the equivalent for your Java 8 installation and set the path for that. Without information about your operating system, we can't help you do that.
We should know the reason for this
Our OS comes with a predefined (built-in)set of tools and utilities. When we try to execute the command e.g. cls in the Windows command line then it is already present in system path variable and os will refer the corresponding binary of cls to execute the command.
However, when we install any third party tool/software then path variable is not updated accordingly.
When we install different versions of java on your system then installations go to different directories. E.g. JDK installation directory for Windows will be
C:\Program Files\Java\jdk1.8.0_161
Similarly, JRE installation directory for Windows will be JDK installation directory for Windows will be
C:\Program Files\Java\jre1.8.0_161
We need to update the path variable of OS to point to the appropriate directory. If we set the path of JDK then it will execute a binary from JDK bin directory.
Solution
we need to update JDK or JRE version specific directory location into PATH Environment variable.
Let me see if I can clear it up for you.
1)Yes, arguably you nearly want this to be true.
2)It could be few things, but most likely that a previous instillation was not properly removed. So one gets called instead of the other.

java + install only jdk1.6.0 + for WIN32 XP

from my PC I have the following
java -version
java version "1.6.0_05"
Java(TM) SE Runtime Environment (build 1.6.0_05-b13)
Java HotSpot(TM) Client VM (build 10.0-b19, mixed mode, sharing)
and under:
C:\Program Files\Java
I have only:
jre1.6.0_05
my question is that I need also directory jdk1.6.0
under C:\Program Files\Java
is it possible to install this java only for jdk1.6.0 and how?
From here download JDK and install on your pc.
Install the latest JDK from here.
Go to java.sun.com (or oracle.com now) and follow the download & installation instruction. In the title of your question you write you are using 32-bit WinXP - then you want this:
http://www.oracle.com/technetwork/java/javase/downloads/, select JDK, select Windows x86.
JDK is always coming with its own JRE. That does not mean you need to remove your JRE before installing JDK, you can keep it, if you wish.
btw 1.6.0_05 is quite old you should consider update.

Categories