Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting Java to work with Windows 10 Ubuntu

Tags:

I installed the Windows 10 Anniversary Update so that I could try Bash on Ubuntu on Windows. See how to install it. I wanted to see how performant it was. I then installed the Oracle Java JDK as per this article, so I could compare compilation times with the native Windows Java compiler.

I then tried to run Maven on my project, but it didn't work. Maven just hung starting. I noticed in Task Manager that the "java" process was hovering around 92% CPU.

So I tried something simple. I created a dummy Java Hello-world-like class and attempted to compile it with javac. Similarly, the "javac" process sat around 92% CPU.

I thought maybe it had something to do with running headless, but the -Djava.awt.headless=trueoption didn't make it any better.

Has anyone got this to work or have anything to try?

Update:

I also tried installing the Open JDK instead of the Oracle JDK (via sudo apt-get install openjdk-7-jdk) with the same result.

like image 526
tom Avatar asked Oct 20 '16 12:10

tom


People also ask

Is Java compatible with Ubuntu?

Ubuntu offers the default-jre package, which is regularly updated to ship the latest version of the current OpenJDK JRE in Long Term Support (LTS). The default-jre is an excellent choice for most situations, thanks to the outstanding track of backwards compatibility of the Java Virtual Machine.

Can WSL use Windows Java?

However, it is possible to either install and use Oracle JDK for Windows installation from WSL, or install OpenJDK Java into your WSL world from the Ubuntu package manager.


1 Answers

I figured it out. I couldn't use the download directly from Oracle. Instead I had to install it as per this link. Here are the steps:

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer
like image 168
tom Avatar answered Sep 25 '22 16:09

tom