Git Product home page Git Product logo

Comments (44)

Esgariot avatar Esgariot commented on May 16, 2024 6

Did someone manage to install java from source and run
"java -version "?
Unfortunately it just freezes in my case

from wsl.

zouyonghao avatar zouyonghao commented on May 16, 2024 6

I installed oracle JDK 1.7 successfully. Just download and extract it on windows, put it in your Linux folder, then will be OK.

capture

from wsl.

russalex avatar russalex commented on May 16, 2024 4

Thanks all. I was able to follow these instructions and get java up and running: http://xubuntugeek.blogspot.com/2012/09/how-to-install-oracle-jdk-7-manually-in.html.

To do this, I downloaded jdk-8u77-linux-x64.tar.gz to /mnt/c/temp and installed to /usr/lib/jvm/. Successfully ran a very simple HelloWorld app.

russ@RUSSALEX-DESK:/mnt/d/dev/samples/java$ java -version
java version "1.8.0_77"
Java(TM) SE Runtime Environment (build 1.8.0_77-b03)
Java HotSpot(TM) 64-Bit Server VM (build 25.77-b03, mixed mode)
russ@RUSSALEX-DESK:/mnt/d/dev/samples/java$ java HelloWorldApp
Hello World!
russ@RUSSALEX-DESK:/mnt/d/dev/samples/java$

That said, we obviously have a bug against the install. Writing that one now.

from wsl.

jznomoney avatar jznomoney commented on May 16, 2024 3

I myself have the same issue

from wsl.

carloshm avatar carloshm commented on May 16, 2024 3

I see openjdk failing but through ca-certificates-java package and it seems due not seeing /proc as a mountpoint.

root@localhost:/# mountpoint /proc
/proc is not a mountpoint

from wsl.

benhillis avatar benhillis commented on May 16, 2024 3

FYI: I've fixed the issue preventing default-jdk from installing (the java command requires a mounted proc fs (/proc)). The fix will be making its way to the Windows Insider fast ring in the next few weeks. Keep an eye out for our release notes.

from wsl.

russalex avatar russalex commented on May 16, 2024 3

This thread has forked a number of times. Let's do the following:

  • Closing this one as "fixed" since apt-get install jre/jdk default is working.

  • Let's use #196 for Gradle support

  • Oracle JDK SE is working following @rs6g10's instructions above but has issues installing from apt-get (instructions below). #315 is tracking that one.

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

from wsl.

mphaney avatar mphaney commented on May 16, 2024 2

I've had the same issue as well. After spending way too long messing around with dpkg, and manual installations, I THINK this issue is ultimately being caused by tar's inability to handle symlinks correctly right now (Issue #9), as other packages suffer similar problems as Java. I'm sure there's probably more too it than just that, though.

from wsl.

mphaney avatar mphaney commented on May 16, 2024 2

@amadib I just tried it on mine (Insider build 14342). java/javac 8u5 does seem to run alright, and I can compile and run the most basic Hello World program both as a bare class file AND as a jar file, but even so, Gradle does NOT work (tried versions 2.4, 2.5 and 2.12). Just hangs like newer versions of Java do. Really wish this ran, then I could actually start using Bash for my development :-)

from wsl.

benhillis avatar benhillis commented on May 16, 2024 1

Yep sure is. I think it's in our FAQ but I'm on my phone so I don't have a link. Do the following:

Lxrun.exe /uninstall /full

Then reinstall with Bash.exe

from wsl.

sunilmut avatar sunilmut commented on May 16, 2024 1

@seancorfield Here are the instructions if you are still looking for them. How do I fully uninstall WSL?

from wsl.

rs6g10 avatar rs6g10 commented on May 16, 2024 1

As per comment from @russalex , I managed to install it manually. Here are the steps for those who want a full walkthrough:

Installing Oracle JDK Java SE Development Kit 8 x64 bits

Download Oracle JDK

wget --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u5-b13/jdk-8u5-linux-x64.tar.gz

Then...

sudo su

