Results 1 to 9 of 9
Like Tree1Likes
  • 1 Post By kneitzel

Thread: Updating Java Version And The Horror

  1. #1
    8foldpath is offline Member
    Join Date
    Feb 2014
    Location
    Australia
    Posts
    9
    Rep Power
    0

    Unhappy Updating Java Version And The Horror

    C:\Program Files\Java has 4 folders, jdk1.6.0_21, jdk1.7.0_05, jdk1.7.0_25 and jre7

    For some reason I also have C:\Program Files (x86)\Java\jre7

    I have checked
    java -version
    and its using 1.7.0_05

    I've also checked in eclipse

    public class JavaVersion
    {
    public static void main(String[] args)
    {
    System.out.println(System.getProperty("java.runtim e.version"));
    }
    }
    And I get: 1.7.0_05-b05

    User Var set to: C:\Program Files\Java\jdk1.7.0_25\jre Name: JAVA_HOME

    System Var set to: %JAVA_HOME%\bin; var name: JAVA_HOME

    Can anyone see anything I am doing wrong?

  2. #2
    kneitzel is offline Senior Member
    Join Date
    Feb 2014
    Posts
    447
    Rep Power
    1

    Default Re: Updating Java Version And The Horror

    HI,

    I am not fully aware what you want to do.

    a) Installations of Java
    You can have multiple versions of java in parallel. That is no problem at all (from my experience).
    On 64 Bit windows systems, the 64 bit installation is done inside c:\program files. If you install a 32bit version, it is installed in c:\program files (x86) (which is c:\program files for a 32 Bit process. Windows is mapping some areas around. That can be confusing.)
    Not sure, but maybe the x86 version was installed so the x86 IE (that is mostly used on 64 bit windows systems because most addons are still 32bit only) has a Java plugin. But that is guessing now because I never played around with java pluigins.

    b) Deciding which Java to use

    Calling a java application:
    From my experience, it is simply enough to directly call the java that you want to use. This could be done by setting the path. (There are more things, too. Older javas was placing a java.exe and so inside the system32 directory and environment ariables like Java_Home and such things. But from my experience, simply calling the java executable you want is already enough.)

    Java Plugin:
    On windows you can select which java schould be active inside the Browser through a control inside the control center of windows.

    Eclipse:
    In Eclipse you can configure which java versions are available and which Java should be used. This could be done globaly or even on a per project setting. You can check:
    Preferences -> Java -> Installed JREs and add installed JREs/JDKs there.
    Preferences -> Java -> Compiler to set the compliance setting to use. (So if you want to develop with 1.7 and use all features then you should set it to 1.7, too. (But it is not a setting which compiler it will use. It is just a compliance setting.)

    Did I cover the area where you was unsure? Or do you need more information on a topic?

    With kind regards,

    Konrad
    8foldpath likes this.

  3. #3
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,157
    Rep Power
    6

    Default Re: Updating Java Version And The Horror

    Check the eclipse.ini, probably it contains a -vm line which points directly to the runtime you don't want it to use; fix the ini file by hand.

    And a little side note: you like so many others make the wrong assumption that the JAVA_HOME variable is actually important - it is not. It is sometimes used by startup scripts of certain third party products to know which runtime/jdk to use when you don't manually specify one.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  4. #4
    jashburn is offline Senior Member
    Join Date
    Feb 2014
    Posts
    219
    Rep Power
    1

    Default Re: Updating Java Version And The Horror

    My first question is why are there multiple Java (JDK and JRE) installations on the first place? From a user perspective (I work with customer end-users a lot over many years), this can sometimes lead to unexpected behaviour especially when it comes to the Java plugin in browser.

    If your Java installations are for non-Java plugin-related usage, e.g., for code compilation and testing/running Java applications, then you should be fine. Otherwise I'd suggest uninstalling all of them, and install just 1 version. Besides, you need to make sure you update your Java installation regularly to patch the many Java security issues found these days.

  5. #5
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,157
    Rep Power
    6

    Default Re: Updating Java Version And The Horror

    Well generally I have my 64 bits JDK (which includes a runtime) and I separately install a 32 bits runtime for the browser plugins that I need once a month. For a development machine it is not that uncommon.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  6. #6
    jashburn is offline Senior Member
    Join Date
    Feb 2014
    Posts
    219
    Rep Power
    1

    Default Re: Updating Java Version And The Horror

    Quote Originally Posted by gimbal2 View Post
    Well generally I have my 64 bits JDK (which includes a runtime) and I separately install a 32 bits runtime for the browser plugins that I need once a month. For a development machine it is not that uncommon.
    Yup, that's a fair enough usage scenario for us developers.

  7. #7
    8foldpath is offline Member
    Join Date
    Feb 2014
    Location
    Australia
    Posts
    9
    Rep Power
    0

    Default Re: Updating Java Version And The Horror

    Well I assumed that updating the windows variables e.g.

    User Var set to: C:\Program Files\Java\jdk1.7.0_25\jre Name: JAVA_HOME

    System Var set to: %JAVA_HOME%\bin; var name: JAVA_HOME

    Would change the version displayed in the CL to the new version much like e.g. PATH=%PATH%;"C:\path" would, but permanently.

    In Regards to eclipse I didn't think about selecting the JDK used when creating a new project. That works fine. I needed to updated to the latest JDK so I could use JavaFX in eclipse, thanks kneitzel.


    And a little side note: you like so many others make the wrong assumption that the JAVA_HOME variable is actually important - it is not. It is sometimes used by startup scripts of certain third party products to know which runtime/jdk to use when you don't manually specify one.
    You may very well be right. How then would I chose which java version is being used in the CL without having to use the path command first(Each time I open the CL)?

  8. #8
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,157
    Rep Power
    6

    Default Re: Updating Java Version And The Horror

    For the command line what you are doing looks fine. Where are you setting the variables? In the dialog that you get when you press the windows key + pause buttons? (the system panel -> advanced system settings -> environmental variables) That's the only way to make them permanent.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  9. #9
    8foldpath is offline Member
    Join Date
    Feb 2014
    Location
    Australia
    Posts
    9
    Rep Power
    0

    Default Re: Updating Java Version And The Horror

    Yes that is indeed where I am setting them.

    I guess it does not matter to much as %99.9 of the time I am just using the Eclipse IDE anywhoo.

Similar Threads

  1. java -version pointing to older version
    By deepakts in forum New To Java
    Replies: 4
    Last Post: 05-06-2010, 10:59 AM
  2. Button Game horror
    By MartinBenes71 in forum New To Java
    Replies: 3
    Last Post: 01-24-2010, 06:20 AM
  3. Updating the application (version) by J2ME. URGENT!!!
    By maruffaiz in forum CLDC and MIDP
    Replies: 1
    Last Post: 08-07-2009, 12:46 PM
  4. Problems updating SWT/JFACE version
    By Rafael in forum SWT / JFace
    Replies: 0
    Last Post: 10-21-2008, 06:00 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •