Execute a .jar file from a batch script

1

It turns out that in the CMD it allows me to execute the following command:

C:\Users\Kevin\Desktop\Codigo\LibGDX\libgdx-nightly-latest\java -cp gdx.jar;gdx-natives.jar;gdx-backend-lwjgl.jar;gdx-backend-lwjgl-natives.jar;extensions\gdx-tools\gdx-tools.jar com.badlogic.gdx.tools.particleeditor.ParticleEditor

But he would like to know how to execute this same command but with a .bat file

I tried this:

@echo off

C:\Users\Kevin\Desktop\Codigo\LibGDX\libgdx-nightly-latest\java -cp gdx.jar;gdx-natives.jar;gdx-backend-lwjgl.jar;gdx-backend-lwjgl-natives.jar;extensions\gdx-tools\gdx-tools.jar com.badlogic.gdx.tools.particleeditor.ParticleEditor 
pause
exit

But I get the following problem:

I leave the link, where the file is, with which I have the problem: Here

    
asked by Alexis Rodriguez 02.05.2017 в 15:20
source

1 answer

2

I have downloaded the program that you are raising ParticleEditor , I have made the tests. The problem was also presented.

In that case you could try this:

@echo off

cd C:\Users\Kevin\Desktop\Codigo\LibGDX\libgdx-nightly-latest\

java -cp gdx.jar;gdx-natives.jar;gdx-backend-lwjgl.jar;gdx-backend-lwjgl-natives.jar;extensions\gdx-tools\gdx-tools.jar com.badlogic.gdx.tools.particleeditor.ParticleEditor

pause
exit

What has been done here is not a big change, compared to what you already had.

Instead of running the entire absolute path to open the program, what you do is use the cd command, to go to the folder that contains our program.

  

cd C: \ Users \ Kevin \ Desktop \ Code \ LibGDX \ libgdx-nightly-latest \

While there, we execute the file as you have done.

  

java -cp gdx.jar; gdx-natives.jar; gdx-backend-lwjgl.jar; gdx-backend-lwjgl-natives.jar; extensions \ gdx-tools \ gdx-tools.jar com.badlogic.gdx .tools.particleeditor.ParticleEditor

When performing the tests in this way it runs correctly.

    
answered by 02.05.2017 / 15:37
source