apache / apache/netbeans

Maven project - Quoted paths with spaces in VM options or application arguments

Open
#7,858 5 comments 0 reactions 0 assignees View on GitHub
kind:bug Maven needs:triage pending-response
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.

![image](https://github.com/user-attachments/assets/5fb19925-03aa-4e12-8454-82f0b44fa83a)

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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.