This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes JSP and the fly likes want to execute dosCommand from JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Java » JSP
Bookmark "want to execute dosCommand from JSP " Watch "want to execute dosCommand from JSP " New topic

want to execute dosCommand from JSP

ukb firstname ukb lastname

Joined: Jun 18, 2013
Posts: 1
I want to execute DOS command "net config workstation" from jsp file. When i execute the below snippet from simple java class it is executing and giving me the output. But once i tried to execute this from JSP file or calling a java method where this code snippet is wriiten to JSP file, it is not execting.

final String dosCommand = "net config workstation";
final Process process = Runtime.getRuntime().exec(dosCommand);
final InputStream in = process.getInputStream();
System.out.println(" in length " +;

From the simple java application class i get the in length value 67 but through JSP it is -1.

Any one please help if you have any idea on this.


Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63208

This is not something you should be doing in a JSP. In fact, modern JSPs should not contain any Java code. Leave the code in Java class.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: want to execute dosCommand from JSP
It's not a secret anymore!