How to set path for Jre 6 when jre 7 installed?

前端 未结 12 808
深忆病人
深忆病人 2021-01-18 00:19

I am programming through java 1.6 u_17, but i have JRE version 6 and JRE version 7 installed, so how to run my compiled program from JDK 1.6 to run through the JRE 6 only?<

12条回答
  •  再見小時候
    2021-01-18 00:53

    Windows is checking the PATH variable to find an executable named java and using that to launch your application. It is quite normal in a development environment to have many installations (as you do). However this calls on you to manage your environment.

    There are two ways for you to set environment variables in Windows. By going to My Computer > Advanced Settings > Environment Variables as described above, you can set a variabler to your JDK installation and then update the Path to find the bin directory in that installation. Youy have the choice of updating System variables (all users) or user variables (your account only).

    Personally, I prefer not to use the system/user environment variables as this provides less flexibility. You can use bat files to explicitly set the Path for a specific moment in time, or indeed to override the JAVA_HOME to point to a different installation.

    If you are using an IDE you can usually specify the target runtime on a per project basis. Alternatively, when running the program, provide the fully qualified path to the version of the java executable you wish to use.

提交回复
热议问题