Solved

Classpath and Path -  Looking for Mr or Ms Clear Explanation

Posted on 2002-03-26
7
181 Views
Last Modified: 2012-05-04
Hi,
What is the difference between the path and classpath? I am trying use Choice.exe from the windows resource kit,in a batch file and I want to add it to the path classpath. Which one and why? Thank you,
diek
0
Comment
Question by:diek_nf
  • 3
  • 2
  • 2
7 Comments
 
LVL 3

Accepted Solution

by:
lpenrod earned 150 total points
ID: 6898286
CLASSPATH is the environmental variable defined for the Java run-time system. Java run-time system is looking for class file in the directories which you included in the CLASSPATH.  PATH variable is separate from CLASSPATH. Your system is looking for executable files in the directories that are in PATH variable.

You can set either of them in a batch file using sytax similar to below:

PATH=c:\path\i\want\to\add;%PATH%

OR

CLASSPATH=c:\path\i\want\to\add;%CLASSPATH%
0
 
LVL 44

Expert Comment

by:CrazyOne
ID: 6898455
Hi diek_nf. You can also do it this way. Open My Computer > Properties > Advanced > Enviroment Variables. You will see two lists "User Variables for ..." and "System Variables". Under each you should see in the list "PATH" double click it from the list you want to add the path. Note there are probably several paths already listed. First see if the path you want to list is already listed. Second if it is not then add the path starting with the semicolon ; and then the path at the end of the path line.

Here is a samplie of my System Variables Path

C:\DEVELO~2\Delphi\DELPHI~2\Projects\Bpl;C:\DEVELO~2\Delphi\DELPHI~2\Bin;C:\Development\Delphi\DELPHI~1\Projects\Bpl;C:\Gblware\sqlany;C:\Development\Delphi\DELPHI~1\Bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\Support Tools\


The Crazy One
0
 

Author Comment

by:diek_nf
ID: 6899051
Guys,
Thanks. Just a little background, I am somewhere between beginner and advanced in NT knowledge. NT is an everyday learning experience, knowledge gained in part by this site. So....

Ipenrod,
Is classpath only used in java? I had Oracle installed, and I seem to recall seeing that in the Classpath.

Guys,
So if I want programs to be available at the command prompt, i have to add them to the path variable? Crazy for example has C:\Program Files\Support Tools\. To house his favorite command line utilities???

I look fwd to hearing back fro u guys,
diek
0
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 
LVL 44

Expert Comment

by:CrazyOne
ID: 6899090
>>>So if I want programs to be available at the command prompt

In a manner of speaking. All this really does is let you enter the name of the exe of bat or com file to run instead having to enter the enitre path from the command line. Lets say you put your choice.exe in the C:\Program Files\Support Tools\. Now you get to a commmand prompt and type in choice.exe then this should run the exe. Otherwise you would have to enter it this way C:\Program Files\Support Tools\choice.exe.    
0
 
LVL 3

Expert Comment

by:lpenrod
ID: 6899094
I am only familiar with classpath in the context of java.  It is entirely possible that it is used for anything that wants to.

Yes, if you try to launch an executable from the command line, the system looks for it first in the current directory and if it can not be found there, then the path is searched.  Some windows based apps also use the path to search for program components such as dlls, etc...

Yes, if you put command line utilities in C:\Program Files\Support Tools and also add that path to your PATH, then you will always be able to run them from the command line regardless of your current directory.
0
 

Author Comment

by:diek_nf
ID: 6899114
I,
Thanks.

Crazyman,
I said it first. I do like your idea of creating a support tools folder. thanks,

diek
0
 
LVL 44

Expert Comment

by:CrazyOne
ID: 6899130
Its funny but somthing else I installed created the Support tools folder. I think it had something to do with MS reskit of Support kit. :>)
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
Cloud-based technologies and services will continue to grow in popularity in 2017 thanks to the simple, scalable and cost-effective solutions they deliver. Here are three areas where cloud adoption is poised to really take off.
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now