简体   繁体   English

Java默认的ClassPath环境变量

[英]Java default ClassPath environment variable

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? 我不小心在Windows系统属性中更改了我的Classpath环境变量,现在在执行时遇到很多错误,默认值是什么? What should I be pointing it towards? 我应该把它指向什么?

Many thanks in advance!! 提前谢谢了!!

The difault of CLASSPATH environment variable is nothing, ie by default this variable does not exist. CLASSPATH环境变量的含义为空,即默认情况下该变量不存在。 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. 如果您不知道,请尝试分析堆栈跟踪并了解应用程序正常运行所需的内容。

If you have problems, send your stack trace here and we will try to help you. 如果您有问题,请在此处发送堆栈跟踪,我们将尽力为您提供帮助。

The ClassPath environment variable is only used when you want your computer to look at a specific location for your .class files; 仅当您希望计算机查看.class文件的特定位置时才使用ClassPath环境变量。 generally speaking, it doesn't exist unless you make it exist, whether on purpose or a side effect of some installer. 一般来说,它是不存在的,除非您将其存在,无论是有意还是某些安装程序的副作用。

Most of the time, the applications you are running (primarily JRE), know exactly where to look for .class files. 大多数时候,您正在运行的应用程序(主要是JRE)确切地知道在哪里查找.class文件。 Most of the time. 大多数时候。

However, if you were refering to the PATH environmental 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 PATH this 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 System on the far left, and there is an Enviromental Variables button near the bottom, click it 最左侧的高级系统 ,底部附近有一个环境变量按钮,单击它
  3. In the bottom context menu, find the PATH variable and choose edit 在底部的上下文菜单中,找到PATH变量,然后选择“ edit”。
  4. Put a semicolon after the last one, and then add " C:\\Program Files\\Java\\jre7\\lib ;" 在最后一个之后加上分号,然后添加“ C:\\ Program Files \\ Java \\ jre7 \\ lib ;” and " C:\\Program Files\\Java\\jre7\\bin ;" 和“ C:\\ Program Files \\ Java \\ jre7 \\ bin ;” or wherever your java "lib" and "bin" folders are 或您的Java“ lib”和“ bin”文件夹所在的位置

And then you should be all swell and dandy, no harm no fowl. 然后,您应该全神贯注,没有伤害也没有家禽。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM