什么是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:环境变量 我们平时打开一个应用程序,一般是双击桌面图标或在开始菜单链接,无论是桌面的快捷图标还是菜单链接都包含了应用程序的安装位置信息,打开它们的时候系统会按照这些位置信息找到安装目录然后启 ...
随机推荐
- SQL Server 2014如何提升非在线的在线操作
在今天的文章里,我想谈下在线索引重建操作( Online Index Rebuild operations),它们在SQL Server 2014里有怎样的提升.我们都知道,自SQL Server 2 ...
- 实现iOS图片等资源文件的热更新化(零): 序
必要的序 以后在写系列文章,准备把基本的规划和动机等,单独作为一个小的序言部分给独立出来.序言部分,可以较为完整地交待系列文章的写作动机,所展示的编码技术可能的应用场景等.个人,我还是比较看重文章或者 ...
- c#中的正则表达式
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...
- Entity Framework 实体框架的形成之旅--实体框架的开发的几个经验总结
在前阵子,我对实体框架进行了一定的研究,然后把整个学习的过程开了一个系列,以逐步深入的方式解读实体框架的相关技术,期间每每碰到一些新的问题需要潜入研究.本文继续前面的主题介绍,着重从整体性的来总结一下 ...
- Web API应用架构设计分析(2)
在上篇随笔<Web API应用架构设计分析(1)>,我对Web API的各种应用架构进行了概括性的分析和设计,Web API 是一种应用接口框架,它能够构建HTTP服务以支撑更广泛的客户端 ...
- EasyUI-datagrid数据展示+MongoDB数据操作
使用EasyUI-datagrid进行数据展示:进行添加,修改,删除操作逻辑代码,数据源来自MongoDB. 一.新建SiteInfo控制器,添加Index页面:http://www.cnblogs. ...
- 第 29 章 CSS3 弹性伸缩布局[下]
学习要点: 1.新版本 主讲教师:李炎恢 本章主要探讨 HTML5 中 CSS3 提供的用来实现未来响应式弹性伸缩布局方案,这里做一个初步的了解. 一.新版本 新版本的 Flexbox 模型是 201 ...
- CI框架源码阅读笔记5 基准测试 BenchMark.php
上一篇博客(CI框架源码阅读笔记4 引导文件CodeIgniter.php)中,我们已经看到:CI中核心流程的核心功能都是由不同的组件来完成的.这些组件类似于一个一个单独的模块,不同的模块完成不同的功 ...
- Myeclipse10下载,安装,破解,插件,优化介绍
一.Myeclipse10下载与破解 Genuitec 公司发布了MyEclipse 10,一款Genuitec旗下的商业化Eclipse集成开发工具的升级版本.MyEclipse 10基于Eclip ...
- Java继承和接口
接口最关键的作用,也是使用接口最重要的一个原因:能上溯造型至多个基础类.使用接口的第二个原因与使用抽象基础类的原因是一样的:防止客户程序员制作这个类的一个对象,以及规定它仅仅是一个接口.这样便带来了一 ...