Behzad
Behzad

Reputation: 123

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? What should I be pointing it towards?

Many thanks in advance!!

Upvotes: 0

Views: 11498

Answers (2)

pandorym
pandorym

Reputation: 485

The ClassPath environment variable is only used when you want your computer to look at a specific location for your .class files; 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. Most of the time.

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

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

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
  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

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

Upvotes: 2

AlexR
AlexR

Reputation: 115328

The difault of CLASSPATH environment 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.

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

Upvotes: 2

Related Questions