The /opt directory is reserved for all the software and add-on packages that are not part of the default installation. Create a directory for your JDK installation:

mkdir /opt/jdk

and extract java into the /opt/jdk directory:

tar -zxf jdk-8u5-linux-x64.tar.gz -C /opt/jdk

Verify that the file has been extracted into the /opt/jdk directory.

ls /opt/jdk

## Setting Oracle JDK as the default JVM
In our case, the java executable is located under /opt/jdk/jdk1.8.0_05/bin/java . To set it as the default JVM in your machine run:

update-alternatives --install /usr/bin/java java /opt/jdk/jdk1.8.0_05/bin/java 100

and

update-alternatives --install /usr/bin/javac javac /opt/jdk/jdk1.8.0_05/bin/javac 100

Verify your installation
Verify that java has been successfully configured by running:

update-alternatives --display java

Output should look like this:

java - auto mode
link currently points to /opt/jdk/jdk1.8.0_05/bin/java
/opt/jdk/jdk1.8.0_05/bin/java - priority 100
Current 'best' version is '/opt/jdk/jdk1.8.0_05/bin/java'.

and then run this

update-alternatives --display javac

Output should look like this:

javac - auto mode
link currently points to /opt/jdk/jdk1.8.0_05/bin/javac
/opt/jdk/jdk1.8.0_05/bin/javac - priority 100
Current 'best' version is '/opt/jdk/jdk1.8.0_05/bin/javac'.

And Finally!

java -version

Output should look like this:

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)

image

from wsl.

russalex avatar russalex commented on May 16, 2024 1

Everyone should be able to run apt-get install default-jre on build 14352.

This build fixes quite a few issues. I have not tried Gradle but it's worth giving another shot.

from wsl.

wangweij avatar wangweij commented on May 16, 2024

I am seeing the same problem in installation, and I also noticed:

  1. This is not a symlink issue. ls -al inside /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/amd64/server/ shows the symlink is correctly created.
  2. I can run /usr/lib/jvm/java-7-openjdk-amd64/bin/javac directly (yes, I installed jdk) and the help screen shows up.
  3. However, running "/usr/lib/jvm/java-7-openjdk-amd64/bin/javac A.java" with a super-slim A.java hangs forever. Even Ctrl-C cannot kill it.

from wsl.

markgross avatar markgross commented on May 16, 2024

I get this issue as well while attempting to set up for building Android. http://source.android.com/source/initializing.html#setting-up-a-linux-build-environment

from wsl.

jznomoney avatar jznomoney commented on May 16, 2024

I tried manually installing java 7 from oracle mentioned on this page: http://xubuntugeek.blogspot.com/2012/09/how-to-install-oracle-jdk-7-manually-in.html
When I execute the command: sudo tar -zxvf jdk*.tar.gz -C /usr/lib/jvm/
I get this error:
tar: jdk1.7.0_80/jre/lib/amd64/server/libjsig.so: Cannot create symlink to ‘../libjsig.so’: Invalid argument
tar: Exiting with failure status due to previous errors

from wsl.

jl6257 avatar jl6257 commented on May 16, 2024

I have the same issue as well. I tried to install openjdk-7-jdk, and the default-jdk, but get the error at the end. I can actually navigate to /usr/lib/jvm/ and see all folders, and also I can set the JAVA_HOME to check the java version and javac version. I tried the same thing as wangweij and ran javac, which showed help. But, again, javac test.java hangs. (You can kill it by Ctrl+z however.) Test file was a hello world.

from wsl.

wangweij avatar wangweij commented on May 16, 2024

@Esgariot what does it mean install from source? compile?
@jznomoney this is a known problem #9, but you can manually recreated it.

from wsl.

nshanny avatar nshanny commented on May 16, 2024

Russ - are you running a later version of the linux subsystem or what has been released publicly? I cannot get java to run no matter what I do. It just hangs.

from wsl.

russalex avatar russalex commented on May 16, 2024

This test was a developer build. Can't give an ETA (simply because I don't have one to give) but fixes should be heading down the pipe soon.

from wsl.

