简体   繁体   中英

Java Classpath at Runtime

I am importing import org.apache.commons.httpclient.*; in a program, but whenever I go to run it, I have to include the JAR in the classpath. Why is this necessary? Are there any ways around this?

I suspect that it's as simple as Tomcat, by virtue of being a web server, links libraries that it (it == the java people) think that people making servlets will need and want but that would be superfluous for normal standalone java apps. Maybe one day it'll become a part of the JRE itself?

It might also be included in Tomcat's lib/ folder by default - I'm not sure.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM