Getting Java to work with Windows 10 Ubuntu

时间:2016-10-20 12:59:30

标签: java ubuntu windows-10

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.

2 个答案:

答案 0 :(得分:3)

我明白了。我无法直接从Oracle使用下载。相反,我必须按照this link安装它。以下是步骤:

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer

答案 1 :(得分:1)

我对Windows 10周年更新有相同的体验。周年纪念更新后的第一个Fast Track Insider Build,后来支持oracle Java 8安装程序和打开的JDK 7安装程序。我刚刚验证了java -version命令仍然可以在Ubuntu子系统的bash shell中使用Insider Preview Build 14951 161014-1700。我也从bash shell运行其他基于JVM的工具,但不是很广泛。

以下是问题Cannot install Oracle JDK 8 #315的链接,该问题描述了BashOnWindows项目跟踪的安装和JVM挂起问题。