netbeans icon indicating copy to clipboard operation
netbeans copied to clipboard

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

Open PetrMiksik opened this issue 1 year ago • 0 comments

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

PetrMiksik avatar Oct 09 '24 13:10 PetrMiksik