Results 1 to 3 of 3
  1. #1
    palindrome is offline Member
    Join Date
    Aug 2007
    Posts
    6
    Rep Power
    0

    Default 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?

  2. #2
    brianhks is offline Senior Member
    Join Date
    Jul 2007
    Posts
    135
    Rep Power
    0

    Default

    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.

  3. #3
    palindrome is offline Member
    Join Date
    Aug 2007
    Posts
    6
    Rep Power
    0

Similar Threads

  1. Using a JAR from other classes
    By Joe2003 in forum Advanced Java
    Replies: 1
    Last Post: 01-02-2008, 07:08 PM
  2. Objects and Classes
    By Aleve in forum New To Java
    Replies: 8
    Last Post: 12-31-2007, 08:05 AM
  3. Help for dynamic classes
    By Bender in forum Advanced Java
    Replies: 1
    Last Post: 12-19-2007, 08:46 PM
  4. When do we use inner classes?
    By cruxblack in forum New To Java
    Replies: 5
    Last Post: 08-10-2007, 05:00 PM
  5. EJB, classes Model
    By Felissa in forum Enterprise JavaBeans (EJB)
    Replies: 1
    Last Post: 07-06-2007, 03:17 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •