简体   繁体   中英

Eclipse ignoring the CLASSPATH variable?

I had the idea any java application would look up the CLASSPATH variable to check for classes at runtime.

But that does not seem to be the case, as a application I'm running from Eclipse. In which concrete situations is the CLASSPATH variable used, then? How can I make sure Eclipse always makes use of my CLASSPATH variable?

The CLASSPATH variable is used when the java (or javaw) command is launched without the -classpath or -jar or -cp option. But Eclipse follows best practices, and always uses these options.

IMHO, you should NEVER rely on CLASSPATH. Always specify the classpath explicitely, in the command line options. It's quite rare to want ALL your java programs to share the same libraries. That's why the CLASSPATH global environment variable is a bad idea.

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