Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between setting the classpath and java build path in eclipse?

What are the different ways that java programs gain access to external libraries. There is setting a classpath, modifying the build or build path, but I've seen other ways of adding jars.

Why do some libraries have to be added to the classpath while others do not. For example I'm using JSF, WTP tools, and other extra libraries but they are not in my buildpath when I view the build path of my project.

like image 647
Randnum Avatar asked Nov 18 '11 16:11

Randnum


People also ask

Is path and classpath same?

The main difference between PATH and CLASSPATH is that Path is set for java tools in java programs like java and javac, which are used to compile your code. Whereas CLASSPATH is used by System or Application class loader to locate and load compile Java bytecodes stored in the . class file.

What is the use of Java build path in Eclipse?

The build path is used for building your application. It contains all of your source files and all Java libraries that are required to compile the application. But javac takes a classpath argument.

What is the difference between path and classpath in Java?

PATH is used by CMD prompt to find binary files. CLASSPATH is used by the compiler and JVM to find library files.

What is the difference between classpath and build path?

Answer. Build path is used by the compiler to resolve dependencies and build a project. Classpath is used during runtime when running a project in order to find necessary dependencies. Build path is configured on the Java Build Path property page of a project.


1 Answers

The classpath is used to find classes when executing a Java program. The build path is used when Eclipse is compiling a Java program.

like image 91
Jack Edmonds Avatar answered Nov 18 '22 12:11

Jack Edmonds