• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Runtime.exec , application is invisible

 
hauze richard
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm making some web server for managing specific application.
at first, I want to run or stop a application at remote desktop using JSP server.

So, I used following code.

Process process = Runtime.getRuntime().exec("C:\\test.exe");

then I confirm that 'test.exe' is running at remote desktop but background.
I could find 'test.exe' from windows task manager. but I can't see it's window.
It's invisible.

how can I make it visible at remote desktop? anybody give me some advices.

thanks in advance.
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch

coming to your question, read this . it may show some light to you

 
hauze richard
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Seetharaman Venkatasamy wrote:Welcome to JavaRanch

coming to your question, read this . it may show some light to you



thanks for your reply

actually, my issue is running application by JSP(TOMCAT).
when I run my java code directly ( in eclipse, or command line ), it works well.

do you have any other idea?
 
Karthik Shiraly
Bartender
Posts: 1192
25
Android C++ Java Linux PHP Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
(Assuming remote OS is Windows) Check the username under which test.exe is running. If it's system or localservice or something like that (probably it'll be same credentials as the web server itself), app may not be visible since these credentials are not assigned a window station (i.e, they don't have access to desktop).
 
hauze richard
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Karthik Shiraly wrote:(Assuming remote OS is Windows) Check the username under which test.exe is running. If it's system or localservice or something like that (probably it'll be same credentials as the web server itself), app may not be visible since these credentials are not assigned a window station (i.e, they don't have access to desktop).


You are right. The username is 'SYSTEM'.
So, do you mean that I can't run my apps at remote PC with being visible?


thanks your opinion on target.


 
Karthik Shiraly
Bartender
Posts: 1192
25
Android C++ Java Linux PHP Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
App can be visible even on remote system. It needs to run under the same credentials as the remote desktop user account.
Am not to sure how to achieve that using Windows alone. There is a 'runas' command ("cmd runas <options> test.exe") but I think it has the problem that the account password has to be entered manually.
Another option is the Sysinternals free tool, psexec which can take both username and password in commandline.

Am not sure what your app is all about - if tomcat/jsp are in picture only to launch a remote app, then you can replace them totally with only psexec. It can execute an app in remote machine.
But if remote app launch is just one step in a bigger web application, then you can use psexec to launch it under remote desktop user account.

There may be other ways. Better to check in a Windows forum like codeproject or programmersheaven too.
 
Karthik Shiraly
Bartender
Posts: 1192
25
Android C++ Java Linux PHP Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Another option you can try, if you're running Tomcat as a service, is use 'services.msc' to set the option 'Allow service to interact with desktop' for Tomcat service.
 
hauze richard
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks Karthik Shiraly

Your reply is a big help to me. You are a superb engineer undoubtedly.
Have a good day
 
Karthik Shiraly
Bartender
Posts: 1192
25
Android C++ Java Linux PHP Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome! And thank you for those nice words - you made my day!!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic