Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can a servlet call an EXE

 
sanjeev magoo
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,
Can a servlet run an EXE which is located on another machine.
 
Raghavendra Holla
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
What you have to do with exe? Is it any third party software? Objective of Java to make it poratble across the plaforms.. i.e. "Write once .. Run anywhere..." However still you want to use..
use following method,
Runtime.getRuntime().exec("C:\win\system\notepad.exe");

Try to avoid using above command. look into java.lang package for further information.
regards,
holla.
 
Bharatesh H Kakamari
Ranch Hand
Posts: 198
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You cannot execute a file on a remote machine (Machine 1) by a servlet on machine 2.
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
However, a servlet can call an executable program in the same way as any other Java code. You need the Runtime.exec() method. Look it up in your API documentation.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic