rubixibuc
rubixibuc

Reputation: 7417

Trying to set the class path in linux

I found the location of my JRE it is

/usr/local/jdk1.7.0_03/jre

but where are all the class files stored? What should I set the class path to, this?

Also does Java with an empty class path still look in the default directories used during install?

Can jars when launched contain meta data that specifies the class path ahead of time?

Upvotes: 1

Views: 215

Answers (1)

Phani
Phani

Reputation: 5427

Java traces the several directories to find the classes required for a program.This is the sequence of searching:

1) <JDK/JRE>/lib
2) <JDK/JRE>/lib/ext
3) Current directory
4) Additional jars or classes with -cp argument while compiling or executing.

If it doesn't find any of those directories, then it would simply through ClassNotFoundException

Can jars when launched contain meta data that specifies the 
class path ahead of time?

Ans:Yes. When compiling or building a jar, one could pass several arguments to mark the main class if it's a executable jar and also the META-INF of the environment etc.

Please go through the link on META-INF information for a jar management.META-INF Info in Java

Upvotes: 1

Related Questions