Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to make java Runtime.getRuntime().exec to work properly in WLS? #1422

Closed
metorm opened this issue Nov 27, 2016 · 3 comments
Closed

Comments

@metorm
Copy link

metorm commented Nov 27, 2016

I managed to run xfce4 properly on WLS, i.e. bash on windows 10. Everything was find until I tried to run Pycharm/liclipse on it.

The GUI loaded normally, but both IDE failed to run python executable. The error message says

java.io.IOException: error=12, Cannot allocate memory

I spent some time on the maximum allowed memory of JVM, but it turned out that the problem was caused by WLS, it seems that WLS doesn't take fork() call properly.

Here is the test code:

import java.io.IOException;

public class prova {

    public static void main(String[] args) throws IOException {
                Runtime.getRuntime().exec("ls");

    }
}

This code has only one line, but when I tried to run it, I got below error message:

Exception in thread "main" java.io.IOException: Cannot run program "ls": error=12, 无法分配内存
	at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
	at java.lang.Runtime.exec(Runtime.java:620)
	at java.lang.Runtime.exec(Runtime.java:450)
	at java.lang.Runtime.exec(Runtime.java:347)
	at prova.main(prova.java:6)
Caused by: java.io.IOException: error=12, 无法分配内存
	at java.lang.UNIXProcess.forkAndExec(Native Method)
	at java.lang.UNIXProcess.<init>(UNIXProcess.java:247)
	at java.lang.ProcessImpl.start(ProcessImpl.java:134)
	at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
	... 4 more

Obviously, java will not be able to load any native executable.

Is there any way to do with this?

@metorm metorm changed the title Is it possible to make java Runtime.getRuntime().exec to work properly in WLS (bash on windows) ? Is it possible to make java Runtime.getRuntime().exec to work properly in WLS? Nov 27, 2016
@aseering
Copy link
Contributor

Hi @metorm -- I assume you're referring to "WSL" ("Windows Subsystem for Linux")? This sounds similar to #1403 . Could you try the workaround on that ticket?; does it help you?

@metorm
Copy link
Author

metorm commented Nov 28, 2016

Thanke you @aseering . I have read #[1403].

My RAM is 8G, and pagefile was managed by the system before. I fixed the pagefile as 8G and it solved my problem.

However, Now I only have less than 10G in my SSD. I wish some one can solve this completely.

@scooley
Copy link
Contributor

scooley commented May 22, 2018

Closing as a duplicate of another issue (which has been fixed :)) #1403

@scooley scooley closed this as completed May 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants