Hello all,

very useful forum you guys have here. maybe you might be able to help me with an issue i am having with a program i am writing? I am trying to dynamically load a class that the user specifies. I am coding in standard java 1.5 and swing. what i have found so far is as follows...

   Class c = Class.forName( "com.mindprod.mypackage.Myclass" );
   Thing t = (Thing)c.newInstance( );
The forName() method takes a String that is the *NAME* of the class, my program uses a JFileChooser and the method getSelectedFile that returns a (.class) File that needs to be dynamicaly loaded. I need a way to do this, some thought would be...

* Get the path of the returned file and somehow turn it into a class name.
* Some other way of loading a class based upon the file path not name.

If anyone has any ideas i will be very grateful,

Thanks heaps,