answersLogoWhite

0

1))What is the difference between "path" and "classpath"? Ans:: We keep all "executable files"(like .exe files) and "batch files"(like .bat) in path variable. And we keep all jar files and class files in classpath variables. So path is set according to the .exe files & .bat files And classpath is set according to the .jar files & .class files.

Operating system tries to find .exe and .bat files in path and JVM tries to find all classes in classpath.

User Avatar

Wiki User

15y ago

Still curious? Ask our experts.

Chat with our AI personalities

TaigaTaiga
Every great hero faces trials, and you—yes, YOU—are no exception!
Chat with Taiga
ReneRene
Change my mind. I dare you.
Chat with Rene
SteveSteve
Knowledge is a journey, you know? We'll get there.
Chat with Steve
More answers

first of all java program compilation purpose can totaly search in java classes in there classes not available the class so generate the error so avoid the that error javac next check the classpath and after path will be checked path also correct the progarm automatically process otherwise not run the programs.

PATH is required to locate "java" and "javac" command which is used to compile and run java classes

CLASSPATH is used by Classloaders to load classes.

User Avatar

Wiki User

12y ago
User Avatar

java is object oriented language which work on classes and interfaces. To find the definitions of objects and method JVM (java virtual machine) compiler required class files or interface file. And compiler only search in set path locations. Hence to give reference of particular class in specific location we have to set the path every time to new application.

User Avatar

Wiki User

12y ago
User Avatar

To set the Java classpath during compilation or execution of a Java program:

javac -cp <classpath> <source files>

java -cp <classpath> <main class>

User Avatar

Wiki User

16y ago
User Avatar

Add your answer:

Earn +20 pts
Q: Why path and class-path in java?
Write your answer...
Submit
Still have questions?
magnify glass
imp