Skip to content

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

Open
@PetrMiksik

Description

@PetrMiksik

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

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Maven[ci] enable "build tools" testskind:bugBug report or fixneeds:triageRequires attention from one of the committerspending-responseAwaiting further information to be supplied

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions