Wednesday, 5 April 2017

Running jar file with lib/libraries in command prompt (or) running in bat file

Running Jar file in Command Prompt using lib folder

Make sure java is installed. To check is installed use command
java -version

Running jar file using command prompt or terminal
java -cp xxxx.jar;lib/*;. com.easycode.StartupClassname

where xxxx.jar is the jar file name
StartupClassname is main method present class.

Once successfully running the jar file command prompt. If you want create bat file follow below steps:

Use below code in notepad

@echo ON
SET DEVELOPMENT_HOME=%cd%
cd /d %DEVELOPMENT_HOME%
call java -cp xxxx.jar;lib/*;. com.easycode.StartupClassname

====================================================
Jar file running in the command prompt
Jar using lib folder running the command prompt
cmd run the jar file
lib add to jar in command prompt

No comments:

Post a Comment