Getting Java to work with Windows 10 Ubuntu

天大地大妈咪最大 提交于 2019-12-23 10:14:45

问题


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.


回答1:


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



回答2:


I had the same experience with the Windows 10 Anniversary Update. The first Fast Track Insider Build after the Anniversary Update and later support both the oracle Java 8 installer and the open JDK 7 installer. I just verified the java -version command still works on Insider Preview Build 14951 161014-1700 from the Ubuntu subsystem's bash shell. I have run other JVM based tools from bash shell as well but not extensively.

Here is a link to an issue, Cannot install Oracle JDK 8 #315, describing both installation and JVM hang issues tracked by the BashOnWindows project.



来源:https://stackoverflow.com/questions/40155174/getting-java-to-work-with-windows-10-ubuntu

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!