简体   繁体   English

使用BATCH从文件夹运行WebApp

[英]Run WebApp from folder with BATCH

i'm new, nice to meet you! 我是新来的,很高兴认识你! I made a web application java/spring based that runs with Apache Tomcat. 我制作了一个基于Java / spring的Web应用程序,它与Apache Tomcat一起运行。 I'd like to do a particular thing, run this web application in every Pc without install Tomcat and set Environments Variables... I tryed this: 我想做一件事,在每个PC中运行此Web应用程序,而无需安装Tomcat并设置环境变量...我尝试了以下操作:

  • I created a folder with in two tomcat folders: one with Tomcat 8.0.21 (32 bit) and the other one with Tomcat 8.0.28 (64 bit); 我创建了一个文件夹,其中包含两个tomcat文件夹:一个使用Tomcat 8.0.21(32位),另一个使用Tomcat 8.0.28(64位);
  • A batch file that checks if the CPU is 32 or 64 bit, and runs the relative Tomcat startup.bat 批处理文件,检查CPU是32位还是64位,并运行相对的Tomcat startup.bat

Here is the batch code: 这是批处理代码:

if %PROCESSOR_ARCHITECTURE%==x86 (
  call apache-tomcat-8.0.21\bin\startup.bat 
) else (
  call apache-tomcat-8.0.28\bin\startup.bat 
)

timeout /T 60

start /wait http://localhost:8080/Project_name/

Timeout command is done to wait tomcat's startup. 超时命令已完成,以等待tomcat的启动。

I understand that this thing is very very strange but I really need to do it... 我知道这件事很奇怪,但我确实需要这么做...

There's a way to do it? 有办法吗?

You don't need to make a file for 32/64 bit computers. 您不需要为32/64位计算机制作文件。 If other computers are on your same network then you can access from any of your network computer by accessing http://yourcomputer:8080/yourAppName (:8080 default port or whatever you set as default port) 如果其他计算机在同一网络上,则可以通过访问http:// yourcomputer:8080 / yourAppName (:8080默认端口或设置为默认端口的任何端口)从任何网络计算机访问

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM