This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 271059 - Error "The syntax of the command is incorrect." when profiling Java class.
Summary: Error "The syntax of the command is incorrect." when profiling Java class.
Status: REOPENED
Alias: None
Product: projects
Classification: Unclassified
Component: Maven (show other bugs)
Version: 8.2
Hardware: PC Windows 7
: P2 normal with 3 votes (vote)
Assignee: Tomas Stupka
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-07-07 10:19 UTC by bht
Modified: 2018-02-24 22:31 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
IDE Log (83.09 KB, application/octet-stream)
2017-07-07 10:19 UTC, bht
Details
Maven project in zip file (2.00 KB, application/octet-stream)
2017-07-07 21:37 UTC, bht
Details

Note You need to log in before you can comment on or make changes to this bug.
Description bht 2017-07-07 10:19:24 UTC
Created attachment 164717 [details]
IDE Log

This happens with the most basic Maven project:

public class Main {

    public static void main(String[] args){
        System.out.println("Hello");
    }

}


Menu|Profile||Profile File




Profiler prompt waiting:
title "Progress..."
Body: Connecting to target VM...


Output:

cd C:\bt\java\netbeans\bugs\_new\ProfilerCommandError\Profiler; "JAVA_HOME=C:\\Program Files\\Java\\jdk1.8.0_131" M2_HOME=C:\\prog\\apache-maven-3.5.0 cmd /c "\"\"C:\\prog\\apache-maven-3.5.0\\bin\\mvn.cmd\" -Dexec.args=\"-agentpath:\\\"C:/Program Files/NetBeans 8.2/profiler/lib/deployed/jdk16/windows-amd64/profilerinterface.dll\\\"=\\\"C:\\Program Files\\NetBeans 8.2\\profiler\\lib\\\",5140,10 -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=C:\\Users\\user\\AppData\\Local\\NetBeans\\Cache\\8.2\\mavencachedirs\\694736397\\org-netbeans-modules-profiler  -classpath %classpath test.profiler.Main\" -Dexec.executable=\"C:\\Program Files\\Java\\jdk1.8.0_131\\bin\\java.exe\" -Dexec.classpathScope=runtime -DskipTests=true -Dmaven.ext.class.path=\"C:\\Program Files\\NetBeans 8.2\\java\\maven-nblib\\netbeans-eventspy.jar\" -Dfile.encoding=UTF-8 --fail-fast process-classes org.codehaus.mojo:exec-maven-plugin:1.2.1:exec\""
The syntax of the command is incorrect.



In messages.log:

*** Profiler error (Fri Jul 07 22:08:57 NZST 2017): connection with server not open



  Product Version         = NetBeans IDE 8.2 (Build 201609300101) (#5fd841261bf9)
  Operating System        = Windows 7 version 6.1 running on amd64
  Java; VM; Vendor        = 1.8.0_131; Java HotSpot(TM) 64-Bit Server VM 25.131-b11; Oracle Corporation
  Runtime                 = Java(TM) SE Runtime Environment 1.8.0_131-b11
  Java Home               = C:\Program Files\Java\jdk1.8.0_131\jre
Comment 1 bht 2017-07-07 21:37:37 UTC
Created attachment 164722 [details]
Maven project in zip file
Comment 2 Tomas Hurka 2017-07-10 09:03:31 UTC
I am not able to reproduce it. 
I used NB 8.2 (JavaSE) on Windows 10. I created simple maven project via New Project -> Maven -> Java project. Added code you mentioned.
Both Profile Project and Profile File works fine.
Comment 3 bht 2017-07-10 13:54:10 UTC
Thomas, could you please paste your command line output so we can compare - perhaps we can get a clue from the differences, perhaps some quoting / escaping issue?
Comment 4 Tomas Hurka 2017-07-11 10:44:18 UTC
Output:

cd C:\Users\IEUser\Documents\NetBeansProjects\mavenproject1; "JAVA_HOME=C:\\Program Files\\Java\\jdk1.8.0_112" cmd /c "\"\"C:\\Program Files\\NetBeans 8.2\\java\\maven\\bin\\mvn.bat\" -Dexec.args=\"-agentpath:\\\"C:/Program Files/NetBeans 8.2/profiler/lib/deployed/jdk16/windows-amd64/profilerinterface.dll\\\"=\\\"C:\\Program Files\\NetBeans 8.2\\profiler\\lib\\\",5140,10 -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=C:\\Users\\IEUser\\AppData\\Local\\NetBeans\\Cache\\8.2\\mavencachedirs\\1339466924\\org-netbeans-modules-profiler  -classpath %classpath com.mycompany.mavenproject1.Main\" -Dexec.executable=\"C:\\Program Files\\Java\\jdk1.8.0_112\\bin\\java.exe\" -Dexec.classpathScope=runtime -Dmaven.ext.class.path=\"C:\\Program Files\\NetBeans 8.2\\java\\maven-nblib\\netbeans-eventspy.jar\" -Dfile.encoding=UTF-8 org.codehaus.mojo:exec-maven-plugin:1.2.1:exec\""
Comment 5 bht 2017-07-16 23:48:09 UTC
Hi Tomas,

I have two installations, Windows 7 where it breaks and Windows 8.1 where it fails. In addition, the Windows 8.1 installation has a NetBeans portable installation in a directory without spaces which might help.

In the installation where it breaks with apache-maven-3.5.0, is succeeds with apache-maven-3.3.9.

I found that mvn.cmd has changed substantially between apache-maven-3.5.0 and apache-maven-3.3.9.

I spotted an error that the apache-maven-3.5.0 mvn.cmd produces with a simple logging modification of it:

Change @echo off
to
REM @echo off
ECHO %~2

(with an additional ECHO line added).

In the broken installation, the ECHO displays a truncated command line as follows:

-agentpath:\"C:/Program

were compared with the Windows 8.1 installation , the same ECHO produces:

-agentpath:C:/Users/username/AppData/Local/prog/netbeans-8.2/profiler/lib/deployed/jdk16/windows-amd64/profilerinterface.dll=C:\Users\username\AppData\Local\prog\netbeans-8.2\profiler\lib,5140,10 -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=C:\Users\username\AppData\Local\NetBeans\Cache\8.2\mavencachedirs\1029074788\org-netbeans-modules-profiler  -classpath %classpath test.profiler.Main

Would you have an idea about how I can take this to the next step?

Thanks
Comment 6 bht 2017-07-22 21:57:29 UTC
I wrote "and Windows 8.1 where it fails." which is wrong - it  works on Windows 8.1" where NetBeans is installed in a directory without spaces.
Comment 7 _ gtzabari 2017-07-30 02:55:02 UTC
Tomas,

I am seeing the same bug using dev build 201707050001 and Maven 3.5.0.

Can you please try reproducing using Maven 3.5.0?
Comment 8 Tomas Hurka 2017-08-02 14:41:58 UTC
(In reply to _ gtzabari from comment #7)
> I am seeing the same bug using dev build 201707050001 and Maven 3.5.0.
> 
> Can you please try reproducing using Maven 3.5.0?
You are right, this is caused by Maven 3.5.0. NetBeans bundles Maven 3.3.9 and Maven 3.5.0 is to new. It looks like there are some incompatible changes between Maven 3.3.9 and Maven 3.5.0.

Please use Maven 3.3.9, which is bundled and tested with NetBeans.