Reputation: 11
I have a runnable jar with main class located at /DataValidation/src/package/class i am using the following commands in batch file to run the main class but i am getting the error as could not find or load main class.
@echo off
javac -cp C:\Users\500603\Desktop\Excel_files\ivg\sample.jar; package.class.java
java -cp C:\Users\500603\Desktop\Excel_files\ivg\sample.jar; .package.class
pause
Please help me how can i execute the main class present in jar file
Upvotes: 1
Views: 1836
Reputation: 1744
Create MANIFEST.MF file. Add line:
Main-Class: package.class
in jar, create META-INF folder and put manifest file into it.
java -jar C:\Users\500603\Desktop\Excel_files\ivg\sample.jar
should work now.
P.S. package and class are very confusing names. Use something different.
Upvotes: 1