English 中文(简体)
如何将 Java的环境变量列入Windows
原标题:How to set the environment variables for Java in Windows
  • 时间:2009-11-04 07:54:02
  •  标签:

如何将 Java的环境变量列入Windows(类别)?

问题回答

Java SE Development Kit 8u112 on a 64-bit Windows 7 or Windows 8

设定以下用户环境变量(=用户变量/em>的环境变量)

  • JAVA_HOME : C:Program FilesJavajdk1.8.0_112
  • JDK_HOME : %JAVA_HOME%
  • JRE_HOME : %JAVA_HOME%jre
  • CLASSPATH : .;%JAVA_HOME%lib;%JAVA_HOME%jrelib
  • PATH : your-unique-entries;%JAVA_HOME%in (make sure that the longish your-unique-entries does not contain any other references to another Java installation folder.

视窗用户在64轨道系统中的说明:

Progra~1 =  Program Files 
Progra~2 =  Program Files(x86) 

这些环境变量来自“root”环境变量JAVA_HOME。 这使得在更新联合数据系统时很容易更新你的环境变量。 Just point JAVA_HOME to the new facilities.

Optional recommendations

  • Add a user environment variable JAVA_TOOL_OPTIONS with value -Dfile.encoding="UTF-8". This ensures that Java (and tools such as Maven) will run with a Charset.defaultCharset() of UTF-8 (instead of the default Windows-1252). This has saved a lot of headaches when wirking with my own code and that of others, which unfortunately often assume the (sane) default encoding UTF-8.
  • When JDK is installed, it adds to the system environment variable Path an entry C:ProgramDataOracleJavajavapath;. I anecdotally noticed that the links in that directory didn t get updated during an JDK installation update. So it s best to remove C:ProgramDataOracleJavajavapath; from the Path system environment variable in order to have a consistent environment.

视窗安装

<>Step 1>: Right Click on MyComputer and Point on property .

<>Step 2>: Click on Superior tab

alt text

<>3:Click on Environment Variables

“alt

<>Step 4: 为JAVA-HOME创建新的班级道路

“alt

<>Step 5: 进入Variable name as JAVA_HOME and the Value to You jdk bin path ie c:ProgramfilesJavajdk-1.6in and

<>0> 保证u从开始; in the Value so that it don t corruption the other environment factors which is established.

“alt

<>Step 6: 跟踪系统可变物质的“路径”和代号,在价值栏中添加以下内容:

Step 7:Your is made up the environment factors for You Java , 为了测试,它必须迅速指挥。

 java   

谁将获得帮助清单c

确保汇编者是否成立 厘米度

  javac

谁将获得与javac相关的名单

希望这一帮助!

纽约总部 set

有两种办法可以确定 j路。

www.un.org/Depts/DGACM/index_french.htm

  1. Open cmd
  2. Write in cmd : javac

如果不安装java,你就会看到以下信息:

javac未被承认为内部和外部指挥、可操作的方案或批量文件

  1. Write in cmd : set path=C:Program FilesJavajdk1.8.0_121in
  2. Write in cmd : javac

如果未发现错误,你可以检查这条道路。

必须指出,这些变化只是从这一厘米点启动的方案的临时变化。

<>m>NOTE:你可能不得不将指挥线作为admin

<>B. 永久

  1. Righ-click on "My computer" and click on properties
  2. Click on "Advanced system settings"
  3. Click on "Environment variables"
  4. Click on new tab of user variable
  5. Write path in variable name
  6. Copy the path of bin folder
  7. Paste the path of the bin folder in the variable value
  8. Click OK

这条道路现已永久开通。

www.un.org/Depts/DGACM/index_spanish.htm TIP: The tool “Rapid Environment Editor” (freeware) is grand for changinging the environment factors and help in that case

TIP2:使用环境变量的更快途径:新闻Win+R 钥匙, Paste the following %windir%System32 undll32.exe sysdm.cpl, EditEnvironmentVariables and press ENTER

Windows 7,right-click on Computer ->Properties ->先进系统环境;然后在Advancedtab,点击Environment Variables... ->系统变量 ->New...

新的系统可变以下名称:JAVA_HOME和价值C:Program filesJavajdk1.7.0_79(取决于您的JDK安装方式)。

然后选择<代码>Path系统变量,并点击Edit......。 保留<代码>Path和附录C:Program filesJavajdk1.7.0_79in;%JAVA_HOME%in; (两者均指)变值。

一旦做了上述改动,就会尝试以下步骤。 如果你看不到类似结果,就重新启用计算机并再次尝试。 如果仍然不工作,你可能需要重新加入科索沃独立党。

开放窗口指挥台(Windows Key + R-> 进入cm ->OK,并检查:

java -version

你们会看到这样的情况:

java version "1.7.0_79"
Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)

然后检查:

javac -version

你们会看到这样的情况:

javac 1.7.0_79

JDK 安装指示准确解释如何为不同版本的Windows设定PATH

通常,你不应制定<代码>。 CLASSPATH 环境变量。 如果你离开, Java将看目前的名录,寻找班级。 页: 1 指挥线改为<代码>java或javac

我将在这里通过视窗7的图片作解释。

请采取以下步骤:

Step 1: Go to "Start" and get into the "My Computer" properties

“entergraph

Step2:Go to “Advance System Setting” and Point on it.

“enter

Step 3: Go to “Start” and go into the “My Computer” nature

“entergraph

<>Step 4:环境变量的方言将照此开放:

“enterography

www.un.org/Depts/DGACM/index_french.htm

“entergraph

Step 6:Put the path of You JDK where it Residents up to bin Suchs. 此外,在平台工具上添加从您的安康到的道路。

“entergraph

在方案拟定方面,你可以执行SET指挥系统(SET等级=c:java)或右边点击你的计算机和镜头;财产“超高”;环境变量。

在批量档案中,可使用

SET classpath=c:java
java c:myapplication.class

视窗7用户:

Right-click on My Computer, selected Property; Superior; System Settings; Superior; Environment Variables. 然后在第二个盒子中找到PATH,并像下文中那样确定变量。

“PATH变量编辑”/

rel=“nofollow noreferer” http://lowfatlinux.com/linux-environment-variables.html>

当然,你可以利用:

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

Java path set for java 11

  1. copy the path for jdk-11

Don't include the in chainer, Just the JDK path. 例如

In environmental variable, user variable section click on New button and give path like below. enter image description here

之后为之提供ok,再到System factors,并选取Path,并两点击。

“entergraph

click on new and paste %JAVA_HOME%in and click ok to all. enter image description here

www.un.org/Depts/DGACM/index_spanish.htm Set java Environment changing in Centos /-030

/home/ vi.bashrc

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

PATH=$JAVA_HOME/bin:$PATH

java - 转化

铭记%CLASSPATH% environment/2007/5> 当你使用java/javac与-cp-classpath-jar<>/code>。 它还在Netbeans/Eclipse/IntelliJ/etc等电离层电离层中ignored。 当你使用java/javac时,就使用了 only/em>。

如果是联合调查组的档案,则该类别将界定为“标识”条目。 mf 档案。 它可以被定义为分立的半殖民地,而与JAR的档案相对而言是根本的。

如果是民主选举学会,你就拥有所谓的建筑道路,这基本上是在汇编时间和操作时间使用的班次。 为增加外部图书馆,您通常将JAR的档案放入(由民主选举学会或定制的)lib,该项目的复印件添加到项目修建的道路上。

For deployment better to set up classpath exactly and keep environment clear. Or at *.bat (the same for linux, but with correct variables symbols):

CLASSPATH="c:lib;d:	emp	est.jar;<long classpath>"
CLASSPATH=%CLASSPATH%;"<another_logical_droup_of_classpath" 
java -cp %CLASSPATH% com.test.MainCLass

或者在指挥线或 *.bat(就*.sh而言)上,如果班时间不够长:

java -cp "c:lib;d:	emp	est.jar;<short classpath>"

视窗:

  • 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 Filesjavajdkin 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 FilesJavajdk1.6.0_24 if you are installing java version 6. Directory name may change with diff. java versions) as variable_value.
  1. Download the JDK
  2. Install it
  3. Then Setup environment variables like this :
  4. Click on EDIT

“

  1. Then click PATH, Click Add , Then Add it like this: enter image description here

您的钥匙tools档案存放在“Java/bin”的夹子下,因此,你需要确定环境变数,或去“Java/bin”的夹子,管理指挥。

可在系统环境中添加JAVA_HOME,从我的计算机和软件中可变;>advance tab>add the new path as amended rel=“nofollow noretinger”>here

它可以帮助Mac和Lino用户。





相关问题