Hi you guys.
 I need to load a package(either jar or zip file). Well i have an standalone
application and i have implemented two abstract classes, needed to extend
the application by addind plug-ins to it(i meant extending from those two
classes). So when someone has built his own plugin, could add it to my app.
There is the problem.
How may i load his jar file..? and add to my classpath, or  load it in the
way that later i could make a Class.forName to the plugable class in that
package....
supose

abstract class basePlugableClass {

.........

 static public basePlugableClass getNewInstance(String className)
 throws IllegalAccessException{
 try{
  Object objClass=Class.forName(className).getNewInstance();
  if(objClass instanceof basePlugableClass)
    ((createPlugableClass)objClass).createPlugableClass();
  return (basePlugableClass)objClass;
 }catch(ClassNotFoundException e){
  System.out.println("There 's not class for load.");
  return null;
 }
 }
 abstract protected void createPlugableClass();
}

.....some app place
...load the user's package("//somefile.jar"); #either zip file.
basePlugableClass
plugin=basePlugableClass.getNewInstance("somefile.myPlugIn"); # note that
the requested class is in the somefile.jar(also it is it's package name)
i tried set my classpath through the System class by changing the
"java.class.path" property but it does'nt work, not at all.

well i hope you to understand what i need, and sorry for an off-topic
question, and also for my english.
any help will be appreciate
------------------------------------------------------
Romel Calero Ramos
Est. Ciencia de la Computaci�n
Universidad de La Habana

_______________________________________________
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing

Reply via email to