Reputation: 542
I used to launch a java tool with a batch like this :
java -classpath "./lib/JSanExport.jar;./lib/JSanRmiApiEx.jar;./lib/JSanRmiServerUx.jar" -Xms128M -Xmx768M -Dmd.command=command_VSPLA.txt -Dmd.logpath=log sanproject.getmondat.RJMdMain
For some reasons i need to convert that batch into a Powershell script. But when I copy the same line on my powershell script I got an error, whereas I launch it in the same workingdir.
c:\Program Files\ExportTool\export>powershell .\Run_VSPLA.ps1
Exception in thread "main" java.lang.NoClassDefFoundError: /command=command_VSPLA/txt
Caused by: java.lang.ClassNotFoundException: .command=command_VSPLA.txt
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
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)
Could not find the main class: .command=command_VSPLA.txt. Program will exit.
Do you know what happens?
Upvotes: 2
Views: 752
Reputation: 57282
try to set jvm options before classpath :
java -Xms128M -Xmx768M -Dmd.command=command_VSPLA.txt -Dmd.logpath=log -classpath "./lib/JSanExport.jar;./lib/JSanRmiApiEx.jar;./lib/JSanRmiServerUx.jar" sanproject.getmondat.RJMdMain
It searches for class named /command=command_VSPLA/txt. For batch =
is a delimiter and is parsed in a different way than powershell.
EDIT
The solution given by the OP:
java -Xms128M -Xmx768M "-Dmd.command=.\command_VSPLA.txt" "-Dmd.logpath=log" -classpath "./lib/JSanExport.jar;./lib/JSanRmiApiEx.jar;./lib/JSanRmiServerUx.jar" sanproject.getmondat.RJMdMain
Upvotes: 2