Skip to main content

"CurrentVersion" bug?

8 replies [Last post]
cowwoc
Offline
Joined: 2003-08-24
Points: 0

Hi,

I'm looking at the documentation here: http://java.sun.com/j2se/1.4.2/runtime_win32.html

and in one section it says:

"Note that CurrentVersion is set only if the version being installed is the highest version number on the machine."

and a few paragraphs later it says:

"Note that the CurrentVersion registry value is that of the most recently installed Java RE."

These two paragraph seem to contradict themselves. Which one is correct?

Gili

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
cowwoc
Offline
Joined: 2003-08-24
Points: 0

A related question is:

If you have JRE 1.5.0_01 installed, there doesn't seem to be a way to pick up the "01" version from the registry. This is problematic because I know of at least one bug that was fixed in a _XX revision number that I need to be able to detect at runtime. My product relies upon a certain _XX revision being installed and without being able to detect it, the user might end up running the wrong JRE and the code will not run as expected.

Ideas?

Gili

billyh
Offline
Joined: 2004-12-20
Points: 0

The 2nd reference to the "CurrentVersion" is incorrect. Whichever is the latest version of java on the system, that will be the current version. It should not matter which order you install the jre's. However, there was a bug in some old 1.3 releases where it would become the default java regardless of what was already installed. This should not happen with 1.4 going forward. I will make sure that documentation changes this.

To check where 1.5.0_01 is installed, you just need to check this registry key:

HKLM/Software/JavaSoft/Java Runtime Environment/1.5.0_01

cowwoc
Offline
Joined: 2003-08-24
Points: 0

> To check where 1.5.0_01 is installed, you just need
> to check this registry key:
>
> HKLM/Software/JavaSoft/Java Runtime
> Environment/1.5.0_01

Billyh,

I am expecting HKLM/Software/JavaSoft/Java Runtime Environment/CurrentVersion to contain "1.5.0_01" instead of "1.5". Both sub-keys exist, so why doesn't CurrentVersion refer to the latest one?

I want to know if the user has 1.5.0_01 or higher. Am I supposed to walk through *all* sub-keys of HKLM/Software/JavaSoft/Java Runtime Environment to figure out if one of them is equal to or newer than 1.5.0_01? Isn't there an easier way?

Gili

stanleyh
Offline
Joined: 2004-02-02
Points: 0

For historical reason, HKLM/Software/JavaSoft/Java Runtime Environment/CurrentVersion was generally set to the latest family version (i.e. MAJOR.MINOR, e.g. 1.5) instead of specific version like 1.5.0_01.

> I want to know if the user has 1.5.0_01 or higher. Am
> I supposed to walk through *all* sub-keys of
> HKLM/Software/JavaSoft/Java Runtime Environment to
> figure out if one of them is equal to or newer than
> 1.5.0_01? Isn't there an easier way?
>
> Gili

Walking the sub-keys of "HKLM/Software/JavaSoft/Java Runtime Environment" is probably the easiest way to
get what you want.

Stanley Ho
J2SE Deployment

zhwxia
Offline
Joined: 2004-10-24
Points: 0

How can I change current JRE version "1.5" to older version "1.4"?
On my Windows 2000 system, both JRE 1.5 and 1.4 are installed, and HKLM/Software/JavaSoft/Java Runtime Environment/CurrentVersion is "1.5", then I set it to "1.4". When I start ant which support 1.4, print out following messege:
Registry key 'Software\JavaSoft\Java Runtime Environment\CurrentVersion
has value '1.4', but '1.5' is required.
Error: could not find java.dll
Error: could not find Java 2 Runtime Environment.

Thanks

billyh
Offline
Joined: 2004-12-20
Points: 0

How are you deploying your application? Are you using java plugin, java webstart, or a standalone approach?

If standalone, don't just use the java.exe in the system directory. Find the location of the java.exe you desire through the registry, and run java.exe directly from the bin directory of whereever it is installed.

bino_george
Offline
Joined: 2003-06-16
Points: 0

Hi Gili,

> "Note that CurrentVersion is set only if the version
> being installed is the highest version number on the
> machine."
>
> and a few paragraphs later it says:
>
> "Note that the CurrentVersion registry value is that
> of the most recently installed Java RE."
>
> These two paragraph seem to contradict themselves.
> Which one is correct?

I have asked Stanley to answer this one. He should be
able to straighten it out. Thanks,

Regards,
Bino.

Message was edited by: bino_george

lakhiii
Offline
Joined: 2013-01-12
Points: 0

Since this thread.... stopped, I just want to share and answer your question

Java intend to use the recent installed JRE in Current Version, I tried it out in Jre7 (Previous installed JRE) and Java 1.3.0_01 (Current). the Current Version looks for 1.3 and is tagged as "required", although I still haven't seen a solution on how to change it, where we could set the java runtime to a different one not depending on its "recently installed Java RE.

Appreciate any solutions.