When trying to use the Linux version of Oracle\'s JDK on the latest Windows 10 build having support for bash, I am running into a problem with the prompt hanging whenever at
I'm confirming here that Oracle JDK Version 8u102, x64 for linux is installable ok on Windows 10 Insider Build 14905, released on 16th August 2016.
Downloadable from here after accepting license
C:\>systeminfo | findstr /B /C:"OS Name" /C:"OS Version"
OS Name: Microsoft Windows 10 Pro Insider Preview
OS Version: 10.0.14905 N/A Build 14905
I followed the instructions here: wikiHow Oracle Java Install
$ java -version
java version "1.8.0_102"
Java(TM) SE Runtime Environment (build 1.8.0_102-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.102-b14, mixed mode)
$ javac -version
javac 1.8.0_102
I've not yet had a chance to really stress this install, but this is better than the previous hangs.
It seems that the problem occured with java oracle version, I have download the openJDK version and now it work
Seems installing JDK8 is not working at the moment on Build#14316 of WSL. But trying to install JDK7 worked fine for me. Exploring the limits of this installation at the moment and will keep posted. Idea came from here : https://github.com/Microsoft/BashOnWindows/issues/196
A lot of answers are recommending installing the Linux JDK even though they have a perfectly good Windows JDK. The beauty of WSL is preventing you from having to do things like this, as the file systems are interoperable. As long as you take the file extensions into account (outlined below), you would only have to install both for niche situations.
You can do this very simply by adding the following line of code to your .bashrc
file, assuming that your Windows Environment variables are set correctly and WSL is installed:
# Shared environment variables
export JAVA_HOME=/mnt/d/Java/jdk11.0.4_10
Just ensure that you change the directory to point to your JDK folder. In my case, it's in D:\Java\jdk11.0.4_10
which in WSL is /mnt/d/Java/jdk11.0.4_10
Also, since you're using Windows binaries, you must specify the file type when running from a WSL bash shell:
Calling Windows JDK from:
CMD
:
javac MyClass.java
java MyClass
WSL:
javac.exe MyClass.java
java.exe MyClass
Note WSL requires .exe
since it is a Windows binary. When using the Linux distro of the OpenJDK, no extension is required..
I had the same problem but I solve it with one command:
sudo apt upgrade
then run these 3 commands:
sudo apt install default-jre
sudo apt install openjdk-11-jre-headless
sudo apt install openjdk-8-jre-headless
I must be missing something... all I did was:
sudo apt-get update
sudo apt-get install default-jdk
java -version
output:
java version "1.7.0_131"
OpenJDK Runtime Environment (IcedTea 2.6.9) (7u131-2.6.9-0ubuntu0.14.04.2)
OpenJDK 64-Bit Server VM (build 24.131-b00, mixed mode)