seancorfield avatar seancorfield commented on May 16, 2024

@russalex Good to hear there are fixes coming. If, in trying to resolve various apt-get failures on various packages, we've gotten Ubuntu into a bit of a mess, is there an easy way to uninstall & reinstall it or reset it to the pristine version that Windows 10 first installs?

from wsl.

seancorfield avatar seancorfield commented on May 16, 2024

Thank you @sunilmut -- somehow I'd missed the FAQ completely.

from wsl.

russalex avatar russalex commented on May 16, 2024

Build 14328 is now public. You should be able to get Java working using the manual commands under a non-mnt/drive directory.

Release notes are here: https://msdn.microsoft.com/en-us/commandline/wsl/release_notes and contain a link to the instructions I followed to get Java up and going.

from wsl.

jl6257 avatar jl6257 commented on May 16, 2024

It is still not working for me on 14328. I reinstalled bash and tried again, but still no luck. It hangs at "java -version". I downloaded the jdk to c directory on windows, did the tar command to the /usr/lib/jvm/ from /mnt/c, then followed the instruction on the website.

from wsl.

markgross avatar markgross commented on May 16, 2024

Can you strace the Java -version execution? I wonder were it's hanging?
On Apr 23, 2016 12:24 AM, "jhl9092" [email protected] wrote:

It is still not working for me on 14328. I reinstalled bash and tried
again, but still no luck. It hangs at "java -version". I downloaded the jdk
to c directory on windows, did the tar command to the /usr/lib/jvm/ from
/mnt/c, then followed the instruction on the website.


You are receiving this because you commented.
Reply to this email directly or view it on GitHub
#49 (comment)

from wsl.

amadib avatar amadib commented on May 16, 2024

I saw issue yesterday and updated to 14328.rs1_release.160418-1609 and tried reinstalling this morning first following these instructions where it's spitting out a bunch of errors. http://www.pastebucket.com/313262

Running apt-get install default-jdk I get the following error http://www.pastebucket.com/313273

I then tried to use the instructions @russalex posted above and it hangs on java -version.
I ran strace java -version and here's the output: http://www.pastebucket.com/313261

from wsl.

cuzox avatar cuzox commented on May 16, 2024

After uninstalling wsl and following this:
https://www.digitalocean.com/community/tutorials/how-to-manually-install-oracle-java-on-a-debian-or-ubuntu-vps

with jdk 7 it worked. Mine would hang as well.

from wsl.

markgross avatar markgross commented on May 16, 2024

is the strace complete? the last line is not a full line:
"futex(0x7ff5ffe209d0, FUTEX_WAIT, 7295, NULL"

I would say futex's are buggy but, earlier in the trace shows a futex call
working.

Hmmm, the earlier call doesn't show a well functioning futext:
"futex(0x7ff5fffef690, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 1,
NULL, 7ff5ffeb0740) = -1 EAGAIN (Resource temporarily unavailable)"

I am wondering if the futext sys call is not well implemented and hangs or
maybe java is deadlocking on the second attempt at calling futext...

If there are any dev's following this thread can we get a report out of
what sys-calls are tested / thought to be working in windows/linux
subsystem? (I guess I can try to run part of the LTP to see a partial
list).

--mark

On Sat, Apr 23, 2016 at 1:27 PM, Caleb Viola [email protected]
wrote:

After uninstalling wsl and following this:

https://www.digitalocean.com/community/tutorials/how-to-manually-install-oracle-java-on-a-debian-or-ubuntu-vps

with jdk 7 it worked. Mine would hang as well.


You are receiving this because you commented.
Reply to this email directly or view it on GitHub
#49 (comment)

create interesting things.

from wsl.

amadib avatar amadib commented on May 16, 2024

I uninstalled and reinstalled wsl and followed @cuzox instructions only upping the version to 8u91 and still hangs when I run java -version
http://www.pastebucket.com/313830

from wsl.

ianvieira avatar ianvieira commented on May 16, 2024

