Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to run exe in servlet?  RSS feed

 
Tommy Leung
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need to run a local exe program and here is the code in servlet.



When I runBatch() with the following code, it shows null\dot.exe

 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
String base = System.getProperty("C:\\Program Files\\UCB\\ATT\\Graphviz\\bin\\");

That's not the name of a system property - that's a directory name.
 
Bauke Scholtz
Ranch Hand
Posts: 2458
 
Bageshwar Pratap Narain
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are trying to extract a System. property which does not exist,
rather than using the System.getProperty, directly assing the value to "base" and you would be through
 
ujjwal soni
Ranch Hand
Posts: 405
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

You can do this via runtime & process classes. Check the code below.



 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Carefully read the JavaDocs for Process, paying particular attention to the need to consume the std-err and std-out streams.

Bill
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!