Why is java -version returning a different version to the one defined in JAVA_HOME? The Next...

Can a PhD from a non-TU9 German university become a professor in a TU9 university?

Is this a new Fibonacci Identity?

Find the majority element, which appears more than half the time

How to show a landlord what we have in savings?

Which acid/base does a strong base/acid react when added to a buffer solution?

Is a distribution that is normal, but highly skewed, considered Gaussian?

Small nick on power cord from an electric alarm clock, and copper wiring exposed but intact

Prodigo = pro + ago?

Compensation for working overtime on Saturdays

Is it possible to create a QR code using text?

Is it "common practice in Fourier transform spectroscopy to multiply the measured interferogram by an apodizing function"? If so, why?

How to compactly explain secondary and tertiary characters without resorting to stereotypes?

Traveling with my 5 year old daughter (as the father) without the mother from Germany to Mexico

Another proof that dividing by 0 does not exist -- is it right?

Is it a bad idea to plug the other end of ESD strap to wall ground?

What steps are necessary to read a Modern SSD in Medieval Europe?

Incomplete cube

Can this transistor (2N2222) take 6 V on emitter-base? Am I reading the datasheet incorrectly?

Is there a rule of thumb for determining the amount one should accept for a settlement offer?

What is a typical Mizrachi Seder like?

Was the Stack Exchange "Happy April Fools" page fitting with the 90s code?

Oldie but Goldie

pgfplots: How to draw a tangent graph below two others?

Find a path from s to t using as few red nodes as possible



Why is java -version returning a different version to the one defined in JAVA_HOME?



The Next CEO of Stack OverflowWhy java -version returning a different version than the one defined in JAVA_HOME?how to set default java plug-in versionCan't upgrade to JRE 1.6 from 1.4.2Changing current version of Java within Windowsinstalling jdk1.7.0 on Ubuntu 11.04 machinejdk 7 not activeWindows Java-based apps not workingIncorrect java -version on command promptArduino IDE won't launch in Windows 8.1How to change Java version on Windows 10On Windows, why java -version return Error: opening registry key 'SoftwareJavaSoftJava Runtime Environment'?












16















My JAVA_HOME is set to C:beajdk150_10bin (Java 1.5). However, when I run java -version I get the following:



java version "1.6.0_22"
Java(TM) SE Runtime Environment (build 1.6.0_22-b04)
Java HotSpot(TM) Client VM (build 17.1-b03, mixed mode, sharing)


How can I use the 1.5 version?