I'm having the same problem that @amadib installing java (8u91) in the newest build (14328) following @russalex installation step-by-step. Here is the tracelog for java -version: http://www.pastebucket.com/313831

from wsl.

amadib avatar amadib commented on May 16, 2024

@ianvieira I installed java 7 not sure if it works yet...@cuzox can you try to run./gradlew and see if works for you? I'm having a crash now with that... opened #252

from wsl.

ianvieira avatar ianvieira commented on May 16, 2024

@amadib in fact the Java 7 works using @russalex installation. But I'm not sure if I can use Java 7 in my environment.

from wsl.

jl6257 avatar jl6257 commented on May 16, 2024

Here is my strace of java -version, with java8u91 installed with the instruction from @russalex : http://pastebucket.com/314592
I saw that futex was hanging, so I tried the strace with the -f option to trace the child, and it actually finished.. There's a SIGSEGV at the end, but I'm not sure the significance of this... but here it is: http://pastebucket.com/314613

from wsl.

seancorfield avatar seancorfield commented on May 16, 2024

I tried JDK 8u92 and reproduced the java -version hang. I tried JDK 7u79 and that seems to work fine.

from wsl.

markgross avatar markgross commented on May 16, 2024

Excellent :)
On Apr 29, 2016 3:17 PM, "Ben Hillis" [email protected] wrote:

FYI: I've fixed the issue preventing default-jdk from installing (the java
command requires a mounted proc fs (/proc)). The fix will be making its way
to the Windows Insider fast ring in the next few weeks. Keep an eye out for
our release notes.


You are receiving this because you commented.
Reply to this email directly or view it on GitHub
#49 (comment)

from wsl.

amadib avatar amadib commented on May 16, 2024

@rs6g10 does it work? can you run maven or gradle?

from wsl.

seancorfield avatar seancorfield commented on May 16, 2024

Confirmed: installed default-jre and default-jdk smoothly and I can now run Leiningen (Clojure build tool) for certain tasks, but not lein repl to produce an interactive REPL unfortunately, and Boot (the other main Clojure build tool) still hangs on every action. But this is definitely a big improvement -- thank you!

from wsl.

mphaney avatar mphaney commented on May 16, 2024

@russalex Indeed, apt-get install default-jdk works beautifully! This is a fantastic update and much smoother.

Gradle, unfortunately, still hangs :-/ Tried versions 2.4 up through 2.13 (the current version), all with the same behavior. I would be happy to run any command or provide any further feedback that might help. Thank you for everyone's extremely hard work!

from wsl.

mphaney avatar mphaney commented on May 16, 2024

Update: It's worth noting that I just tried sudo apt-get install gradle and it DID install without a hitch. gradle -v correctly displays the version (painfully old 1.4). Actually trying to use it on our project, however, just hangs like always. It's for the old-version reason that I would really love for newer versions of Java/Gradle from the developer's sites to correctly run.

from wsl.

seancorfield avatar seancorfield commented on May 16, 2024

@mphaney Since this issue is considered "fixed" as far as Java is concerned, maybe updating #196 and focusing on that for Gradle is worthwhile? I did the same thing for Leiningen / Boot (Clojure's build tools) in #277 (no response yet from @russalex et al -- hint, hint 😄 ).

from wsl.

dtracers avatar dtracers commented on May 16, 2024

I am installing open-jdk using these instructions
http://ubuntuhandbook.org/index.php/2015/01/install-openjdk-8-ubuntu-14-04-12-04-lts/

And it hanged updating alternatives:

update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/jexec to provide /usr/bin/jexec (jexec) in auto mode

(well I am going to let it sit to see if it ever times out or completes)

But it went much further than it has ever done before!

from wsl.

shuxin avatar shuxin commented on May 16, 2024

me too.
I think this bug may like that one https://bugzilla.kernel.org/show_bug.cgi?id=32922

from wsl.

jackchammons avatar jackchammons commented on May 16, 2024

Tracking Gradle errors in #851

from wsl.

Triamus avatar Triamus commented on May 16, 2024

@rs6g10 many thanks!! worked fine.

from wsl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.