How to stop Java program errors for VM errors?

Inside the bat file, there is the following:

java -Ddatabase.host=127.0.0.1 -Xms128M -Xmx1024M com.temp.util.manual.serial.Assignment -folder C:\temp\ -destination C:\temp\out.csv

It is assumed that the -folder and -destination are passed to the main method of the destination class being called, but instead they are interpreted as VM Args.

I tried putting quotes around the parameters to no avail, and the search did not reveal an answer.

I get the following error:

 Unrecognized option: -'destination' Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit. Press any key to continue . . . @echo off setlocal EnableDelayedExpansion EnableExtensions set FILETYPE=%~n0 set CLASSPATH=jar1.jar set CLASSPATH=%CLASSPATH%;anotherjar.jar echo %CLASSPATH% java -DjobName=%FILETYPE% -Ddatabase.host=127.0.0.1 -Ddatabase.name=db1 -Ddatabase.username=user1 -Ddatabase.password=password1 -Xms128M -Xmx1024M com.temp.util.manual.serial.Assignment -folder C:\\temp\\ -destination C:\\temp\\out.csv call Cleanup.bat endlocal 
+7
java batch-file
source share
2 answers

I think your problem is more about passing variables. Remove EnableDelayedExpansion EnableExtensions

+2
source share

The java command has the following syntax:

 java [ options ] class [ arguments ] java [ options ] -jar file.jar [ arguments ] 

So, in your case (class) it seems that the class was not found. Probably due to the lack of a path to the class.

 java -cp . ... com.temp.util.manual.serial.Assignment ... 

It might be better not to rely on the CLASSPATH variable, use -jar and rely on META-INF / MANIFEST.MF.

0
source share

All Articles