Spaces in executable name causes the program to crash
See original GitHub issuewhen running mockito (and bytebuddy) in IntelliJ, the test run crashes since the java executable has spaces in the path. The problem anyhow is not spaces, but quoting paths that has spaces. Spaced paths should not be quoted. This fails when running the program.
problematic lines:
Minimal repro of quotes in file name:
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
public class Hello {
public static void main(String []args) throws IOException {
try {
List<String> list = new ArrayList<String>();
list.add("\"/Applications/IntelliJ IDEA 2019.3 EAP.app/Contents/jbr/Contents/Home/bin/java\"");
ProcessBuilder builder = new ProcessBuilder(list);
builder.start();
System.out.println("finished");
} catch (Exception e) {
System.out.println(e);
}
}
}
If I take quotes off, the program runs fine. I believe this might have been a breaking change in some Java version. I’m running java 12.0.1 and IntelliJ is running Java 11.0.4+12-b462.3 on macOS.
Related issue for IntelliJ: https://youtrack.jetbrains.com/issue/IDEA-222903
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:11 (4 by maintainers)
Top Results From Across the Web
java - How to deal with a directory that has a space in it being ...
I am working on an issue where spaces in a directory cause a program that runs exp.exe to crash. The user first selects...
Read more >Command Line will not accept file names that include spaces
When I attempt to use the CMD (Command Line) window it opens no problem however; when I attempt to enter a file name...
Read more >I'm “still afraid to use spaces in file names” years old
I work on a complex desktop application, and it's been astounding the number of bugs that have appeared over the years triggered by...
Read more >How to call a program that contains space in filename?
This answer is only a partial solution: It will work if there are spaces in the path but it will not work if...
Read more >Investigating memory access crashes - Apple Developer
You may have other crash reports that show a memory access issue with a different exception subtype, which are likely caused by the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Ran into this issue in Android Studio running on MacOS 11.4
Renaming Android Studio.app to AndroidStudio.app made the bug go away. Any chance we can get a fix for that?
Sorry, this went under. I just fixed it on master. Thanks for reporting.