share|improve this question





























    16















    My JAVA_HOME is set to C:beajdk150_10bin (Java 1.5). However, when I run java -version I get the following:



    java version "1.6.0_22"
    Java(TM) SE Runtime Environment (build 1.6.0_22-b04)
    Java HotSpot(TM) Client VM (build 17.1-b03, mixed mode, sharing)


    How can I use the 1.5 version?










    share|improve this question



























      16












      16








      16


      3






      My JAVA_HOME is set to C:beajdk150_10bin (Java 1.5). However, when I run java -version I get the following:



      java version "1.6.0_22"
      Java(TM) SE Runtime Environment (build 1.6.0_22-b04)
      Java HotSpot(TM) Client VM (build 17.1-b03, mixed mode, sharing)


      How can I use the 1.5 version?










      share|improve this question
















      My JAVA_HOME is set to C:beajdk150_10bin (Java 1.5). However, when I run java -version I get the following:



      java version "1.6.0_22"
      Java(TM) SE Runtime Environment (build 1.6.0_22-b04)
      Java HotSpot(TM) Client VM (build 17.1-b03, mixed mode, sharing)


      How can I use the 1.5 version?







      windows java






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Aug 23 '11 at 6:56









      3498DB

      15.8k114862




      15.8k114862










      asked Jan 25 '11 at 19:07









      JeuneJeune

      2051210




      2051210






















          10 Answers
          10






          active

          oldest

          votes


















          17














          As Mikel has mentioned, In your machine java is taken from C:WindowsSystem32java.exe.



          Change the Path in the System Environment variables as mentioned by John T.



          And modify it have the C:beajdk150_10bin before %SystemRoot%system32 in the path.






          share|improve this answer

































            13














            Run



            where java


            at your command prompt.



            On my system, it printed something quite unexpected:



            C:UsersMikel>where java
            C:WindowsSystem32java.exe


            Verifying there really is a Java there:



            C:UsersMikel>c:windowssystem32java.exe -version
            java version "1.6.0_22"
            Java(TM) SE Runtime Environment (build 1.6.0_22-b04)
            Java HotSpot(TM) Client VM (build 17.1-b03, mixed mode, sharing)


            So one solution is to ensure your preferred Java is in the PATH before C:WindowsSystem32.



            I also tried looking in the Java control panel to see if it manages the version in C:WindowsSystem32, but I could only view the settings, not edit them. Maybe it works for you?






            share|improve this answer

































              8














              Modify the PATH variable, not JAVA_HOME.



              See the Java documentation on setting or changing your PATH variable.





              1. Start -> Control Panel -> System -> Advanced


              2. Click on Environment Variables, under System Variables, find PATH, and click on it.


              3. In the Edit windows, modify PATH by adding the location of the class to the value for PATH. If you do not have the item PATH, you may select to add a new variable and add PATH as the name and the location of the class as the value.


              4. Close the window.


              5. Reopen Command prompt window, and run your Java code.








              share|improve this answer


























              • I don't see any references to jdk 6 on the PATH variable either. Only Java 5 X)

                – Jeune
                Jan 25 '11 at 19:29











              • It's an example, the procedure is still the same..

                – John T
                Jan 25 '11 at 19:31



















              4














              Not all applications use JAVA_HOME to get the JDK version. As said before, some of them use the %SystemRoot%System32java.exe. You can do %SystemRoot%java.exe -version to see which is that version.



              What I have to add to the other responses is that if you build with Maven, M2_HOMEbin has also to be before %SystemRoot% in the order for Maven to use the correct JAVA_HOME version.






              share|improve this answer

































                1














                JAVA_HOME should not be pointing to the bin!



                SET "JAVA_HOME=C:beajdk150_10"
                SET "PATH=%JAVA_HOME%/bin;%PATH%"



                Also make sure that the path to JAVA_HOME is correct! If there's a typo and C:WindowsSystem32 is in you path then that java.exe will get run instead of the one you specified.






                share|improve this answer































                  0














                  For me on win 10, javac -version showed java7 and java -version showed java8.Doing "where java" on command prompt showed java at three locations. I had to remove Java from C:WindowsSystem32, Remove entry of "C:ProgramFileOracleJavajavapath"and "C:ProgramDataOracleJava" from path variable, keep only Jdk7 entry in path variable worked after two hour long struggle.






                  share|improve this answer































                    0














                    Go to advanced settings of environment variables and edit the path variable. whichever version of java you want just move up that versions path above all other environment variables of other java versions.



                    here in the image java_home environment variable is moved up than oracle java environment






                    share|improve this answer










                    New contributor




                    nikita dharurkar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                    Check out our Code of Conduct.




























                      -1














                      Try this:



                      @echo off
                      DOSKEY WHICH=@for %%E in (%PATHEXT%) do @for %%I in ($*%%E) do @if NOT "%%~$PATH:I"=="" echo %%~$PATH:I
                      SET "JAVA_HOME=C:Javajdk1.6"
                      SET "PATH=%JAVA_HOME%bin;%PATH%"
                      where.exe java
                      WHICH java
                      pause





                      share|improve this answer































                        -2














                        I was facing the same issue. Later I found that the culprit was Java 8.Earlier I installed java 8 but now there is no folder for java 8 and my JAVA_HOME set to jre7 but still I was facing above issue.



                        solution



                        I deleted javapath present in C:ProgramDataOracleJava. Now my system working properly. It also resolved my eclipse startup problem.






                        share|improve this answer































                          -2














                          I had the same issue. Doing this I resolved the issue.



                          On Windows 8 or 10, you need to remove "C:ProgramFileOracleJavajavapath" from path in environment variable.



                          This may resolve the issue.






                          share|improve this answer



















                          • 2





                            This has been suggested already, 2 years ago

                            – Ramhound
                            Jan 28 '18 at 3:43














                          Your Answer








                          StackExchange.ready(function() {
                          var channelOptions = {
                          tags: "".split(" "),
                          id: "3"
                          };
                          initTagRenderer("".split(" "), "".split(" "), channelOptions);

                          StackExchange.using("externalEditor", function() {
                          // Have to fire editor after snippets, if snippets enabled
                          if (StackExchange.settings.snippets.snippetsEnabled) {
                          StackExchange.using("snippets", function() {
                          createEditor();
                          });
                          }
                          else {
                          createEditor();
                          }
                          });

                          function createEditor() {
                          StackExchange.prepareEditor({
                          heartbeatType: 'answer',
                          autoActivateHeartbeat: false,
                          convertImagesToLinks: true,
                          noModals: true,
                          showLowRepImageUploadWarning: true,
                          reputationToPostImages: 10,
                          bindNavPrevention: true,
                          postfix: "",
                          imageUploader: {
                          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
                          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
                          allowUrls: true
                          },
                          onDemand: true,
                          discardSelector: ".discard-answer"
                          ,immediatelyShowMarkdownHelp:true
                          });


                          }
                          });














                          draft saved

                          draft discarded


















                          StackExchange.ready(
                          function () {
                          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f237737%2fwhy-is-java-version-returning-a-different-version-to-the-one-defined-in-java-ho%23new-answer', 'question_page');
                          }
                          );

                          Post as a guest















                          Required, but never shown

























                          10 Answers
                          10






                          active

                          oldest

                          votes








                          10 Answers
                          10






                          active

                          oldest

                          votes









                          active

                          oldest

                          votes






                          active

                          oldest

                          votes









                          17














                          As Mikel has mentioned, In your machine java is taken from C:WindowsSystem32java.exe.



                          Change the Path in the System Environment variables as mentioned by John T.



                          And modify it have the C:beajdk150_10bin before %SystemRoot%system32 in the path.






                          share|improve this answer






























                            17














                            As Mikel has mentioned, In your machine java is taken from C:WindowsSystem32java.exe.



                            Change the Path in the System Environment variables as mentioned by John T.



                            And modify it have the C:beajdk150_10bin before %SystemRoot%system32 in the path.






                            share|improve this answer




























                              17












                              17








                              17







                              As Mikel has mentioned, In your machine java is taken from C:WindowsSystem32java.exe.



                              Change the Path in the System Environment variables as mentioned by John T.



                              And modify it have the C:beajdk150_10bin before %SystemRoot%system32 in the path.






                              share|improve this answer















                              As Mikel has mentioned, In your machine java is taken from C:WindowsSystem32java.exe.



                              Change the Path in the System Environment variables as mentioned by John T.



                              And modify it have the C:beajdk150_10bin before %SystemRoot%system32 in the path.







                              share|improve this answer














                              share|improve this answer



                              share|improve this answer








                              edited Mar 20 '17 at 10:17









                              Community

                              1




                              1










                              answered Jan 25 '11 at 23:13









                              lmeyyalmeyya

                              1862




                              1862

























                                  13














                                  Run



                                  where java


                                  at your command prompt.



                                  On my system, it printed something quite unexpected:



                                  C:UsersMikel>where java
                                  C:WindowsSystem32java.exe


                                  Verifying there really is a Java there:



                                  C:UsersMikel>c:windowssystem32java.exe -version
                                  java version "1.6.0_22"
                                  Java(TM) SE Runtime Environment (build 1.6.0_22-b04)
                                  Java HotSpot(TM) Client VM (build 17.1-b03, mixed mode, sharing)


                                  So one solution is to ensure your preferred Java is in the PATH before C:WindowsSystem32.



                                  I also tried looking in the Java control panel to see if it manages the version in C:WindowsSystem32, but I could only view the settings, not edit them. Maybe it works for you?






                                  share|improve this answer






























                                    13














                                    Run



                                    where java


                                    at your command prompt.



                                    On my system, it printed something quite unexpected:



                                    C:UsersMikel>where java
                                    C:WindowsSystem32java.exe


                                    Verifying there really is a Java there:



                                    C:UsersMikel>c:windowssystem32java.exe -version
                                    java version "1.6.0_22"
                                    Java(TM) SE Runtime Environment (build 1.6.0_22-b04)
                                    Java HotSpot(TM) Client VM (build 17.1-b03, mixed mode, sharing)


                                    So one solution is to ensure your preferred Java is in the PATH before C:WindowsSystem32.



                                    I also tried looking in the Java control panel to see if it manages the version in C:WindowsSystem32, but I could only view the settings, not edit them. Maybe it works for you?






                                    share|improve this answer




























                                      13












                                      13








                                      13







                                      Run



                                      where java


                                      at your command prompt.



                                      On my system, it printed something quite unexpected:



                                      C:UsersMikel>where java
                                      C:WindowsSystem32java.exe


                                      Verifying there really is a Java there:



                                      C:UsersMikel>c:windowssystem32java.exe -version
                                      java version "1.6.0_22"
                                      Java(TM) SE Runtime Environment (build 1.6.0_22-b04)
                                      Java HotSpot(TM) Client VM (build 17.1-b03, mixed mode, sharing)


                                      So one solution is to ensure your preferred Java is in the PATH before C:WindowsSystem32.



                                      I also tried looking in the Java control panel to see if it manages the version in C:WindowsSystem32, but I could only view the settings, not edit them. Maybe it works for you?






                                      share|improve this answer















                                      Run



                                      where java


                                      at your command prompt.



                                      On my system, it printed something quite unexpected:



                                      C:UsersMikel>where java
                                      C:WindowsSystem32java.exe


                                      Verifying there really is a Java there:



                                      C:UsersMikel>c:windowssystem32java.exe -version
                                      java version "1.6.0_22"
                                      Java(TM) SE Runtime Environment (build 1.6.0_22-b04)
                                      Java HotSpot(TM) Client VM (build 17.1-b03, mixed mode, sharing)


                                      So one solution is to ensure your preferred Java is in the PATH before C:WindowsSystem32.



                                      I also tried looking in the Java control panel to see if it manages the version in C:WindowsSystem32, but I could only view the settings, not edit them. Maybe it works for you?







                                      share|improve this answer














                                      share|improve this answer



                                      share|improve this answer








                                      edited Jan 25 '11 at 21:03

























                                      answered Jan 25 '11 at 20:52









                                      MikelMikel

                                      7,58913435




                                      7,58913435























                                          8














                                          Modify the PATH variable, not JAVA_HOME.



                                          See the Java documentation on setting or changing your PATH variable.





                                          1. Start -> Control Panel -> System -> Advanced


                                          2. Click on Environment Variables, under System Variables, find PATH, and click on it.


                                          3. In the Edit windows, modify PATH by adding the location of the class to the value for PATH. If you do not have the item PATH, you may select to add a new variable and add PATH as the name and the location of the class as the value.


                                          4. Close the window.


                                          5. Reopen Command prompt window, and run your Java code.








                                          share|improve this answer


























                                          • I don't see any references to jdk 6 on the PATH variable either. Only Java 5 X)

                                            – Jeune
                                            Jan 25 '11 at 19:29











                                          • It's an example, the procedure is still the same..

                                            – John T
                                            Jan 25 '11 at 19:31
















                                          8














                                          Modify the PATH variable, not JAVA_HOME.



                                          See the Java documentation on setting or changing your PATH variable.





                                          1. Start -> Control Panel -> System -> Advanced


                                          2. Click on Environment Variables, under System Variables, find PATH, and click on it.


                                          3. In the Edit windows, modify PATH by adding the location of the class to the value for PATH. If you do not have the item PATH, you may select to add a new variable and add PATH as the name and the location of the class as the value.


                                          4. Close the window.


                                          5. Reopen Command prompt window, and run your Java code.








                                          share|improve this answer


























                                          • I don't see any references to jdk 6 on the PATH variable either. Only Java 5 X)

                                            – Jeune
                                            Jan 25 '11 at 19:29











                                          • It's an example, the procedure is still the same..

                                            – John T
                                            Jan 25 '11 at 19:31














                                          8












                                          8








                                          8







                                          Modify the PATH variable, not JAVA_HOME.



                                          See the Java documentation on setting or changing your PATH variable.





                                          1. Start -> Control Panel -> System -> Advanced


                                          2. Click on Environment Variables, under System Variables, find PATH, and click on it.


                                          3. In the Edit windows, modify PATH by adding the location of the class to the value for PATH. If you do not have the item PATH, you may select to add a new variable and add PATH as the name and the location of the class as the value.


                                          4. Close the window.


                                          5. Reopen Command prompt window, and run your Java code.








                                          share|improve this answer















                                          Modify the PATH variable, not JAVA_HOME.



                                          See the Java documentation on setting or changing your PATH variable.





                                          1. Start -> Control Panel -> System -> Advanced


                                          2. Click on Environment Variables, under System Variables, find PATH, and click on it.


                                          3. In the Edit windows, modify PATH by adding the location of the class to the value for PATH. If you do not have the item PATH, you may select to add a new variable and add PATH as the name and the location of the class as the value.


                                          4. Close the window.


                                          5. Reopen Command prompt window, and run your Java code.









                                          share|improve this answer














                                          share|improve this answer



                                          share|improve this answer








                                          edited Aug 23 '11 at 22:50









                                          Tom Wijsman

                                          50.4k24164247




                                          50.4k24164247










                                          answered Jan 25 '11 at 19:09









                                          John TJohn T

                                          144k20295331




                                          144k20295331













                                          • I don't see any references to jdk 6 on the PATH variable either. Only Java 5 X)

                                            – Jeune
                                            Jan 25 '11 at 19:29











                                          • It's an example, the procedure is still the same..

                                            – John T
                                            Jan 25 '11 at 19:31



















                                          • I don't see any references to jdk 6 on the PATH variable either. Only Java 5 X)

                                            – Jeune
                                            Jan 25 '11 at 19:29











                                          • It's an example, the procedure is still the same..

                                            – John T
                                            Jan 25 '11 at 19:31

















                                          I don't see any references to jdk 6 on the PATH variable either. Only Java 5 X)

                                          – Jeune
                                          Jan 25 '11 at 19:29





                                          I don't see any references to jdk 6 on the PATH variable either. Only Java 5 X)

                                          – Jeune
                                          Jan 25 '11 at 19:29













                                          It's an example, the procedure is still the same..

                                          – John T
                                          Jan 25 '11 at 19:31





                                          It's an example, the procedure is still the same..

                                          – John T
                                          Jan 25 '11 at 19:31











                                          4














                                          Not all applications use JAVA_HOME to get the JDK version. As said before, some of them use the %SystemRoot%System32java.exe. You can do %SystemRoot%java.exe -version to see which is that version.



                                          What I have to add to the other responses is that if you build with Maven, M2_HOMEbin has also to be before %SystemRoot% in the order for Maven to use the correct JAVA_HOME version.






                                          share|improve this answer






























                                            4














                                            Not all applications use JAVA_HOME to get the JDK version. As said before, some of them use the %SystemRoot%System32java.exe. You can do %SystemRoot%java.exe -version to see which is that version.



                                            What I have to add to the other responses is that if you build with Maven, M2_HOMEbin has also to be before %SystemRoot% in the order for Maven to use the correct JAVA_HOME version.






                                            share|improve this answer




























                                              4












                                              4








                                              4







                                              Not all applications use JAVA_HOME to get the JDK version. As said before, some of them use the %SystemRoot%System32java.exe. You can do %SystemRoot%java.exe -version to see which is that version.



                                              What I have to add to the other responses is that if you build with Maven, M2_HOMEbin has also to be before %SystemRoot% in the order for Maven to use the correct JAVA_HOME version.






                                              share|improve this answer















                                              Not all applications use JAVA_HOME to get the JDK version. As said before, some of them use the %SystemRoot%System32java.exe. You can do %SystemRoot%java.exe -version to see which is that version.



                                              What I have to add to the other responses is that if you build with Maven, M2_HOMEbin has also to be before %SystemRoot% in the order for Maven to use the correct JAVA_HOME version.







                                              share|improve this answer














                                              share|improve this answer



                                              share|improve this answer








                                              edited Aug 23 '11 at 22:48









                                              Tom Wijsman

                                              50.4k24164247




                                              50.4k24164247










                                              answered Aug 23 '11 at 6:50









                                              Mihai RusMihai Rus

                                              411




                                              411























                                                  1














                                                  JAVA_HOME should not be pointing to the bin!



                                                  SET "JAVA_HOME=C:beajdk150_10"
                                                  SET "PATH=%JAVA_HOME%/bin;%PATH%"



                                                  Also make sure that the path to JAVA_HOME is correct! If there's a typo and C:WindowsSystem32 is in you path then that java.exe will get run instead of the one you specified.






                                                  share|improve this answer




























                                                    1














                                                    JAVA_HOME should not be pointing to the bin!



                                                    SET "JAVA_HOME=C:beajdk150_10"
                                                    SET "PATH=%JAVA_HOME%/bin;%PATH%"



                                                    Also make sure that the path to JAVA_HOME is correct! If there's a typo and C:WindowsSystem32 is in you path then that java.exe will get run instead of the one you specified.






                                                    share|improve this answer


























                                                      1












                                                      1








                                                      1







                                                      JAVA_HOME should not be pointing to the bin!



                                                      SET "JAVA_HOME=C:beajdk150_10"
                                                      SET "PATH=%JAVA_HOME%/bin;%PATH%"



                                                      Also make sure that the path to JAVA_HOME is correct! If there's a typo and C:WindowsSystem32 is in you path then that java.exe will get run instead of the one you specified.






                                                      share|improve this answer













                                                      JAVA_HOME should not be pointing to the bin!



                                                      SET "JAVA_HOME=C:beajdk150_10"
                                                      SET "PATH=%JAVA_HOME%/bin;%PATH%"



                                                      Also make sure that the path to JAVA_HOME is correct! If there's a typo and C:WindowsSystem32 is in you path then that java.exe will get run instead of the one you specified.







                                                      share|improve this answer












                                                      share|improve this answer



                                                      share|improve this answer










                                                      answered Mar 2 '13 at 0:42









                                                      Bad KarmaBad Karma

                                                      111




                                                      111























                                                          0














                                                          For me on win 10, javac -version showed java7 and java -version showed java8.Doing "where java" on command prompt showed java at three locations. I had to remove Java from C:WindowsSystem32, Remove entry of "C:ProgramFileOracleJavajavapath"and "C:ProgramDataOracleJava" from path variable, keep only Jdk7 entry in path variable worked after two hour long struggle.






                                                          share|improve this answer




























                                                            0














                                                            For me on win 10, javac -version showed java7 and java -version showed java8.Doing "where java" on command prompt showed java at three locations. I had to remove Java from C:WindowsSystem32, Remove entry of "C:ProgramFileOracleJavajavapath"and "C:ProgramDataOracleJava" from path variable, keep only Jdk7 entry in path variable worked after two hour long struggle.






                                                            share|improve this answer


























                                                              0












                                                              0








                                                              0







                                                              For me on win 10, javac -version showed java7 and java -version showed java8.Doing "where java" on command prompt showed java at three locations. I had to remove Java from C:WindowsSystem32, Remove entry of "C:ProgramFileOracleJavajavapath"and "C:ProgramDataOracleJava" from path variable, keep only Jdk7 entry in path variable worked after two hour long struggle.






                                                              share|improve this answer













                                                              For me on win 10, javac -version showed java7 and java -version showed java8.Doing "where java" on command prompt showed java at three locations. I had to remove Java from C:WindowsSystem32, Remove entry of "C:ProgramFileOracleJavajavapath"and "C:ProgramDataOracleJava" from path variable, keep only Jdk7 entry in path variable worked after two hour long struggle.







                                                              share|improve this answer












                                                              share|improve this answer



                                                              share|improve this answer










                                                              answered Jun 4 '18 at 10:36









                                                              Sneha RathodSneha Rathod

                                                              11




                                                              11























                                                                  0














                                                                  Go to advanced settings of environment variables and edit the path variable. whichever version of java you want just move up that versions path above all other environment variables of other java versions.



                                                                  here in the image java_home environment variable is moved up than oracle java environment






                                                                  share|improve this answer










                                                                  New contributor




                                                                  nikita dharurkar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                                                  Check out our Code of Conduct.

























                                                                    0














                                                                    Go to advanced settings of environment variables and edit the path variable. whichever version of java you want just move up that versions path above all other environment variables of other java versions.



                                                                    here in the image java_home environment variable is moved up than oracle java environment






                                                                    share|improve this answer










                                                                    New contributor




                                                                    nikita dharurkar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                                                    Check out our Code of Conduct.























                                                                      0












                                                                      0








                                                                      0







                                                                      Go to advanced settings of environment variables and edit the path variable. whichever version of java you want just move up that versions path above all other environment variables of other java versions.



                                                                      here in the image java_home environment variable is moved up than oracle java environment






                                                                      share|improve this answer










                                                                      New contributor




                                                                      nikita dharurkar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                                                      Check out our Code of Conduct.










                                                                      Go to advanced settings of environment variables and edit the path variable. whichever version of java you want just move up that versions path above all other environment variables of other java versions.



                                                                      here in the image java_home environment variable is moved up than oracle java environment







                                                                      share|improve this answer










                                                                      New contributor




                                                                      nikita dharurkar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                                                      Check out our Code of Conduct.









                                                                      share|improve this answer



                                                                      share|improve this answer








                                                                      edited 1 hour ago









                                                                      Glorfindel

                                                                      1,49441220




                                                                      1,49441220






                                                                      New contributor




                                                                      nikita dharurkar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                                                      Check out our Code of Conduct.









                                                                      answered 1 hour ago









                                                                      nikita dharurkarnikita dharurkar

                                                                      1




                                                                      1




                                                                      New contributor




                                                                      nikita dharurkar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                                                      Check out our Code of Conduct.





                                                                      New contributor





                                                                      nikita dharurkar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                                                      Check out our Code of Conduct.






                                                                      nikita dharurkar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                                                      Check out our Code of Conduct.























                                                                          -1














                                                                          Try this:



                                                                          @echo off
                                                                          DOSKEY WHICH=@for %%E in (%PATHEXT%) do @for %%I in ($*%%E) do @if NOT "%%~$PATH:I"=="" echo %%~$PATH:I
                                                                          SET "JAVA_HOME=C:Javajdk1.6"
                                                                          SET "PATH=%JAVA_HOME%bin;%PATH%"
                                                                          where.exe java
                                                                          WHICH java
                                                                          pause





                                                                          share|improve this answer




























                                                                            -1














                                                                            Try this:



                                                                            @echo off
                                                                            DOSKEY WHICH=@for %%E in (%PATHEXT%) do @for %%I in ($*%%E) do @if NOT "%%~$PATH:I"=="" echo %%~$PATH:I
                                                                            SET "JAVA_HOME=C:Javajdk1.6"
                                                                            SET "PATH=%JAVA_HOME%bin;%PATH%"
                                                                            where.exe java
                                                                            WHICH java
                                                                            pause





                                                                            share|improve this answer


























                                                                              -1












                                                                              -1








                                                                              -1







                                                                              Try this:



                                                                              @echo off
                                                                              DOSKEY WHICH=@for %%E in (%PATHEXT%) do @for %%I in ($*%%E) do @if NOT "%%~$PATH:I"=="" echo %%~$PATH:I
                                                                              SET "JAVA_HOME=C:Javajdk1.6"
                                                                              SET "PATH=%JAVA_HOME%bin;%PATH%"
                                                                              where.exe java
                                                                              WHICH java
                                                                              pause





                                                                              share|improve this answer













                                                                              Try this:



                                                                              @echo off
                                                                              DOSKEY WHICH=@for %%E in (%PATHEXT%) do @for %%I in ($*%%E) do @if NOT "%%~$PATH:I"=="" echo %%~$PATH:I
                                                                              SET "JAVA_HOME=C:Javajdk1.6"
                                                                              SET "PATH=%JAVA_HOME%bin;%PATH%"
                                                                              where.exe java
                                                                              WHICH java
                                                                              pause






                                                                              share|improve this answer












                                                                              share|improve this answer



                                                                              share|improve this answer










                                                                              answered Jan 30 '13 at 16:16









                                                                              djangofandjangofan

                                                                              1,61162432




                                                                              1,61162432























                                                                                  -2














                                                                                  I was facing the same issue. Later I found that the culprit was Java 8.Earlier I installed java 8 but now there is no folder for java 8 and my JAVA_HOME set to jre7 but still I was facing above issue.



                                                                                  solution



                                                                                  I deleted javapath present in C:ProgramDataOracleJava. Now my system working properly. It also resolved my eclipse startup problem.






                                                                                  share|improve this answer




























                                                                                    -2














                                                                                    I was facing the same issue. Later I found that the culprit was Java 8.Earlier I installed java 8 but now there is no folder for java 8 and my JAVA_HOME set to jre7 but still I was facing above issue.



                                                                                    solution



                                                                                    I deleted javapath present in C:ProgramDataOracleJava. Now my system working properly. It also resolved my eclipse startup problem.






                                                                                    share|improve this answer


























                                                                                      -2












                                                                                      -2








                                                                                      -2







                                                                                      I was facing the same issue. Later I found that the culprit was Java 8.Earlier I installed java 8 but now there is no folder for java 8 and my JAVA_HOME set to jre7 but still I was facing above issue.



                                                                                      solution



                                                                                      I deleted javapath present in C:ProgramDataOracleJava. Now my system working properly. It also resolved my eclipse startup problem.






                                                                                      share|improve this answer













                                                                                      I was facing the same issue. Later I found that the culprit was Java 8.Earlier I installed java 8 but now there is no folder for java 8 and my JAVA_HOME set to jre7 but still I was facing above issue.



                                                                                      solution



                                                                                      I deleted javapath present in C:ProgramDataOracleJava. Now my system working properly. It also resolved my eclipse startup problem.







                                                                                      share|improve this answer












                                                                                      share|improve this answer



                                                                                      share|improve this answer










                                                                                      answered Dec 31 '15 at 5:07









                                                                                      Sudip7Sudip7

                                                                                      972




                                                                                      972























                                                                                          -2














                                                                                          I had the same issue. Doing this I resolved the issue.



                                                                                          On Windows 8 or 10, you need to remove "C:ProgramFileOracleJavajavapath" from path in environment variable.



                                                                                          This may resolve the issue.






                                                                                          share|improve this answer



















                                                                                          • 2





                                                                                            This has been suggested already, 2 years ago

                                                                                            – Ramhound
                                                                                            Jan 28 '18 at 3:43


















                                                                                          -2














                                                                                          I had the same issue. Doing this I resolved the issue.



                                                                                          On Windows 8 or 10, you need to remove "C:ProgramFileOracleJavajavapath" from path in environment variable.



                                                                                          This may resolve the issue.






                                                                                          share|improve this answer



















                                                                                          • 2





                                                                                            This has been suggested already, 2 years ago

                                                                                            – Ramhound
                                                                                            Jan 28 '18 at 3:43
















                                                                                          -2












                                                                                          -2








                                                                                          -2







                                                                                          I had the same issue. Doing this I resolved the issue.



                                                                                          On Windows 8 or 10, you need to remove "C:ProgramFileOracleJavajavapath" from path in environment variable.



                                                                                          This may resolve the issue.






                                                                                          share|improve this answer













                                                                                          I had the same issue. Doing this I resolved the issue.



                                                                                          On Windows 8 or 10, you need to remove "C:ProgramFileOracleJavajavapath" from path in environment variable.



                                                                                          This may resolve the issue.







                                                                                          share|improve this answer












                                                                                          share|improve this answer



                                                                                          share|improve this answer










                                                                                          answered Jan 28 '18 at 3:24









                                                                                          Isuru SandamalIsuru Sandamal

                                                                                          1




                                                                                          1








                                                                                          • 2





                                                                                            This has been suggested already, 2 years ago

                                                                                            – Ramhound
                                                                                            Jan 28 '18 at 3:43
















                                                                                          • 2





                                                                                            This has been suggested already, 2 years ago

                                                                                            – Ramhound
                                                                                            Jan 28 '18 at 3:43










                                                                                          2




                                                                                          2





                                                                                          This has been suggested already, 2 years ago

                                                                                          – Ramhound
                                                                                          Jan 28 '18 at 3:43







                                                                                          This has been suggested already, 2 years ago

                                                                                          – Ramhound
                                                                                          Jan 28 '18 at 3:43




















                                                                                          draft saved

                                                                                          draft discarded




















































                                                                                          Thanks for contributing an answer to Super User!


                                                                                          • Please be sure to answer the question. Provide details and share your research!

                                                                                          But avoid



                                                                                          • Asking for help, clarification, or responding to other answers.

                                                                                          • Making statements based on opinion; back them up with references or personal experience.


                                                                                          To learn more, see our tips on writing great answers.




                                                                                          draft saved


                                                                                          draft discarded














                                                                                          StackExchange.ready(
                                                                                          function () {
                                                                                          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f237737%2fwhy-is-java-version-returning-a-different-version-to-the-one-defined-in-java-ho%23new-answer', 'question_page');
                                                                                          }
                                                                                          );

                                                                                          Post as a guest















                                                                                          Required, but never shown





















































                                                                                          Required, but never shown














                                                                                          Required, but never shown












                                                                                          Required, but never shown







                                                                                          Required, but never shown

































                                                                                          Required, but never shown














                                                                                          Required, but never shown












                                                                                          Required, but never shown







                                                                                          Required, but never shown







                                                                                          Popular posts from this blog

                                                                                          Why not use the yoke to control yaw, as well as pitch and roll? Announcing the arrival of...

                                                                                          Couldn't open a raw socket. Error: Permission denied (13) (nmap)Is it possible to run networking commands...

                                                                                          VNC viewer RFB protocol error: bad desktop size 0x0I Cannot Type the Key 'd' (lowercase) in VNC Viewer...