Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

451
Views
How to determine which command Netbeans is executing to run the project?

I'm developing an Java application using Netbeans and Maven. I'm struggling a lot to run the project as standalone application. Launching the project from Netbeans is all fine but running the executable jar yields an error (failing to load a data file).

I need to know exactly which command(s) Netbeans is executing to run the application. However, the output window of Netbeans only shows me what the application writes "back". Is there a way to figure out/display the command(s) that Netbeans is using to run the project?

Thanks

EDIT: Running the java application and loading files is not the issue here. I'm able to run the application and the libraries are loading correctly. The issue here is to understand how Netbans runs the application (by looking at the commands that are executed).

about 4 years ago · Santiago Trujillo
3 answers
Answer question

0

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

I use Netbeans 8.2 and that's how it looks like when I hit big green Run button in maven project:

Netbeans Output

The first line reads (formatted for better readablility):

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 that line I can tell that Netbeans:

  • goes to the project's directory
  • sets environment variables (JAVA_HOME and M2_HOME)
  • then executes cmd that executes mvn (by its full path)
    • with bunch of -D arguments (which specify working directory and AppStarter as a class to execute)
    • and exec-maven- plugin with target exec.
about 4 years ago · Santiago Trujillo Report

0

When NetBeans compiles a program it creates a folder-hierarchy with compiled .class files. When creating a JAR archive ZIPs those into the archive. When executing the program, (or debugging,) NetBeans runs the .class files off the folders, not in the JAR file.

These could cause different problems, like different PATH. This can cause "file not found" errors with relative paths.

about 4 years ago · Santiago Trujillo Report

0

what is your operatingsystem?

windows: then wmic may be the tool, which could show you the complete commandline. you will find examples here command line of process by name

linux: try ps -ef | grep java

about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!