0

I developed simple java project and want to run this project using the batch file. how to include the external jar file in the batch file in order run the java project successfully.

Project Structure is given below,

Click here to find the Project Structure Screen shot

lanch.bat file contains

java -Xms512M -Xmx512M -jar selflearn.jar -o true
PAUSE

how to include the POdetail_for_tests.txt file and libs folder as a reference while programming execute.

when trying to run the project with above batch file the following error occurs

F:\java>java -Xms512M -Xmx512M -jar selflearn.jar -o true
Exception in thread "main" java.lang.NoClassDefFoundError: 
org/apache/poi/xssf/usermodel/XSSFWorkbook
at selflearn.txtFileToCSV.csvToXLSX(txtFileToCSV.java:57)
at selflearn.txtFileToCSV.main(txtFileToCSV.java:48)
Caused by: java.lang.ClassNotFoundException: 
org.apache.poi.xssf.usermodel.XSSFWorkbook
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 2 more

F:\java>PAUSE
Press any key to continue . . .
S Mugunthan kumar
  • 177
  • 1
  • 2
  • 11

1 Answers1

0

There is -cp (classpath) option to include dependent jars:

F:\java>java -Xms512M -Xmx512M -cp "libs/*" -jar selflearn.jar -o true

As per the project structure screenshot, it should be able to locate POdetail_for_tests.txt file.

Amitabha Roy
  • 769
  • 5
  • 8