Can we install two versions of Java JDK on Windows?Can program developed with Java 8 be run on Java 7?How can I concatenate two arrays in Java?How can I get the latest JRE / JDK as a zip file rather than EXE or MSI installer?How to set java_home on Windows 7?Android SDK installation doesn't find JDKFailed to load the JNI shared Library (JDK)Can't execute jar- file: “no main manifest attribute”Can't start Eclipse - Java was started but returned exit code=13Installed Java 7 on Mac OS X but Terminal is still using version 6Android Studio installation on Windows 7 fails, no JDK foundHow to install Java 8 on Mac

What is the idiomatic way to say "clothing fits"?

Are there any examples of a variable being normally distributed that is *not* due to the Central Limit Theorem?

Should I tell management that I intend to leave due to bad software development practices?

Detention in 1997

Why can't we play rap on piano?

Is it possible to create a QR code using text?

How dangerous is XSS?

Expand and Contract

Method Does Not Exist error message

What type of content (depth/breadth) is expected for a short presentation for Asst Professor interview in the UK?

How do I handle a potential work/personal life conflict as the manager of one of my friends?

Cursor Replacement for Newbies

Extract rows of a table, that include less than x NULLs

What do you call someone who asks many questions?

Alternative to sending password over mail?

What is the most common color to indicate the input-field is disabled?

Why didn't Miles's spider sense work before?

Can a virus destroy the BIOS of a modern computer?

What does “the session was packed” mean in this context?

Can my sorcerer use a spellbook only to collect spells and scribe scrolls, not cast?

Do scales need to be in alphabetical order?

What exploit Are these user agents trying to use?

Why didn't Boeing produce its own regional jet?

How much of data wrangling is a data scientist's job?



Can we install two versions of Java JDK on Windows?


Can program developed with Java 8 be run on Java 7?How can I concatenate two arrays in Java?How can I get the latest JRE / JDK as a zip file rather than EXE or MSI installer?How to set java_home on Windows 7?Android SDK installation doesn't find JDKFailed to load the JNI shared Library (JDK)Can't execute jar- file: “no main manifest attribute”Can't start Eclipse - Java was started but returned exit code=13Installed Java 7 on Mac OS X but Terminal is still using version 6Android Studio installation on Windows 7 fails, no JDK foundHow to install Java 8 on Mac













10















I have created an executable JAR file developed on Java version 8. The JAR file was opening on double click. But as the Oracle applications support only Java 6, I had to install JRE 6, but then after the JRE 6 installation, my executable JAR file is not opening.



I have set the JDK 8 bin path in Path environment variables. Is there a solution for this problem? Why is the JAR file not opening after two Java versions in the system?



JAR should open even if two versions 6 and 8 of Java are installed in the system.










share|improve this question









New contributor




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















  • 8





    Can we install two versions of Java JDK in windows Yes. Why is the jar not opening after two JAVA versions in system? Because Java 6 can't run Java 8 compiled code, you should be getting an error, and that error should have led you to the solution (recompile your application with Java 6, because Java 8 can run Java 6 compiled code).

    – Elliott Frisch
    2 days ago











  • Hi Elliott :), Thank you for responding. My application will support only Java 8 and above.Do you have another suggestion?

    – JTechseeker
    2 days ago






  • 2





    If your application will only support Java 8 and above, why have you installed Java 6?

    – Elliott Frisch
    2 days ago











  • @JTechseeker set default path of your JRE to 6

    – Mustahsan
    2 days ago











  • @ElliottFrisch : Hi Elliot, We are using oracle ERP instance which require java 6 for opening forms.

    – JTechseeker
    2 days ago
















10















I have created an executable JAR file developed on Java version 8. The JAR file was opening on double click. But as the Oracle applications support only Java 6, I had to install JRE 6, but then after the JRE 6 installation, my executable JAR file is not opening.



I have set the JDK 8 bin path in Path environment variables. Is there a solution for this problem? Why is the JAR file not opening after two Java versions in the system?



JAR should open even if two versions 6 and 8 of Java are installed in the system.










share|improve this question









