简体   繁体   中英

Can't run dynamically generated batch file from Java

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

On my machine and many XP machine this process works fine.

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?

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

2) I assume Tomcat is running as a Service; what user account does it run as, and does this user account have appropriate permissions?

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?

4) Have you tried creating this file in a different directory than the bin folder of Tomcat?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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