Windows command script failing to recognize CD parameter for Java program
I'm trying to run a Java program from a script called converter.cmd but something is wrong.
P:\LatitudeConsulting\LatConConverter-1.8.2>dir
Volume in drive P has no label.
Volume Serial Number is 1074-4BBE
Directory of P:\LatitudeConsulting\LatConConverter-1.8.2
08/25/2011 10:32 AM <DIR> .
08/25/2011 10:32 AM <DIR> ..
05/11/2011 09:29 PM 2,349 convert.xsd
02/19/2008 09:28 PM 100 Converter.cmd
05/11/2011 09:29 PM 104,697 Converter.jar
05/11/2011 09:29 PM 74,082 Converter.jar.old
05/19/2011 01:02 PM 1,432 Converter.properties
05/19/2011 04:37 PM 1,432 Converter.properties.modifiedJJA.txt
08/24/2011 04:54 PM 292 FieldList.txt
08/25/2011 10:31 AM <DIR> jre.1.6.0
05/11/2011 09:30 PM 1,747 MimeTypes.properties
Here is the content of converter.cmd:
cd %~dp0%
jre.1.6.0\bin\java -Xmx1024m -cp Converter.jar com.latcon.ExportConvert.Converter %1 %2
Here is what I get when I type converter at the above command prompt:
P:\LatitudeConsulting\LatConConverter-1.8.2>converter
P:\LatitudeConsulting\LatConConverter-1.8.2>cd P:\LatitudeConsulting\LatConConverter-1.8.2\
P:\LatitudeConsulting\LatConConverter-1.8.2>jre.1.6.0\bin\java -Xmx1024m -cp Converter.jar com.latcon.ExportConvert.Conv
erter
'jre.1.6.0\bin\java' is not recognized as an internal or external command,
operable program or batch file.
P:\LatitudeConsulting\LatConConverter-1.8.2>
EDIT---------
P:\>dir p:\LatitudeConsulting\LatConConverter-1.8.2\开发者_C百科jre.1.6.0\bin\java.*
Volume in drive P has no label.
Volume Serial Number is 1074-4BBE
Directory of p:\LatitudeConsulting\LatConConverter-1.8.2\jre.1.6.0\bin
05/11/2011 09:29 PM 126,976 java.dll
1 File(s) 126,976 bytes
0 Dir(s) 16,691,785,728 bytes free
P:\>
Looks like no java.exe exists - only java.dll
Try jre.1.6.0\bin\java.exe
- with the extension.
Try just java
or java.exe
, your java program might not be in jre.1.6.0\bin.
If it's not in the relative path you're trying to execute it from, copy it there ( assuming that's what you want ).
精彩评论