Is there an easy way to find out if the user has installed J2EE? Is there some query I can perform, maybe on the user's system properties?
I'd like some code to run only if J2EE has already been installed, otherwise not.
JavaBeginnersFaq "Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
posted 12 years ago
I'm not aware of any bullet proof strategy for such a thing. If the J2EE_HOME environment variable is set, then on Windows machines, java -DJ2EE_HOME=%J2EE_HOME% Foo should work, and on Linux or Mac machines java -DJ2EE_HOME=$J2EE_HOME Foo should work to then be able to use System.getProperty("J2EE_HOME") in your Foo application. So, knowing what I know how to do and faced with your problem, I'd probably make scripts (batch for windows, and a shell script for Linux/Mac) that ran the appropriate command from above, have the client execute the correct script for their OS, and then if the J2EE_HOME environment variable were not set, either prompt for the location of the J2EE installation and let the user select that it was not installed, or just assume that it was not properly installed.