1

My java application requires users to have Java 7 installed. However, if they don't, nothing is displayed or returned to the user unless they started the application from the console. The app simply terminates.
How would I generate a popup displaying a link to the correct version of Java in the case that the user doesn't have the correct one already?

Thanks for any help

asked Mar 4, 2013 at 2:34

1 Answer 1

2

You can use System.getProperty("java.version") to get the java version in a program compiled for all version . You can then make this program launch your main application/game otherwise redirect user to install JRE 7.

The correct way to do this would be to verify it during game installation as well as during launch.

Your launcher should be compiled in lowest JDK version possible for it, like ,

javac file.java -source 1.3

If possible keep your launcher as .bat/.sh file so you can be sure that launcher would not fail if java is missing

see this for example ,

Check if JAVA_HOME is present in environment using batch script

answered Mar 4, 2013 at 2:40
Sign up to request clarification or add additional context in comments.

6 Comments

What you are saying is that I need one program to launch the next program after checking the java version? I will try this out. If it works, I will mark your answer as right. Thanks!
Can't figure out how to make net beans use anything other than JDK7.
You should probably check the option of using bat file I mentioned my answer , bat file is guaranteed to run on windows machine. You can verify that Java is installed with jre7 in bat file and launch your program.
The problem is, this app needs to be multiplatform and I don't want to make a different batch for each. Do you see my dilemma?
I really just need to know what I change in order to compile the program correctly using net beans. Thank you for the help though.
|

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.