gpt4 book ai didi

java - 如何在 package.json start 中的同一命令行中运行 Node 服务器和 java 服务器

转载 作者:太空宇宙 更新时间:2023-11-04 10:19:45 25 4
gpt4 key购买 nike

我需要运行:

node server.js

和:

java -Xmx4g -cp 'libraries/corenlp/*' edu.stanford.nlp.pipeline.StanfordCoreNLPServer -serverProperties StanfordCoreNLP-french.properties -port 9000 -timeout 15000

我试过了:

node server.js; java -Xmx4g -cp 'libraries/corenlp/*' edu.stanford.nlp.pipeline.StanfordCoreNLPServer -serverProperties StanfordCoreNLP-french.properties -port 9000 -timeout 15000

或者

node server.js && java -Xmx4g -cp 'libraries/corenlp/*' edu.stanford.nlp.pipeline.StanfordCoreNLPServer -serverProperties StanfordCoreNLP-french.properties -port 9000 -timeout 15000

但是在这两种情况下,当我在 Node 应用程序中询问时,java 服务器都没有运行。但是如果我在 2 个不同的控制台中运行两个命令。没有问题。谢谢

编辑:我尝试在 npm start 中执行此操作

最佳答案

好的,所以我找到了一种方法:我的 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"

},

关于java - 如何在 package.json start 中的同一命令行中运行 Node 服务器和 java 服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44366217/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com