Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

452
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda