Skip to Main Content

Java HotSpot Virtual Machine

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to load class from jar file dynamically?

843811Jul 31 2002 — edited Aug 1 2002
After I run my Java applicatoin, I need configuring the classpath of jvm to load some classess inside a jar file into the same jvm.How can I achive that?
I mean, when I run my Java application, I don't know where the jar file is, what the jar file name is. All depends on the user to tell the jvm the details through some UI. I've tried to write: System.setProperty("java.class.path", "c:\myClass.jar");Class.forName("MyClass"); but failed.
Can you tell my why and how?
Thx
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 29 2002
Added on Jul 31 2002
3 comments
274 views