Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

call java class in batch file

i want to call the java class in batch file. how can i call. can tell me any commands which call the class file

Thanks Krishna

like image 269
krishna Avatar asked Nov 04 '10 07:11

krishna


2 Answers

@ECHO OFF
java -jar "Path/To/The/Jar/Whatever.jar"

I would recommend first jaring up your class(es) and providing a link to the jar.

like image 91
whirish Avatar answered Sep 21 '22 17:09

whirish


if you are having a class Myclass with package name com.mycomp.util then you have to go to the parent dir of "com" for example "c:\src" is the folder that contains com package then

your command should be in the batch file

cd c:\src java -cp jar1;jar2; com.mycomp.util.Myclass

now call the batch file.

like image 41
Prabhakaran Avatar answered Sep 20 '22 17:09

Prabhakaran