question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Spaces in executable name causes the program to crash

See original GitHub issue

when 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:

https://github.com/raphw/byte-buddy/blame/11855e663f21dcc8a6b59dc0133007fd07bb11c0/byte-buddy-agent/src/main/java/net/bytebuddy/agent/ByteBuddyAgent.java#L717

https://github.com/raphw/byte-buddy/blob/11855e663f21dcc8a6b59dc0133007fd07bb11c0/byte-buddy-agent/src/main/java/net/bytebuddy/agent/ByteBuddyAgent.java#L659

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:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

10reactions
ayayron-onxcommented, Jun 9, 2021

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?

4reactions
raphwcommented, Nov 25, 2019

Sorry, this went under. I just fixed it on master. Thanks for reporting.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found