Link to home
Start Free TrialLog in
Avatar of R0y4L
R0y4LFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Java Application Not Loading GUI when started from task scheduler

Hi Experts,

I have confusing situation. So: I have a big server application on a server which restarts every morning. There is a scheduled task created which will runs a .exe of the server application after the machine has started up. The problem I am getting is that the server application runs in as a process, but I cannot display GUI for it. Now the only way to display GUI is through a system tray icon which appears only if i start up the program by double clicking the .exe file.

Could any one explain to me why the system tray appears if I manually start the program, but does not if the program is started by a scheduled task? Or how could I make the GUI to be usable when it is started from the scheduled task.

Thanks
Avatar of for_yan
for_yan
Flag of United States of America image

I'm not sure I understand where does java come in here.
What is the server that you are talking about.
Avatar of R0y4L

ASKER

Well the "server" is the server application written in java.
How is it packaged in .exe ?
Avatar of R0y4L

ASKER

Using launch4j program. The only thing that the .exe does is copy a reference of the Server.jar file into the jre folder in ProgramFiles/Java location and execute command java -jar Server.jar
Avatar of TommySzalapski
If it's running the scheduled task as a service or under a different user name or as a hidden task, then any one of those would cause the GUI to not show up.
A lot of server applications are set to run as services in which case there is no way for them to directly communicate with the user session.
Avatar of R0y4L

ASKER

It is running as a different user. However, If I log in as the the same user it still does not show up. It runs as a process and is not hidden.
You are using Windows Task Scheduler to run it, yes?
Avatar of R0y4L

ASKER

Yes

Trye if user is logged in checkvbox - at least for a try

In practice I find if I have "Run only when user is logged on", the task runs in the system tray as required, but it only works if I am the user logged in.

If I select "Run whether user is logged in or not", the task runs as a background process (a daemon in Unix terms) with no user interface, no use at all.
ASKER CERTIFIED SOLUTION
Avatar of for_yan
for_yan
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Yes. You can't have it set to run as a process or it will run in the background.
Avatar of R0y4L

ASKER

Is the actually a solution out there which would allow me to start my server application when the machine starts up automatically and allow me to use GUI?

Thanks
You can just put a link to your application in the Startup folder.
Avatar of R0y4L

ASKER

But, does it not require for someone to log in for the .exes in the Start up folder to be executed?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of R0y4L

ASKER

I've split the points between the two experts as they took time to reply even though there is no real solution to my problem. Thanks again.