Maven project - Quoted paths with spaces in VM options or application arguments
- Dominant language
- Java
- Stars
- 3.1k
- Forks
- 935
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 17
Description
### Apache NetBeans version
Apache NetBeans 23
### What happened
In Maven project, it's not possible to enter the path with spaces into VM options in Linux (not tested under Windows OS). I use javaagent with my application, the path to agent JAR file contains spaces, so I've enclosed it in quotation marks. The path was:
_/projects/java/Libraries/OpenJPA 4.0.0/openjpa-all-4.0.0.jar_
Generated command lines is as follows:
> cd /projects/java/DBTestMaven; JAVA_HOME=/usr/lib/jvm/java-21-openjdk-amd64 /usr/lib/apache-netbeans/java/maven/bin/mvn "-Dexec.vmArgs=-Dsun.java2d.opengl=true '-javaagent:'\\"'\\"'/projects/java/Libraries/OpenJPA 4.0.0/openjpa-all-4.0.0.jar'\\"'\\"''" ... <
And the error is:
>Error occurred during initialization of VM
agent library failed Agent_OnLoad: instrument
Error opening zip file or JAR manifest missing : '/projects/java/Libraries/OpenJPA 4.0.0/openjpa-all-4.0.0.jar'<
As you can see, quotation marks are interpreted as part of the path.
### Language / Project Type / NetBeans Component
Java Maven Project (Java application)
### How to reproduce
Create Maven project (Java application) and use quoted paths with spaces in VM options or arguments.

### Did this work correctly in an earlier version?
No / Don't know
### Operating System
Ubuntu 22.04
### JDK
JDK 21
### Apache NetBeans packaging
Apache NetBeans provided installer
### Anything else
_No response_
### Are you willing to submit a pull request?
No
Contributor guide
Research direction
Reproduce the Maven Java application launch using the quoted javaagent path shown in the issue, starting from the generated Maven command and the VM-options or application-arguments handling. No source file or test is named in the report; done means paths containing spaces are passed without quotation marks being treated as part of the JAR path.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- developer-experience, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100