How to determine which Netbeans command is run to start a project?

I am developing a Java application using Netbeans and Maven. I'm struggling to run the project as a standalone application. Starting a project from Netbeans is fine, but starting an executable flag results in an error (without loading a data file).

I need to know exactly which Netbeans command (s) to run the application. However, the Netbeans exit window only shows me what the application writes back. Is there a way to figure out / display the commands that Netbeans uses to start a project?

thanks

EDIT . Running a Java application and not downloading files. I can run the application and the libraries load correctly. The problem here is to understand how Netbans launches the application (looking at the commands that are executed).

+8
java maven netbeans
source share
3 answers

Netbeans prints the command it invokes as the very first line of output.

I use Netbeans 8.2 and how it looks when I click the big green Run button in the maven project:

Netbeans Conclusion

The first line is read (formatted for better readability):

 cd D:\test; "JAVA_HOME=C:\\Program Files\\Java\\jdk1.8.0_112" "M2_HOME=C:\\Program Files\\apache-maven-3.3.3" cmd /c "\"\"C:\\Program Files\\apache-maven-3.3.3\\bin\\mvn.cmd\" -Dexec.args=\"-classpath %classpath com.test.AppStarter\" -Dexec.executable=\"C:\\Program Files\\Java\\jdk1.8.0_112\\bin\\java.exe\" -Dexec.workingdir=D:\\test\\target\\dist -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\"" 

From this line, I can say that Netbeans :

  • goes to the project directory
  • sets environment variables ( JAVA_HOME and M2_HOME )
  • then execute cmd , which executes mvn (along its full path)
    • with a bunch of -D arguments (which define the working directory and AppStarter as an executable class)
    • and exec-maven- plugin with the purpose of exec .
+2
source share

When NetBeans compiles the program, it creates a hierarchy of folders with compiled .class files. When creating a JAR ZIP archive in the archive. When executing a program (or debugging), NetBeans runs .class files from folders, rather than in a JAR file .

This can cause various problems, for example different PATH . This can lead to file not found errors with relative paths.

+2
source share

What is your operating system?

windows: then wmic can be a tool that can show you the full command line. you will find here examples of the process command line by name

Linux: try ps -ef | grep java

0
source share

All Articles