什么是java path环境变量
参考:https://docs.oracle.com/javase/tutorial/essential/environment/paths.html
从orcle官网的文档中可以看到java path环境变量:
java path环境变量就是java在执行命令时 寻找javac这个程序的位置(拓展开来其它应用应该也是这样,资源的环境变量就是某个应用对自己所需要用的资源,所在的位置){一个是程序所在的位置,一个是资源所在的位置}。
The PATH
environment variable is a series of directories separated by semicolons (;
). Microsoft Windows looks for programs in the PATH
directories in order, from left to right. You should have only one bin
directory for the JDK in the path at a time (those following the first are ignored), so if one is already present, you can update that particular entry.
The following is an example of a PATH
environment variable:
C:\Java\jdk1.7.0\bin;C:\Windows\System32\;C:\Windows\;C:\Windows\System32\Wbem
windows的环境变量用 ; 隔开
设置方法:(原文)
Windows XP
- Select Start, select Control Panel. double click System, and select the Advanced tab.
- Click Environment Variables. In the section System Variables, find the
PATH
environment variable and select it. Click Edit. If thePATH
environment variable does not exist, clickNew
. - In the Edit System Variable (or New System Variable) window, specify the value of the
PATH
environment variable. Click OK. Close all remaining windows by clicking OK.
Windows Vista:
- From the desktop, right click the My Computer icon.
- Choose Properties from the context menu.
- Click the Advanced tab (Advanced system settings link in Vista).
- Click Environment Variables. In the section System Variables, find the
PATH
environment variable and select it. Click Edit. If thePATH
environment variable does not exist, clickNew
. - In the Edit System Variable (or New System Variable) window, specify the value of the
PATH
environment variable. Click OK. Close all remaining windows by clicking OK.
Windows 7:
- From the desktop, right click the Computer icon.
- Choose Properties from the context menu.
- Click the Advanced system settings link.
- Click Environment Variables. In the section System Variables, find the
PATH
environment variable and select it. Click Edit. If thePATH
environment variable does not exist, clickNew
. - In the Edit System Variable (or New System Variable) window, specify the value of the
PATH
environment variable. Click OK. Close all remaining windows by clicking OK.
Note: You may see a
PATH
environment variable similar to the following when editing it from the Control Panel:
%JAVA_HOME%\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem
Variables enclosed in percentage signs (%
) are existing environment variables. If one of these variables is listed in the Environment Variables window from the Control Panel (such as JAVA_HOME
), then you can edit its value. If it does not appear, then it is a special environment variable that the operating system has defined. For example,SystemRoot
is the location of the Microsoft Windows system folder. To obtain the value of a environment variable, enter the following at a command prompt. (This example obtains the value of the SystemRoot
environment variable):
echo %SystemRoot%
Update the PATH Variable (Solaris and Linux)
You can run the JDK just fine without setting the PATH
variable, or you can optionally set it as a convenience. However, you should set the path variable if you want to be able to run the executables (javac
, java
, javadoc
, and so on) from any directory without having to type the full path of the command. If you do not set the PATH
variable, you need to specify the full path to the executable every time you run it, such as:
% /usr/local/jdk1.7.0/bin/javac MyClass.java
To find out if the path is properly set, execute:
% java -version
This will print the version of the java
tool, if it can find it. If the version is old or you get the error java: Command not found, then the path is not properly set.
To set the path permanently, set the path in your startup file.
For C shell (csh
), edit the startup file (~/.cshrc
):
set path=(/usr/local/jdk1.7.0/bin $path)
For bash
, edit the startup file (~/.bashrc
):
PATH=/usr/local/jdk1.7.0/bin:$PATH
export PATH
For ksh
, the startup file is named by the environment variable, ENV
. To set the path:
PATH=/usr/local/jdk1.7.0/bin:$PATH
export PATH
For sh
, edit the profile file (~/.profile
):
PATH=/usr/local/jdk1.7.0/bin:$PATH
export PATH
Then load the startup file and verify that the path is set by repeating the java
command:
For C shell (csh
):
% source ~/.cshrc
% java -version
For ksh
, bash
, or sh
:
% . /.profile
% java -version
什么是java path环境变量的更多相关文章
- Java&Tomcat环境变量配置
版本匹配: Java PATH环境变量.作用是指定命令搜索路径,在shell下面执行命令时,它会到PATH变量所指定的路径中查找看是否能找到相应的命令程序.我们需要把 jdk安装目录下的bin目录增加 ...
- Java基础学习-Path环境变量的配置
1.为什么要进行Path环境变量的配置 程序的编译和执行需要使用到javac和java命令,所以只能在bin目录下写程序,而实际开发中,我们不可能将程序全部写到bin目录下,所以我们不许让 ...
- Windows系统环境变量之path环境变量(Java, Python环境变量配置)
系统: Windows10 path系统环境变量的作用: Windows和DOS操作系统中的path环境变量,当要求系统运行一个程序而没有告诉它程序所在的完整路径时,系统除了在当前目录下面寻找此程序外 ...
- java基础JDK jvm path环境变量
JDk=JRE +java的开发工具(javac.exe java.exe javadoc.exe)JRE =JVM +Java核心类库 2.为什么 要配置 path环境变量 ?如何配置?JAVA_H ...
- JAVA JDK安装及path环境变量配置
JDK安装 JVM :JAVA虚拟机 JRE :java运行环境=JVM+核心类库 JDK :JAVA开发工具包=JRE+java开发工具 java开发工具:编译工具(javac.exe) . 运行 ...
- 01-常见Dos命令、Java历史、Java跨平台、配置Path环境变量、第一个HelloWorld例子
常见Dos命令 dir: 列出当前目录下的文件以及文件夹 md: 创建目录 rd: 删除目录 cd: 进入指定目录 del: 删除文件 copy: 复制文件 xcopy: 复制目录 tree: 列出目 ...
- Windows系统中path环境变量详解
在学习JAVA的过程中,涉及到多个环境变量(environment variable)的概念,如PATH.正确地配置这些环境变量,是能够顺利学习.开发的前提.而经常出现的问题是:有的学习者能够按照提示 ...
- 如何快速有效的修改java的环境变量
之前已经修改过jdk的环境变量,,,,在/etc/profile下,,, export JAVA_HOME=/usr/java/jdk1.7.0_67-cloudera export PATH=${J ...
- 搞懂Path环境变量
path:环境变量 我们平时打开一个应用程序,一般是双击桌面图标或在开始菜单链接,无论是桌面的快捷图标还是菜单链接都包含了应用程序的安装位置信息,打开它们的时候系统会按照这些位置信息找到安装目录然后启 ...
随机推荐
- C# 通过反射来动态创建泛型类型
C# 通过反射来动态创建泛型类型与创建普通类型的区别在于:泛型参数的处理 创建泛型类型存在三种情况: 第一种:知道泛型类型,但需要动态指定泛型参数: 第二种:知道泛型参数,但需要动态创建指定参数的泛型 ...
- 大话ASP.NET开发(第一章 html5+css3+解耦问题的探讨)
一.拉近我们的距离 我想,很多人会问,如今IE6还占据颇多份额的中国,html5.css3是否还很遥远?我会很直接告诉他们:其实就在你的眼前.我们来看两个图: ...
- jQuery实用的语法总结
1.关于页面元素的引用 通过jquery的$()引用元素包括通过id.class.元素名以及元素的层级关系及dom或者xpath条件等方法,且返回的对象为jquery对象(集合对象),不能直接调用do ...
- Base64 字符串转图片 问题整理汇总
前言 最近碰到了一些base64字符串转图片的开发任务,开始觉得没啥难度,但随着开发的进展还是发现有些东西需要记录下. Base64 转二进制 这个在net有现有方法调用: Convert.FromB ...
- Ado.net[增删改查,GET传值]
1. <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Home.aspx.c ...
- Firemonkey 调整 MainMenu 字型大小 (D10)
修改 Windows 下的 Style,找到下面二个 Style ,修改其中的 text 内的 font 大小: 将 FMX.Menus.pas 复制到自己的工程目录内,再修改如下内容: constr ...
- JavaScript中JSON的处理心得
一门语言用到深处,就避免不了要对数据的类型进行准确判断,并针对其类型做正确处理. 抛开在Web前端环境不谈,从一门独立编程语言的角度来看js,你就会感受到对js中数据类型的理解有多么重要. 禁止直接多 ...
- 51Node 1065----最小正子段和
51Node 1065----最小正子段和 N个整数组成的序列a[1],a[2],a[3],…,a[n],从中选出一个子序列(a[i],a[i+1],…a[j]),使这个子序列的和>0,并且这 ...
- 让我们来讲讲,SCRUM和AGILE(资料来源:https://www.youtube.com/ 文中有代理参数配置)
本期我们讨论的主题是项目管理 以前,一直以为“ Write the code, Change the world ”.但实质上,我们就一写代码的.如果我们能上升到项目管理的角度来实行Project M ...
- Scalaz(6)- typeclass:Functor-just map
Functor是范畴学(Category theory)里的概念.不过无须担心,我们在scala FP编程里并不需要先掌握范畴学知识的.在scalaz里,Functor就是一个普通的typeclass ...