What happens if you have older java?
Author |
Message |
facultyofmusic
![](http://compsci.ca/v3/uploads/user_avatars/15137545114a8c72a6dc7e5.gif)
|
Posted: Sun Apr 11, 2010 9:36 am Post subject: What happens if you have older java? |
|
|
I've never actually encountered this before, and I really want to know. What exactly happens if your program is written, say, using JDK 6, and a client has Java 5 running on their machine. What exactly happens if they try to run your code? do they get an error message saying that you must upgrade to a newer version of java? or do they just give give you some sort of exception? |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Insectoid
![](http://compsci.ca/v3/uploads/user_avatars/13760332514cbd0ce972eaa.jpg)
|
Posted: Sun Apr 11, 2010 9:56 am Post subject: RE:What happens if you have older java? |
|
|
Then they have to update. No excuse for old runtime environments. |
|
|
|
|
![](images/spacer.gif) |
DemonWasp
|
Posted: Sun Apr 11, 2010 2:10 pm Post subject: RE:What happens if you have older java? |
|
|
What I've seen is generally something like a "Class Version Error". The code generally won't run (which is, I suppose, better than running incorrectly).
Some versions of Java are forwards-compatible enough that, for example, running Java 5 code on Java 1.4.2 JREs should work in most cases.
There are a few legitimate reasons to want to use an older JVM for older software (because classes can be deprecated and then removed, so older software might not work). However, it is possible to have more than one JVM on a machine at the same time, so you can easily run one application in one, and the other in the other.
It is worth noting that Java on OSX has, in the past, been a version behind because of some silly hangup - though I don't recall whether that was Apple's fault or SUN's. |
|
|
|
|
![](images/spacer.gif) |
facultyofmusic
![](http://compsci.ca/v3/uploads/user_avatars/15137545114a8c72a6dc7e5.gif)
|
Posted: Sun Apr 11, 2010 7:04 pm Post subject: Re: What happens if you have older java? |
|
|
Because the thing is, i'm making a game using Java 1.6. And I haven't tested it on any other machine but my own. I'm planning to let my friends test them but i don't know if they have the latest version of Java. I'm just curious what the error message will be. Because I don't know any language other than java and I don't know anyways of telling the user that he/she may need to upgrade their java environment. |
|
|
|
|
![](images/spacer.gif) |
DemonWasp
|
Posted: Sun Apr 11, 2010 10:10 pm Post subject: RE:What happens if you have older java? |
|
|
Typically, your application will have a launcher (usually a .exe or .bat for windows, or a .sh for Linux). That should be able to detect the local version of Java, compare it to a minimum, and then determine whether to proceed or output an error message. If you just try running the app without checking, it should complain. |
|
|
|
|
![](images/spacer.gif) |
TheGuardian001
|
Posted: Sun Apr 11, 2010 10:26 pm Post subject: Re: What happens if you have older java? |
|
|
WinRar is able to package files into Windows .exe installers, as well as autorun certain files on extraction. You can package the JRE installer with your program using WinRar, then tell it to run the JRE installer when your program installer is run. I don't remember the exact settings you need though...
That's the best solution I've been able to find so far. Unfortunately not cross platform, but it's a good start. When they install your program, the JRE you need them to have comes packaged with it.
I'm sure that similar solutions exist for Mac and Linux, however I don't know offhand what you could use to do it for those systems. |
|
|
|
|
![](images/spacer.gif) |
Dan
![](http://wiki.compsci.ca/images/archive/3/3c/20100325043407!Danspic.gif)
|
Posted: Mon Apr 12, 2010 9:22 am Post subject: RE:What happens if you have older java? |
|
|
It is possible to programticly check the java version from with in java and show an error to the user.
For example: http://www.java2s.com/Code/Java/Development-Class/CheckVersion.htm
Also some types of java bundles (such as OSGi bundles) allow you to specify the required JRE, package dependencies and dependency versions.
You cloud in theory make your game only using the older classes and not use collections but i have to agree with Insectoid that users should be keeping there JRE up to date. |
Computer Science Canada
Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more! |
|
|
|
![](images/spacer.gif) |
facultyofmusic
![](http://compsci.ca/v3/uploads/user_avatars/15137545114a8c72a6dc7e5.gif)
|
Posted: Mon Apr 12, 2010 2:05 pm Post subject: Re: What happens if you have older java? |
|
|
Thanks dan yourreply. I actually never knew about that functionality in java. What I think now is that I'll writ my installer in an older version of java (perhaps 1.4) and check the version. If the user doesn't have the corrent one, then I'll run the JRE 6 installer. Then install my game. I'l have to assume then that the user have at least ava 1.4, whic is quite reasonable to assume. |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
|
|