Difference between classpath and build path (in Eclipse)

Is the Eclipse Properties> Java Build Path> project project tabs Libraries analogous to java -classpath ? What is the difference between an assembly string and a classpath?

+4
source share
2 answers

The classpath is a Java thing. This is a list of folder or jar files to consider (in order) when resolving loadable classes. It is used by the Java JVM. It can be specified by the CLASSPATH environment variable or java -classpath . This is a list of Jar files or folders, separated by ":" on Linux / OSX or ";" on Windows.

The Eclipse build path is a tool to create this Java classpath from artifacts in the Eclipse environment. The Configure Build Path dialog box is used to manage a file in a project called .classpath (usually hidden). In this dialog box, you can create a Java classpath from Jar files, files you created, folders, external Jar files, and more. It also controls where Java Development Tooling (JDT) will find your compiled files and other things related to class files. Eclipse help has some pretty good documentation.

+10
source

The class path is a place in memory where your class files and other resources (* .properties, * .xml, among many other types of resources) become available to programs running in the JVM.

The Eclipse build path is just a folder in which Eclipse will place the result of any build process: this process usually involves compiling the classes, but it can also include other steps, such as generating the code, depending on the -ins plug-in, which can be installed.

Since you can run your program from Eclipse, the build path and class path may contain the same resources. However, keep in mind that the "build path" is a representation of your resources in terms of the operating system's file system, and Classpath is a representation of your resources in terms of the Java virtual machine.

+3
source

Source: https://habr.com/ru/post/1392171/


All Articles