[英]How to run node server and java server in same command line in package.json start
I need to run : 我需要跑步:
node server.js
And : 和:
java -Xmx4g -cp 'libraries/corenlp/*' edu.stanford.nlp.pipeline.StanfordCoreNLPServer -serverProperties StanfordCoreNLP-french.properties -port 9000 -timeout 15000
I tried : 我试过了 :
node server.js; java -Xmx4g -cp 'libraries/corenlp/*' edu.stanford.nlp.pipeline.StanfordCoreNLPServer -serverProperties StanfordCoreNLP-french.properties -port 9000 -timeout 15000
Or 要么
node server.js && java -Xmx4g -cp 'libraries/corenlp/*' edu.stanford.nlp.pipeline.StanfordCoreNLPServer -serverProperties StanfordCoreNLP-french.properties -port 9000 -timeout 15000
But in both case the java server is not running when I ask it in the node applicaition. 但是在两种情况下,当我在节点应用程序中要求它时,java服务器都没有运行。 But if I run both commande in 2 differents console.
但是,如果我在两个不同的控制台中同时运行两个命令。 There is no problem.
没有问题。 Thank you
谢谢
Edit: I try to do it in the npm start 编辑:我试图在npm开始
Ok so I found a way to do it : My package.json: 好的,所以我找到了一种方法:我的package.json:
"scripts": {
"start-nlp" : "java -Xmx4g -cp 'libraries/corenlp/*' edu.stanford.nlp.pipeline.StanfordCoreNLPServer -serverProperties StanfordCoreNLP-french.properties -port 9000 -timeout 15000 &",
"start-node": "node server.js",
"start": "npm run start-nlp && npm run start-node"
}, },
You need to run the processes in the background. 您需要在后台运行进程。 Please append
&
at the end of the commands to run them in the background. 请在命令末尾附加
&
,以在后台运行它们。
node server.js &
java -Xmx4g -cp 'libraries/corenlp/*' edu.stanford.nlp.pipeline.StanfordCoreNLPServer -serverProperties StanfordCoreNLP-french.properties -port 9000 -timeout 15000 &
To kill them, you need to search these processes using ps -ef | grep
要杀死它们,您需要使用
ps -ef | grep
搜索这些进程ps -ef | grep
ps -ef | grep
command. ps -ef | grep
命令。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.