我有批处理文件,名为run.bat,它包含以下代码:
@echo off
REM bat windows script
set CXF_HOME=.\lib\apache-cxf-2.2.7
java -Djava.util.logging.config.file=%CXF_HOME%\logging.properties -jar archiveServer-0.1.jar
Run Code Online (Sandbox Code Playgroud)
当我在命令行上执行此文件时,它完美地工作.但是,当我尝试使用以下语句在java文件中执行时:
File path = new File("C:/Documents and Settings/Zatko/My Documents/Project-workspace/IUG/external/application/archive");
Runtime.getRuntime().exec(new String[]{"cmd.exe", "/C", "start", "run.bat"}, new String[]{}, path);
Run Code Online (Sandbox Code Playgroud)
我在终端窗口中收到以下错误:
'java' is not recognized as internal or external command, operable program or batch file.
Run Code Online (Sandbox Code Playgroud)
错误可能在哪里?
| 归档时间: |
|
| 查看次数: |
2703 次 |
| 最近记录: |