Java 默认 ClassPath 环境变量

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14855835/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-31 17:38:34  来源:igfitidea点击:

Java default ClassPath environment variable

javaclasspathdefault

提问by Behzad

I accidentally changed my Classpath environment variable in Windows system properties and am now getting a heap of errors on execution, what is the default? What should I be pointing it towards?

我不小心更改了 Windows 系统属性中的 Classpath 环境变量,现在执行时出现一堆错误,默认值是多少?我应该把它指向什么?

Many thanks in advance!!

提前谢谢了!!

回答by AlexR

The difault of CLASSPATHenvironment variable is nothing, i.e. by default this variable does not exist. If you had something defined you should know what did you define. If you do not know, try to analyze your stack trace and understand what is needed to your application to work.

的difaultCLASSPATH环境变量是什么,即在默认情况下此变量不存在。如果你定义了一些东西,你应该知道你定义了什么。如果您不知道,请尝试分析您的堆栈跟踪并了解您的应用程序需要什么才能工作。

If you have problems, send your stack trace here and we will try to help you.

如果您遇到问题,请在此处发送您的堆栈跟踪,我们将尽力为您提供帮助。

回答by pandorym

The ClassPathenvironment variable is only used when you want your computer to look at a specific location for your .classfiles; generally speaking, it doesn't exist unless you make it exist, whether on purpose or a side effect of some installer.

ClassPath当你想你的电脑看你的特定位置的环境变量只使用.class文件; 一般来说,它不存在,除非你让它存在,无论是故意的还是某些安装程序的副作用。

Most of the time, the applications you are running (primarily JRE), know exactly where to look for .classfiles. Most of the time.

大多数情况下,您正在运行的应用程序(主要是 JRE)知道在哪里查找.class文件。大多数时候。

However, if you were refering to the PATHenvironmental variable, that can be more of an issue.

但是,如果您指的是PATH环境变量,那可能更成问题。

Oracle has a throughout step-by-step on setting your enviromental variables (I can vouch, I just had to reset my PATHthis morning): http://docs.oracle.com/javase/tutorial/essential/environment/paths.html

Oracle 有一个关于设置环境变量的完整步骤(我可以保证,我PATH今天早上只需要重置我的):http: //docs.oracle.com/javase/tutorial/essential/environment/paths.html

However, here are the steps as I remember them:

但是,这是我记得的步骤:

  1. Start Menu, right click Computer, Choose Properties
  2. Advanced Systemon the far left, and there is an Enviromental Variablesbutton near the bottom, click it
  3. In the bottom context menu, find the PATHvariable and choose edit
  4. Put a semicolon after the last one, and then add "C:\Program Files\Java\jre7\lib;" and "C:\Program Files\Java\jre7\bin;" or wherever your java "lib" and "bin" folders are
  1. 开始菜单,右击计算机,选择属性
  2. 最左边的高级系统,底部附近有一个环境变量按钮,点击它
  3. 在底部的上下文菜单中,找到PATH变量并选择编辑
  4. 在最后一个后加一个分号,然后添加“ C:\Program Files\Java\jre7\lib;” 和“ C:\Program Files\Java\jre7\bin;” 或者你的java“lib”和“bin”文件夹在哪里

And then you should be all swell and dandy, no harm no fowl.

然后你应该是个漂亮的花花公子,无害无家禽。