• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

want to execute dosCommand from JSP

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
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 " + in.read());

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.

Thanks,

 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic