如何设置Java环境变量在Windows(类路径)?


当前回答

Windows 7用户:

右键单击“我的电脑”,选择“属性”;先进的;系统设置;先进的;环境变量。然后在第二个框中找到PATH并设置如下图所示的变量。

其他回答

您的Keytools文件位于“Java/bin”文件夹下,因此您需要设置环境变量或进入“Java/bin”文件夹并运行命令

Windows:

Right click on 'My Computers' and open 'Properties'. In Windows Vista or Windows 7, go to "Advanced System Settings". Else go to next step. Go to 'Advanced Tab' and click on Environment Variables button. Select 'Path' under the list of 'System Variables', and press Edit and add C:\Program Files\java\jdk\bin after a semicolon. Now click on 'new' button under system variables and enter 'JAVA_HOME' as variable name and path to jdk home directory (ex. 'C:\Program Files\Java\jdk1.6.0_24' if you are installing java version 6. Directory name may change with diff. java versions) as variable_value.

Windows 7用户:

右键单击“我的电脑”,选择“属性”;先进的;系统设置;先进的;环境变量。然后在第二个框中找到PATH并设置如下图所示的变量。

在Centos / Linux下设置java环境变量

/home/ vi .bashrc

出口JAVA_HOME = / opt / oracle /产品/ java / jdk1.8.0_45

导出路径= $ JAVA_HOME / bin: $路径

java - version

Linux下:http://lowfatlinux.com/linux-environment-variables.html

当然,你可以使用以下方法从Java中检索它们:

String variable = System.getProperty("mykey");