File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

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();

i run it fine.. but the folder not created..
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
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42959
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?
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 15046

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 8 API documentation
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:
subject: executing bat file in jsp
jQuery in Action, 3rd edition