当我尝试从 java 类执行 node.js 脚本时,出现以下错误: java.io.IOException: Cannot run program "node events.js": error=2, No such file or directory
这是我的代码有人可以告诉我我在这里缺少什么吗?
public class NodeInitializer {
private static final Logger logger = Logger.getLogger(SpringLauncher.class);
private Process nodeProcess;
ProcessBuilder processBuilder;
public void start(){
try {
processBuilder = new ProcessBuilder("node events.js");
nodeProcess = processBuilder.start();
} catch (IOException e) {
logger.error(e.getCause(), e);
}
}
}