Confusion in understanding classpath

筅森魡賤 提交于 2019-12-11 12:24:27

问题


I'm confused in understanding, how java interpretor and java compiler searches for all the necessary jar files it requires from environment variables. As I have only set the set path variable for JDK directory, but I've not set any variable to search for any class libraries, which jvm requires. How can it search those important jar files?


回答1:


Which jar files are you talking about? Java already knows about the jar files it "owns" (such as rt.jar) - you don't have to tell it about them explicitly. This is known as the bootclasspath - you can override it, but usually you don't want to.




回答2:


For better understanding of how classes are found and loaded by JVM read this.

http://java.sun.com/j2se/1.3/docs/tooldocs/findingclasses.html




回答3:


CLASSPATH is an enviromental variable is like the path file (which helps windows to find executables). It lists a set of all places the JVM looks for classes. You can also give the classpath on the command line when starting the jvm and java compiler



来源:https://stackoverflow.com/questions/2198257/confusion-in-understanding-classpath

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!