1
when we install JDK, we create an environment variable called CLASSPATH, which has as its value the JAVA_HOME variable, which in turn has the address of jdk, which contains all libraries for Java development, correct?
This serves for the Java compiler to locate the libraries needed to compile a Java application on that machine, correct?
Question 1: To run a Java application, does JVM also search the Classpath for libraries to execute? Or the Java executable already contains all the information JVM needs?
Question 2: At the same time, when we create a Java project, in Eclipse, for example, the eclipse generates two files inside the . JAR: the . project and the .classpath. That one .classpath is particular to each Java project right? And it also has the function of pointing out the location of resources (libraries) for compilation, or execution or 2, I do not know, correct? But isn’t it enough that the CLASSPATH environment variable exists for the compiler to know where to look for resources? Or each project has a file .classpath because I can have libraries that are not on the path pointed by the environment variable?
So this . classpath file that you have in each project folder is just Eclipse usage, right? I opened one to see and found that it points to a "Container" that would be an eclipse plugin that has reference to all these libraries. This would be so that I don’t need to reference all libraries in all the . classpath of all the right projects?
– Lucas Pletsch
Another thing, when you say that the CLASSPATH variable is "used to indicate where to look for user CLASSES", do you mean the classes in my project or the Java libraries? Because I opened a MANIFEST and its "Classpath" field only has one point. Yes, I’m lost yet. kkkk
– Lucas Pletsch