在我的例子中,我想运行独立的 war spring boot 应用程序 java -jar test_xxxxx-0.0.1-SNAPSHOT.war
服务器启动后,需要运行 Chrome 浏览器,指向具有 UI 代码索引页面的独立 war 。
这是我的bat文件
java -jar test_xxxx-0.0.1-SNAPSHOT.war
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"
SLEEP 10
START chrome.exe "http://localhost:8080"
这会导致仅服务器已启动但 Chrome 浏览器未启动。需要以一定的时间间隔运行
提前致谢。
最佳答案
您的 chrome 过早地开始使用此行
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"
首先你cd
目录,然后使用URL参数启动chrome
java -jar test_xxxx-0.0.1-SNAPSHOT.war
SLEEP 10
cd "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"
START chrome.exe "http://localhost:8080"
关于java - 运行.bat文件包含两个同时运行的独立war文件和打开chrome浏览器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50055151/