开发者

Elevate permission to run exe in java

I need to run a ba开发者_StackOverflow中文版t file using a java code. I did that in the following way

Process process =Runtime.getRuntime().exec("cmd /c start  D:\\Work\\BOSync\\TestFoxPro\\ATSFill.bat");
int exitVal = process.waitFor();

Problem is I can run the bat but the task of the bat not happened. I run the bat to load data from CSV file to oracle database using sqlldr. When I double click on the bat it works fine. I think the problem is JVM doesn't has enough permission to run the bat. Is there a way to elevate the permission in java?


This sounds like a path issue to me. Try using absolute paths to the binary that you are using in your bat file and set other environment variables that your script need.

As for the cmd window popping up - try just calling the bat file directly and not use the cmd /c command.


Hey guys finally i Sort it out. The problem was in my bat file. It was like that previously. cd \C:\oracle\ora92\bin sqlldr GAMINI/gamini C:\AOTITS\CLSTMAS.ctl log=C:\AOTITS\CLSTMAS.log. Then I remove the path of oracle bin and add it to system path. Then it works fine. Thanks for your help

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