Skip to content
Advertisement

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. 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

Advertisement

Answer

Ok so I found a way to do it : My 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"

},

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement