Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-01-2007, 05:30 PM
Member
 
Join Date: Aug 2007
Posts: 6
palindrome is on a distinguished road
Use classes without recompiling?
Hi, I have a situation where I'd like to use classes without having to compile them into my program (they may be created afterward). My program knows the superclass, so I am creating them with Class.forName and invoking the constructor then casting the resulting object.

However, simply giving the class name as a string doesn't tell my program how to actually find the classes. I thought of uncompressing the jar file, adding the classes to the manifest and then recompressing the jar file, which is better than having to recompile, but I'd prefer something simpler, like editing a file outside of the jar.

Is there a simple way to do this?
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 08-02-2007, 01:33 AM
Senior Member
 
Join Date: Jul 2007
Posts: 134
brianhks will become famous soon enough
As long as the classes are in the class path your good to go. You could put your classes in one jar and then the others that come later you could put in a second jar file. As long as both are in the classpath when your program starts everything should be good.

You could also use the Class-Path: option in your manifest to include the other jar as well.
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 08-02-2007, 12:26 PM
Member
 
Join Date: Aug 2007
Posts: 6
palindrome is on a distinguished road
Thanks, I think I'll be able to get this working.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using a JAR from other classes Joe2003 Advanced Java 1 01-02-2008 08:08 PM
Objects and Classes Aleve New To Java 8 12-31-2007 09:05 AM
Help for dynamic classes Bender Advanced Java 1 12-19-2007 09:46 PM
When do we use inner classes? cruxblack New To Java 5 08-10-2007 06:00 PM
EJB, classes Model Felissa Enterprise JavaBeans 1 07-06-2007 04:17 PM


All times are GMT +3. The time now is 01:11 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org