permaculture playing cards*
The moose likes Beginning Java and the fly likes executing bat file in jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "executing bat file in jsp" Watch "executing bat file in jsp" New topic
Author

executing bat file in jsp

biny panackal
Ranch Hand

Joined: Apr 12, 2007
Posts: 72
hi to all.
Dear All

i have small doubght please help me..

I got a bat file which conatin a command to create a folder.i executed it in jsp
Runtime run =Runtime.getRuntime();
run.exec("C:\\sdf\\binnew.bat");


i run it fine.. but the folder not created..
why..?
if any body know it, please help me.
when i double click on the bat file its getting created
[ October 22, 2007: Message edited by: biny panackal ]

Biny Balan
binypanackal@gmail.com
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41874
    
  63
Are you using absolute paths in the batch file? Keep in mind that web apps do not have a concept of a default directory, if you use relative paths, it's not going to work.

Is there a reason you're not using File.mkdir to accomplish the same?


Ping & DNS - my free Android networking tools app
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14153
    
  18

Also remember that JSPs are executed on the server and not on the client; if you were trying to create a directory on the client's computer, this will not work.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
biny panackal
Ranch Hand

Joined: Apr 12, 2007
Posts: 72
i had just return "mkdir foldername" in the batfile..
nothing more in it.. is it necessory to use the ablsolute path
biny panackal
Ranch Hand

Joined: Apr 12, 2007
Posts: 72
thank you

i got it by giving absolute path in bat file
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: executing bat file in jsp