Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Some background:

I have four apps that run as services on a set of Windows XP machines, two of which are java apps. All four apps were originally designed to be run from a Linux server, and have three Windows XP machines connect to it, but customer requirements have meant porting these apps over to Windows so that everything can be run from a single machine.

The problem:

Since we didn't want to drastically change anything in our code in order to run the apps as services, we used instsrv.exe and srvany.exe to install and run the apps. This works fine for the two c++ apps, and for the most part, the java apps run fine. However, when a user logs out, the java apps stop. The actual services are still running, because java.exe (or javaw.exe, doesn't matter which) is still running, but it is no longer running the app. As far as the services manager is concerned, everything is running fine, and so it doesn't restart the service like it should. Note that the primary user is using a limited account, and therefore can't restart the services manually.

Stuff we've considered/tried:

srvany.exe. was chosen primarily because it's free (as in beer) to use and relatively easy to configure. We also considered srvstart.exe, but I believe it exhibited the same problem. There are two dedicated java service wrappers that we looked into, but were eliminated from consideration because of licensing terms and/or difficulty configuring them. Note that YAJSW was not considered initially, and, time permitting, may be tested.

The problem doesn't seem to exist on Windows 7, but since our customer requires Windows XP, that isn't an option.

I've also tried allowing desktop interaction for the two java apps, but this doesn't solve the problem when using javaw.exe, and shows a command line window when using java.exe, which is extremely undesirable, even if it does solve the problem. Our stopgap measure so far has been to tell the customer to not log out of an account, but rather only use switch user.

Is there anything else I'm missing or should try? This is also time sensitive, as once these units go out the door, it may be extremely hard to implement a fix on site.

share|improve this question

1 Answer 1

up vote 2 down vote accepted

You need to add the -Xrs flag to your java.exe command line to prevent the JVM from exiting when you log off an XP machine. The problem doesn't arise on Windows 7 (or Vista/Server 2008) because "Session 0 Isolation" prevents users from logging in (and thus logging off) Session 0, the place where services are run.

Be warned though -- if your java application catches shutdown events these may not be fired as expected when you use the -Xrs flag. Is that an issue for you?

share|improve this answer
    
Shutdown events as in close the app? Not directly. It shouldn't be an issue. –  MBraedley Jan 10 '12 at 12:11

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.