How do I set or change the PATH system variable?
2015-04-24 01:49
281 查看
How do I set or change the PATH system variable?
This article applies to:Platform(s): Solaris SPARC, Solaris x86, Red Hat Linux, SUSE Linux, Windows 8, Windows 7, Vista, Windows XP
MORE TECHNICAL INFORMATION
The PATH is the system variable that your operating
system uses to locate needed executables from the command line or Terminal window.
The PATH system variable can be set using System Utility in control panel on Windows, or in your shell's startup file on Linux and Solaris.
SOLUTION
Making
changes to the system PATH variable is not typically necessary for computers running Windows or Mac OS X. The instructions below are intended for advanced users or system administrators only.
Setting Path on Windows
Windows 8
Drag the Mouse pointer to the Right bottom corner of the screen
Click on the Search icon and type: Control Panel
Click on -> Control Panel -> System -> Advanced
Click on Environment Variables, under System Variables, find PATH, and click on it.
In the Edit windows, modify PATH by adding the location of the class to the value for PATH. If you do not have the item PATH, you may select to add a new variable and add PATH as the name and
the location of the class as the value.
Close the window.
Reopen Command prompt window, and run your java code.
Windows 7
Select Computer from the Start menu
Choose System Properties from the context menu
Click Advanced system settings > Advanced tab
Click on Environment Variables, under System Variables, find PATH, and click on it.
In the Edit windows, modify PATH by adding the location of the class to the value for PATH. If you do not have the item PATH, you may select to add a new variable and add PATH as the name and
the location of the class as the value.
Reopen Command prompt window, and run your java code.
Windows XP
Start -> Control Panel -> System -> Advanced
Click on Environment Variables, under System Variables, find PATH, and click on it.
In the Edit windows, modify PATH by adding the location of the class to the value for PATH. If you do not have the item PATH, you may select to add a new variable and add PATH as the name and
the location of the class as the value.
Close the window.
Reopen Command prompt window, and run your java code.
Windows Vista
Right click My Computer icon
Choose Properties from the context menu
Click Advanced tab (Advanced system settings link in Vista)
In the Edit windows, modify PATH by adding the location of the class to the value for PATH. If you do not have the item PATH, you may select to add a new variable and add PATH as the name and
the location of the class as the value.
Reopen Command prompt window, and run your java code.
Setting Path on Solaris and Linux
To find out if the java executable is in your PATH, execute:
% java -version
This will print the version of the java executable, if it can find it. If you get error java: Command not found. Then path is not properly set.
To find out which java executable the first one found in your PATH, execute:
% which java
Below are the steps to set the PATH permanently,
Note: We are here giving instructions for two most popular Shells on Linux and Solaris.
Please visit link below if you are using any other shells.
Path Setting
Tutorial
For bash Shell:
Edit the startup file (~/ .bashrc)
Modify PATH variable:
PATH="$PATH":/usr/local/jdk1.6.0/bin
export PATH
Save and close the file
Open new Terminal window
Verify the PATH is set properly
% java -version
For C Shell (csh):
Edit startup file (~/ .cshrc)
Set Path
set path="$PATH":/usr/local/jdk1.6.0/bin
Save and Close the file
Open new Terminal window
Verify the PATH is set properly
% java -version
相关文章推荐
- How to change the default run level of a RedHat 9.0 or Fedora Core Linux system
- Linux安装Python-MySQL 遇到(set with .set_extraction_path or the PYTHON_EGG_CACHE environment variable).
- tensorflow编译错误Cannot find gcc or CC (gcc -std=gnu99), either correct your path or set the CC environment variable
- 设置页面的默认焦点控件和默认接受事件控件How Do I Set the DefaultFocus or DefaultButton in a Page Based on a Master Page in ASP.NET 2.0
- Linux: Set OR Change The Library Path
- How to fix the issue that GEM_HOME and/or GEM_PATH not set issue for rvm in mac version 10.12
- How to Change Default Grub Theme or Splash Image in Ubuntu 10.10
- CentOS 7 /RHEL 7: How To Change The System Locale
- how-to-set-environment-path-variable
- How to Change Default Grub Theme or Splash Image in Ubuntu 10.10
- How to Change the Default System Fonts
- The path to the driver executable must be set by the webdriver.gecko.driver system property;
- Why doesn't AlTER SYSTEM SET EVENTS set the events or tracing immediately?
- How do I set the driver's python version in spark?
- PHP executable not found. Install PHP 7 and add it to your PATH or set the php.executablePath s
- How do I add new state and change the workflow of Purchase Order?
- 如何Eclipse改变模板中${user}变量,How to change the variable ${user} used in the eclipse templates.
- Home not found. Define system property "openfireHome" or create and add the openfire_init.xml file to the classpath
- The steps for setting up the system environment path variable for VS 2010 & .NET 4.0
- change the system enveriment path under Ubuntu