In java I have dynamically created a batch file under program files in tomcat's bin directory and execute it dynamically, but it does not execute. If I double click the generated batch file it does execute. (Problem occurs on windows server machine.)
在java中,我已经在tomcat的bin目录下的程序文件下动态创建了一个批处理文件并动态执行它,但它没有执行。如果我双击生成的批处理文件,它会执行。 (Windows服务器计算机上出现问题。)
On my machine and many XP machine this process works fine.
在我的机器和许多XP机器上这个过程工作正常。
So is it OS dependent, or the file is at program files so can't have permissions to execute or there is any other problem?
它是依赖于操作系统,还是文件位于程序文件中,因此无法执行权限或存在任何其他问题?
1 个解决方案
#1
0
A proper answer requires you to supply more information; maybe by answering these questions, you will determine your answer.
正确的答案要求您提供更多信息;也许通过回答这些问题,你将确定你的答案。
1) Be specific about the Windows Server version (2003, 2008, etc.)
1)具体说明Windows Server版本(2003年,2008年等)
2) I assume Tomcat is running as a Service; what user account does it run as, and does this user account have appropriate permissions?
2)我假设Tomcat作为服务运行;它运行的用户帐户是什么,并且此用户帐户是否具有适当的权限?
3) Post the code you have that creates the file. Post the code you have that is executing the file. Are you trying to execute the file after it is created, but before the output stream is closed?
3)发布您创建文件的代码。发布您执行文件的代码。您是否尝试在创建文件后执行该文件,但在关闭输出流之前?
4) Have you tried creating this file in a different directory than the bin folder of Tomcat?
4)您是否尝试在与Tomcat的bin文件夹不同的目录中创建此文件?
#1
0
A proper answer requires you to supply more information; maybe by answering these questions, you will determine your answer.
正确的答案要求您提供更多信息;也许通过回答这些问题,你将确定你的答案。
1) Be specific about the Windows Server version (2003, 2008, etc.)
1)具体说明Windows Server版本(2003年,2008年等)
2) I assume Tomcat is running as a Service; what user account does it run as, and does this user account have appropriate permissions?
2)我假设Tomcat作为服务运行;它运行的用户帐户是什么,并且此用户帐户是否具有适当的权限?
3) Post the code you have that creates the file. Post the code you have that is executing the file. Are you trying to execute the file after it is created, but before the output stream is closed?
3)发布您创建文件的代码。发布您执行文件的代码。您是否尝试在创建文件后执行该文件,但在关闭输出流之前?
4) Have you tried creating this file in a different directory than the bin folder of Tomcat?
4)您是否尝试在与Tomcat的bin文件夹不同的目录中创建此文件?