New contributor




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















  • 8





    Can we install two versions of Java JDK in windows Yes. Why is the jar not opening after two JAVA versions in system? Because Java 6 can't run Java 8 compiled code, you should be getting an error, and that error should have led you to the solution (recompile your application with Java 6, because Java 8 can run Java 6 compiled code).

    – Elliott Frisch
    2 days ago











  • Hi Elliott :), Thank you for responding. My application will support only Java 8 and above.Do you have another suggestion?

    – JTechseeker
    2 days ago






  • 2





    If your application will only support Java 8 and above, why have you installed Java 6?

    – Elliott Frisch
    2 days ago











  • @JTechseeker set default path of your JRE to 6

    – Mustahsan
    2 days ago











  • @ElliottFrisch : Hi Elliot, We are using oracle ERP instance which require java 6 for opening forms.

    – JTechseeker
    2 days ago














10












10








10


1






I have created an executable JAR file developed on Java version 8. The JAR file was opening on double click. But as the Oracle applications support only Java 6, I had to install JRE 6, but then after the JRE 6 installation, my executable JAR file is not opening.



I have set the JDK 8 bin path in Path environment variables. Is there a solution for this problem? Why is the JAR file not opening after two Java versions in the system?



JAR should open even if two versions 6 and 8 of Java are installed in the system.










share|improve this question









New contributor




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












I have created an executable JAR file developed on Java version 8. The JAR file was opening on double click. But as the Oracle applications support only Java 6, I had to install JRE 6, but then after the JRE 6 installation, my executable JAR file is not opening.



I have set the JDK 8 bin path in Path environment variables. Is there a solution for this problem? Why is the JAR file not opening after two Java versions in the system?



JAR should open even if two versions 6 and 8 of Java are installed in the system.







java java-8






share|improve this question









New contributor




JTechseeker 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 question









New contributor




JTechseeker 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 question




share|improve this question








edited 2 days ago









Peter Mortensen

13.9k1987113




13.9k1987113






New contributor




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









asked 2 days ago









JTechseekerJTechseeker

516




516




New contributor




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





New contributor





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






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







  • 8





    Can we install two versions of Java JDK in windows Yes. Why is the jar not opening after two JAVA versions in system? Because Java 6 can't run Java 8 compiled code, you should be getting an error, and that error should have led you to the solution (recompile your application with Java 6, because Java 8 can run Java 6 compiled code).

    – Elliott Frisch
    2 days ago











  • Hi Elliott :), Thank you for responding. My application will support only Java 8 and above.Do you have another suggestion?

    – JTechseeker
    2 days ago






  • 2





    If your application will only support Java 8 and above, why have you installed Java 6?

    – Elliott Frisch
    2 days ago











  • @JTechseeker set default path of your JRE to 6

    – Mustahsan
    2 days ago











  • @ElliottFrisch : Hi Elliot, We are using oracle ERP instance which require java 6 for opening forms.

    – JTechseeker
    2 days ago













  • 8





    Can we install two versions of Java JDK in windows Yes. Why is the jar not opening after two JAVA versions in system? Because Java 6 can't run Java 8 compiled code, you should be getting an error, and that error should have led you to the solution (recompile your application with Java 6, because Java 8 can run Java 6 compiled code).

    – Elliott Frisch
    2 days ago











  • Hi Elliott :), Thank you for responding. My application will support only Java 8 and above.Do you have another suggestion?

    – JTechseeker
    2 days ago






  • 2





    If your application will only support Java 8 and above, why have you installed Java 6?

    – Elliott Frisch
    2 days ago











  • @JTechseeker set default path of your JRE to 6

    – Mustahsan
    2 days ago











  • @ElliottFrisch : Hi Elliot, We are using oracle ERP instance which require java 6 for opening forms.

    – JTechseeker
    2 days ago








8




8





Can we install two versions of Java JDK in windows Yes. Why is the jar not opening after two JAVA versions in system? Because Java 6 can't run Java 8 compiled code, you should be getting an error, and that error should have led you to the solution (recompile your application with Java 6, because Java 8 can run Java 6 compiled code).

– Elliott Frisch
2 days ago





Can we install two versions of Java JDK in windows Yes. Why is the jar not opening after two JAVA versions in system? Because Java 6 can't run Java 8 compiled code, you should be getting an error, and that error should have led you to the solution (recompile your application with Java 6, because Java 8 can run Java 6 compiled code).

– Elliott Frisch
2 days ago













Hi Elliott :), Thank you for responding. My application will support only Java 8 and above.Do you have another suggestion?

– JTechseeker
2 days ago





Hi Elliott :), Thank you for responding. My application will support only Java 8 and above.Do you have another suggestion?

– JTechseeker
2 days ago




2




2





If your application will only support Java 8 and above, why have you installed Java 6?

– Elliott Frisch
2 days ago





If your application will only support Java 8 and above, why have you installed Java 6?

– Elliott Frisch
2 days ago













@JTechseeker set default path of your JRE to 6

– Mustahsan
2 days ago





@JTechseeker set default path of your JRE to 6

– Mustahsan
2 days ago













@ElliottFrisch : Hi Elliot, We are using oracle ERP instance which require java 6 for opening forms.

– JTechseeker
2 days ago






@ElliottFrisch : Hi Elliot, We are using oracle ERP instance which require java 6 for opening forms.

– JTechseeker
2 days ago













5 Answers
5






active

oldest

votes


















10














You are facing a backward compatibility problem. Backwards compatibility means that you can run a Java 6 program on a Java 8 runtime, but not the other way around.




You can run a lower configuration on a higher configuration, not vice-versa




There are several reasons for that:



  1. Bytecode is versioned and the JVM checks if it supports the version it finds in .class files.

  2. Some language constructs cannot be expressed in previous versions of bytecode.

  3. There are new classes and methods in newer JREs which won't work with older ones.

If you really, really want (tip: you don't), you can force the compiler to treat the source as one version of Java and emit bytecode for another, using something like this:



javac -source 1.8 -target 1.6 MyClass.java



You can compile your code to Java 1.6 bytecode using JDK 1.8. Just take care of the following:




  • -source=1.8 and -target=1.6 compiler options

  • If you use Maven, consider having two pom.xml files, with an optional parent file.

Source: Can program developed with Java 8 be run on Java 7?






share|improve this answer
































    2















    In the short term,

    the answer is yes. Since both JDK files are downloaded as jar fils it will ok to download both jar files. The reason to not opening after two java versions is as @Elliott said: "in the system is Java 6 can't run Java 8 compiled code, you should be getting an error." That's exactly true but the problem is how to use multiple versions of JDK in a single machine.




    Then we have to move on to long term,

    The tricky thing is to manage these multiple JDKs and IDEs. It’s a piece of cake if I just use Eclipse for compiling my code because the IDE allows me to configure multiple versions of Java runtime. Unfortunately (or fortunately), I have to use the command line/shell to build my code. So, it is important that I have the right version of JDK present in the PATH and other related environment variables (such as JAVA_HOME).



    Manually modifying the environment variables every time I want to switch between JDKs, isn’t a happy task. But, thanks to Windows Powershell, I’m able to write a script that can do the heavy lifting for me.



    Basically, what you want to achieve is to set the PATH variable to add the Java bin folder and set the JAVA_HOME environment variable and then launch the correct Eclipse IDE. And, I want to do this with a single command. Let’s do it.



    1. Open a Windows Powershell.

    2. I prefer writing custom Windows scripts in my profile file so that it is available to run whenever I open the shell. To edit the profile, run this command: notepad.exe $profile - the $profile is a special variable that points to your profile file.

    3. Write the below script in the profile file and save it.


    function myIDE $env:Path = “C:vraajavajdk7bin;” $env:JAVA_HOME = “C:vraajavajdk7” C:vraaideeclipseeclipse set-location C:vraaworkspacemyproject play




    function officeIDE
    $env:Path = "C:vraajavajdk6bin;"
    $env:JAVA_HOME = "C:vraajavajdk6"
    C:officeeclipseeclipse



    1. Close and restart the Powershell.

    2. Now you can issue the command myIDE which will set the proper PATH and environment variables and then launch the Eclipse IDE.

    As you can see, there are two functions with different configurations. Just call the function name that you want to launch from the Powershell command line (myIDE).



    If any issue please put a comment below!






    share|improve this answer






























      0














      I am not sure if this solution going to work or not.
      Try to run command java -version and look if it returns java 6 or 8 path. Also try to give path of JDK 8 as JAVA_HOME variable and add that into path like this path=%JAVA_HOME%/bin and see if it works. If you get the java 6 as java version try to use above method and then install JRE 6






      share|improve this answer























      • The environment setup was already done. It stopped working after installing java6.

        – JTechseeker
        14 hours ago


















      0














      Hi All Thank you for your response. I kept java6 and reinstalled java8 and now forms and jar both are working!.






      share|improve this answer








      New contributor




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



























        -2














        Of course you can. More importantly Java has backward compatibility. It means you can use Java 6 functionality while using Java 8 version.



        For an Oracle ERP instance, which requires Java 6 for opening form, kindly check if Oracle ERP is supporting Java 8 or not.






        share|improve this answer










        New contributor




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




















          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          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
          );



          );






          JTechseeker is a new contributor. Be nice, and check out our Code of Conduct.









          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55448416%2fcan-we-install-two-versions-of-java-jdk-on-windows%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          5 Answers
          5






          active

          oldest

          votes








          5 Answers
          5






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          10














          You are facing a backward compatibility problem. Backwards compatibility means that you can run a Java 6 program on a Java 8 runtime, but not the other way around.




          You can run a lower configuration on a higher configuration, not vice-versa




          There are several reasons for that:



          1. Bytecode is versioned and the JVM checks if it supports the version it finds in .class files.

          2. Some language constructs cannot be expressed in previous versions of bytecode.

          3. There are new classes and methods in newer JREs which won't work with older ones.

          If you really, really want (tip: you don't), you can force the compiler to treat the source as one version of Java and emit bytecode for another, using something like this:



          javac -source 1.8 -target 1.6 MyClass.java



          You can compile your code to Java 1.6 bytecode using JDK 1.8. Just take care of the following:




          • -source=1.8 and -target=1.6 compiler options

          • If you use Maven, consider having two pom.xml files, with an optional parent file.

          Source: Can program developed with Java 8 be run on Java 7?






          share|improve this answer





























            10














            You are facing a backward compatibility problem. Backwards compatibility means that you can run a Java 6 program on a Java 8 runtime, but not the other way around.




            You can run a lower configuration on a higher configuration, not vice-versa




            There are several reasons for that:



            1. Bytecode is versioned and the JVM checks if it supports the version it finds in .class files.

            2. Some language constructs cannot be expressed in previous versions of bytecode.

            3. There are new classes and methods in newer JREs which won't work with older ones.

            If you really, really want (tip: you don't), you can force the compiler to treat the source as one version of Java and emit bytecode for another, using something like this:



            javac -source 1.8 -target 1.6 MyClass.java



            You can compile your code to Java 1.6 bytecode using JDK 1.8. Just take care of the following:




            • -source=1.8 and -target=1.6 compiler options

            • If you use Maven, consider having two pom.xml files, with an optional parent file.

            Source: Can program developed with Java 8 be run on Java 7?






            share|improve this answer



























              10












              10








              10







              You are facing a backward compatibility problem. Backwards compatibility means that you can run a Java 6 program on a Java 8 runtime, but not the other way around.




              You can run a lower configuration on a higher configuration, not vice-versa




              There are several reasons for that:



              1. Bytecode is versioned and the JVM checks if it supports the version it finds in .class files.

              2. Some language constructs cannot be expressed in previous versions of bytecode.

              3. There are new classes and methods in newer JREs which won't work with older ones.

              If you really, really want (tip: you don't), you can force the compiler to treat the source as one version of Java and emit bytecode for another, using something like this:



              javac -source 1.8 -target 1.6 MyClass.java



              You can compile your code to Java 1.6 bytecode using JDK 1.8. Just take care of the following:




              • -source=1.8 and -target=1.6 compiler options

              • If you use Maven, consider having two pom.xml files, with an optional parent file.

              Source: Can program developed with Java 8 be run on Java 7?






              share|improve this answer















              You are facing a backward compatibility problem. Backwards compatibility means that you can run a Java 6 program on a Java 8 runtime, but not the other way around.




              You can run a lower configuration on a higher configuration, not vice-versa




              There are several reasons for that:



              1. Bytecode is versioned and the JVM checks if it supports the version it finds in .class files.

              2. Some language constructs cannot be expressed in previous versions of bytecode.

              3. There are new classes and methods in newer JREs which won't work with older ones.

              If you really, really want (tip: you don't), you can force the compiler to treat the source as one version of Java and emit bytecode for another, using something like this:



              javac -source 1.8 -target 1.6 MyClass.java



              You can compile your code to Java 1.6 bytecode using JDK 1.8. Just take care of the following:




              • -source=1.8 and -target=1.6 compiler options

              • If you use Maven, consider having two pom.xml files, with an optional parent file.

              Source: Can program developed with Java 8 be run on Java 7?







              share|improve this answer














              share|improve this answer



              share|improve this answer








              edited 2 days ago









              Peter Mortensen

              13.9k1987113




              13.9k1987113










              answered 2 days ago









              Common ManCommon Man

              2,23231431




              2,23231431























                  2















                  In the short term,

                  the answer is yes. Since both JDK files are downloaded as jar fils it will ok to download both jar files. The reason to not opening after two java versions is as @Elliott said: "in the system is Java 6 can't run Java 8 compiled code, you should be getting an error." That's exactly true but the problem is how to use multiple versions of JDK in a single machine.




                  Then we have to move on to long term,

                  The tricky thing is to manage these multiple JDKs and IDEs. It’s a piece of cake if I just use Eclipse for compiling my code because the IDE allows me to configure multiple versions of Java runtime. Unfortunately (or fortunately), I have to use the command line/shell to build my code. So, it is important that I have the right version of JDK present in the PATH and other related environment variables (such as JAVA_HOME).



                  Manually modifying the environment variables every time I want to switch between JDKs, isn’t a happy task. But, thanks to Windows Powershell, I’m able to write a script that can do the heavy lifting for me.



                  Basically, what you want to achieve is to set the PATH variable to add the Java bin folder and set the JAVA_HOME environment variable and then launch the correct Eclipse IDE. And, I want to do this with a single command. Let’s do it.



                  1. Open a Windows Powershell.

                  2. I prefer writing custom Windows scripts in my profile file so that it is available to run whenever I open the shell. To edit the profile, run this command: notepad.exe $profile - the $profile is a special variable that points to your profile file.

                  3. Write the below script in the profile file and save it.


                  function myIDE $env:Path = “C:vraajavajdk7bin;” $env:JAVA_HOME = “C:vraajavajdk7” C:vraaideeclipseeclipse set-location C:vraaworkspacemyproject play




                  function officeIDE
                  $env:Path = "C:vraajavajdk6bin;"
                  $env:JAVA_HOME = "C:vraajavajdk6"
                  C:officeeclipseeclipse



                  1. Close and restart the Powershell.

                  2. Now you can issue the command myIDE which will set the proper PATH and environment variables and then launch the Eclipse IDE.

                  As you can see, there are two functions with different configurations. Just call the function name that you want to launch from the Powershell command line (myIDE).



                  If any issue please put a comment below!






                  share|improve this answer



























                    2















                    In the short term,

                    the answer is yes. Since both JDK files are downloaded as jar fils it will ok to download both jar files. The reason to not opening after two java versions is as @Elliott said: "in the system is Java 6 can't run Java 8 compiled code, you should be getting an error." That's exactly true but the problem is how to use multiple versions of JDK in a single machine.




                    Then we have to move on to long term,

                    The tricky thing is to manage these multiple JDKs and IDEs. It’s a piece of cake if I just use Eclipse for compiling my code because the IDE allows me to configure multiple versions of Java runtime. Unfortunately (or fortunately), I have to use the command line/shell to build my code. So, it is important that I have the right version of JDK present in the PATH and other related environment variables (such as JAVA_HOME).



                    Manually modifying the environment variables every time I want to switch between JDKs, isn’t a happy task. But, thanks to Windows Powershell, I’m able to write a script that can do the heavy lifting for me.



                    Basically, what you want to achieve is to set the PATH variable to add the Java bin folder and set the JAVA_HOME environment variable and then launch the correct Eclipse IDE. And, I want to do this with a single command. Let’s do it.



                    1. Open a Windows Powershell.

                    2. I prefer writing custom Windows scripts in my profile file so that it is available to run whenever I open the shell. To edit the profile, run this command: notepad.exe $profile - the $profile is a special variable that points to your profile file.

                    3. Write the below script in the profile file and save it.


                    function myIDE $env:Path = “C:vraajavajdk7bin;” $env:JAVA_HOME = “C:vraajavajdk7” C:vraaideeclipseeclipse set-location C:vraaworkspacemyproject play




                    function officeIDE
                    $env:Path = "C:vraajavajdk6bin;"
                    $env:JAVA_HOME = "C:vraajavajdk6"
                    C:officeeclipseeclipse



                    1. Close and restart the Powershell.

                    2. Now you can issue the command myIDE which will set the proper PATH and environment variables and then launch the Eclipse IDE.

                    As you can see, there are two functions with different configurations. Just call the function name that you want to launch from the Powershell command line (myIDE).



                    If any issue please put a comment below!






                    share|improve this answer

























                      2












                      2








                      2








                      In the short term,

                      the answer is yes. Since both JDK files are downloaded as jar fils it will ok to download both jar files. The reason to not opening after two java versions is as @Elliott said: "in the system is Java 6 can't run Java 8 compiled code, you should be getting an error." That's exactly true but the problem is how to use multiple versions of JDK in a single machine.




                      Then we have to move on to long term,

                      The tricky thing is to manage these multiple JDKs and IDEs. It’s a piece of cake if I just use Eclipse for compiling my code because the IDE allows me to configure multiple versions of Java runtime. Unfortunately (or fortunately), I have to use the command line/shell to build my code. So, it is important that I have the right version of JDK present in the PATH and other related environment variables (such as JAVA_HOME).



                      Manually modifying the environment variables every time I want to switch between JDKs, isn’t a happy task. But, thanks to Windows Powershell, I’m able to write a script that can do the heavy lifting for me.



                      Basically, what you want to achieve is to set the PATH variable to add the Java bin folder and set the JAVA_HOME environment variable and then launch the correct Eclipse IDE. And, I want to do this with a single command. Let’s do it.



                      1. Open a Windows Powershell.

                      2. I prefer writing custom Windows scripts in my profile file so that it is available to run whenever I open the shell. To edit the profile, run this command: notepad.exe $profile - the $profile is a special variable that points to your profile file.

                      3. Write the below script in the profile file and save it.


                      function myIDE $env:Path = “C:vraajavajdk7bin;” $env:JAVA_HOME = “C:vraajavajdk7” C:vraaideeclipseeclipse set-location C:vraaworkspacemyproject play




                      function officeIDE
                      $env:Path = "C:vraajavajdk6bin;"
                      $env:JAVA_HOME = "C:vraajavajdk6"
                      C:officeeclipseeclipse



                      1. Close and restart the Powershell.

                      2. Now you can issue the command myIDE which will set the proper PATH and environment variables and then launch the Eclipse IDE.

                      As you can see, there are two functions with different configurations. Just call the function name that you want to launch from the Powershell command line (myIDE).



                      If any issue please put a comment below!






                      share|improve this answer














                      In the short term,

                      the answer is yes. Since both JDK files are downloaded as jar fils it will ok to download both jar files. The reason to not opening after two java versions is as @Elliott said: "in the system is Java 6 can't run Java 8 compiled code, you should be getting an error." That's exactly true but the problem is how to use multiple versions of JDK in a single machine.




                      Then we have to move on to long term,

                      The tricky thing is to manage these multiple JDKs and IDEs. It’s a piece of cake if I just use Eclipse for compiling my code because the IDE allows me to configure multiple versions of Java runtime. Unfortunately (or fortunately), I have to use the command line/shell to build my code. So, it is important that I have the right version of JDK present in the PATH and other related environment variables (such as JAVA_HOME).



                      Manually modifying the environment variables every time I want to switch between JDKs, isn’t a happy task. But, thanks to Windows Powershell, I’m able to write a script that can do the heavy lifting for me.



                      Basically, what you want to achieve is to set the PATH variable to add the Java bin folder and set the JAVA_HOME environment variable and then launch the correct Eclipse IDE. And, I want to do this with a single command. Let’s do it.



                      1. Open a Windows Powershell.

                      2. I prefer writing custom Windows scripts in my profile file so that it is available to run whenever I open the shell. To edit the profile, run this command: notepad.exe $profile - the $profile is a special variable that points to your profile file.

                      3. Write the below script in the profile file and save it.


                      function myIDE $env:Path = “C:vraajavajdk7bin;” $env:JAVA_HOME = “C:vraajavajdk7” C:vraaideeclipseeclipse set-location C:vraaworkspacemyproject play




                      function officeIDE
                      $env:Path = "C:vraajavajdk6bin;"
                      $env:JAVA_HOME = "C:vraajavajdk6"
                      C:officeeclipseeclipse



                      1. Close and restart the Powershell.

                      2. Now you can issue the command myIDE which will set the proper PATH and environment variables and then launch the Eclipse IDE.

                      As you can see, there are two functions with different configurations. Just call the function name that you want to launch from the Powershell command line (myIDE).



                      If any issue please put a comment below!







                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered 2 days ago









                      Indrajith EkanayakeIndrajith Ekanayake

                      8141425




                      8141425





















                          0














                          I am not sure if this solution going to work or not.
                          Try to run command java -version and look if it returns java 6 or 8 path. Also try to give path of JDK 8 as JAVA_HOME variable and add that into path like this path=%JAVA_HOME%/bin and see if it works. If you get the java 6 as java version try to use above method and then install JRE 6






                          share|improve this answer























                          • The environment setup was already done. It stopped working after installing java6.

                            – JTechseeker
                            14 hours ago















                          0














                          I am not sure if this solution going to work or not.
                          Try to run command java -version and look if it returns java 6 or 8 path. Also try to give path of JDK 8 as JAVA_HOME variable and add that into path like this path=%JAVA_HOME%/bin and see if it works. If you get the java 6 as java version try to use above method and then install JRE 6






                          share|improve this answer























                          • The environment setup was already done. It stopped working after installing java6.

                            – JTechseeker
                            14 hours ago













                          0












                          0








                          0







                          I am not sure if this solution going to work or not.
                          Try to run command java -version and look if it returns java 6 or 8 path. Also try to give path of JDK 8 as JAVA_HOME variable and add that into path like this path=%JAVA_HOME%/bin and see if it works. If you get the java 6 as java version try to use above method and then install JRE 6






                          share|improve this answer













                          I am not sure if this solution going to work or not.
                          Try to run command java -version and look if it returns java 6 or 8 path. Also try to give path of JDK 8 as JAVA_HOME variable and add that into path like this path=%JAVA_HOME%/bin and see if it works. If you get the java 6 as java version try to use above method and then install JRE 6







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered yesterday









                          Akshaya KAushikAkshaya KAushik

                          35




                          35












                          • The environment setup was already done. It stopped working after installing java6.

                            – JTechseeker
                            14 hours ago

















                          • The environment setup was already done. It stopped working after installing java6.

                            – JTechseeker
                            14 hours ago
















                          The environment setup was already done. It stopped working after installing java6.

                          – JTechseeker
                          14 hours ago





                          The environment setup was already done. It stopped working after installing java6.

                          – JTechseeker
                          14 hours ago











                          0














                          Hi All Thank you for your response. I kept java6 and reinstalled java8 and now forms and jar both are working!.






                          share|improve this answer








                          New contributor




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
























                            0














                            Hi All Thank you for your response. I kept java6 and reinstalled java8 and now forms and jar both are working!.






                            share|improve this answer








                            New contributor




                            JTechseeker 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







                              Hi All Thank you for your response. I kept java6 and reinstalled java8 and now forms and jar both are working!.






                              share|improve this answer








                              New contributor




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










                              Hi All Thank you for your response. I kept java6 and reinstalled java8 and now forms and jar both are working!.







                              share|improve this answer








                              New contributor




                              JTechseeker 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






                              New contributor




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









                              answered 14 hours ago









                              JTechseekerJTechseeker

                              516




                              516




                              New contributor




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





                              New contributor





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






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





















                                  -2














                                  Of course you can. More importantly Java has backward compatibility. It means you can use Java 6 functionality while using Java 8 version.



                                  For an Oracle ERP instance, which requires Java 6 for opening form, kindly check if Oracle ERP is supporting Java 8 or not.






                                  share|improve this answer










                                  New contributor




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
























                                    -2














                                    Of course you can. More importantly Java has backward compatibility. It means you can use Java 6 functionality while using Java 8 version.



                                    For an Oracle ERP instance, which requires Java 6 for opening form, kindly check if Oracle ERP is supporting Java 8 or not.






                                    share|improve this answer










                                    New contributor




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






















                                      -2












                                      -2








                                      -2







                                      Of course you can. More importantly Java has backward compatibility. It means you can use Java 6 functionality while using Java 8 version.



                                      For an Oracle ERP instance, which requires Java 6 for opening form, kindly check if Oracle ERP is supporting Java 8 or not.






                                      share|improve this answer










                                      New contributor




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










                                      Of course you can. More importantly Java has backward compatibility. It means you can use Java 6 functionality while using Java 8 version.



                                      For an Oracle ERP instance, which requires Java 6 for opening form, kindly check if Oracle ERP is supporting Java 8 or not.







                                      share|improve this answer










                                      New contributor




                                      Pushpdeep Singh 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 2 days ago









                                      Peter Mortensen

                                      13.9k1987113




                                      13.9k1987113






                                      New contributor




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









                                      answered 2 days ago









                                      Pushpdeep SinghPushpdeep Singh

                                      11




                                      11




                                      New contributor




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





                                      New contributor





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






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




















                                          JTechseeker is a new contributor. Be nice, and check out our Code of Conduct.









                                          draft saved

                                          draft discarded


















                                          JTechseeker is a new contributor. Be nice, and check out our Code of Conduct.












                                          JTechseeker is a new contributor. Be nice, and check out our Code of Conduct.











                                          JTechseeker is a new contributor. Be nice, and check out our Code of Conduct.














                                          Thanks for contributing an answer to Stack Overflow!


                                          • 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%2fstackoverflow.com%2fquestions%2f55448416%2fcan-we-install-two-versions-of-java-jdk-on-windows%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

                                          រឿង រ៉ូមេអូ និង ហ្ស៊ុយលីយេ សង្ខេបរឿង តួអង្គ បញ្ជីណែនាំ

                                          Crop image to path created in TikZ? Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)Crop an inserted image?TikZ pictures does not appear in posterImage behind and beyond crop marks?Tikz picture as large as possible on A4 PageTransparency vs image compression dilemmaHow to crop background from image automatically?Image does not cropTikzexternal capturing crop marks when externalizing pgfplots?How to include image path that contains a dollar signCrop image with left size given

                                          Romeo and Juliet ContentsCharactersSynopsisSourcesDate and textThemes and motifsCriticism and interpretationLegacyScene by sceneSee alsoNotes and referencesSourcesExternal linksNavigation menu"Consumer Price Index (estimate) 1800–"10.2307/28710160037-3222287101610.1093/res/II.5.31910.2307/45967845967810.2307/2869925286992510.1525/jams.1982.35.3.03a00050"Dada Masilo: South African dancer who breaks the rules"10.1093/res/os-XV.57.1610.2307/28680942868094"Sweet Sorrow: Mann-Korman's Romeo and Juliet Closes Sept. 5 at MN's Ordway"the original10.2307/45957745957710.1017/CCOL0521570476.009"Ram Leela box office collections hit massive Rs 100 crore, pulverises prediction"Archived"Broadway Revival of Romeo and Juliet, Starring Orlando Bloom and Condola Rashad, Will Close Dec. 8"Archived10.1075/jhp.7.1.04hon"Wherefore art thou, Romeo? To make us laugh at Navy Pier"the original10.1093/gmo/9781561592630.article.O006772"Ram-leela Review Roundup: Critics Hail Film as Best Adaptation of Romeo and Juliet"Archived10.2307/31946310047-77293194631"Romeo and Juliet get Twitter treatment""Juliet's Nurse by Lois Leveen""Romeo and Juliet: Orlando Bloom's Broadway Debut Released in Theaters for Valentine's Day"Archived"Romeo and Juliet Has No Balcony"10.1093/gmo/9781561592630.article.O00778110.2307/2867423286742310.1076/enst.82.2.115.959510.1080/00138380601042675"A plague o' both your houses: error in GCSE exam paper forces apology""Juliet of the Five O'Clock Shadow, and Other Wonders"10.2307/33912430027-4321339124310.2307/28487440038-7134284874410.2307/29123140149-661129123144728341M"Weekender Guide: Shakespeare on The Drive""balcony"UK public library membership"romeo"UK public library membership10.1017/CCOL9780521844291"Post-Zionist Critique on Israel and the Palestinians Part III: Popular Culture"10.2307/25379071533-86140377-919X2537907"Capulets and Montagues: UK exam board admit mixing names up in Romeo and Juliet paper"Istoria Novellamente Ritrovata di Due Nobili Amanti2027/mdp.390150822329610820-750X"GCSE exam error: Board accidentally rewrites Shakespeare"10.2307/29176390149-66112917639"Exam board apologises after error in English GCSE paper which confused characters in Shakespeare's Romeo and Juliet""From Mariotto and Ganozza to Romeo and Guilietta: Metamorphoses of a Renaissance Tale"10.2307/37323537323510.2307/2867455286745510.2307/28678912867891"10 Questions for Taylor Swift"10.2307/28680922868092"Haymarket Theatre""The Zeffirelli Way: Revealing Talk by Florentine Director""Michael Smuin: 1938-2007 / Prolific dance director had showy career"The Life and Art of Edwin BoothRomeo and JulietRomeo and JulietRomeo and JulietRomeo and JulietEasy Read Romeo and JulietRomeo and Julieteeecb12003684p(data)4099369-3n8211610759dbe00d-a9e2-41a3-b2c1-977dd692899302814385X313670221313670221