home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 1998 November
/
Chip_1998-11_cd.bin
/
tema
/
Cafe
/
PDESAMPL.BIN
/
Main3.java
< prev
next >
Wrap
Text File
|
1997-09-06
|
988b
|
34 lines
/*
* Main3.java
*
* Use reflection to get a Class object of class Hello3 and
* create an instance of it. Get a Method object that will
* invoke the method printHello() of class Hello. Note that
* with this code, the user does not need to link in the code
* from Hello3.java during compilation. The user, however,
* will have to register Hello3.dll first using the snjreg
* tool before running this code.
*/
package samples.dynamicDLL;
import java.lang.reflect.*;
public class Main3
{
public static void main( String args[] )
{
try
{
Class someClass = Class.forName( "samples.dynamicDLL.Hello3" );
Object someObject = someClass.newInstance();
Method someMethod = someClass.getMethod( "printHello", null );
someMethod.invoke( someObject, null );
}
catch( Exception e )
{
System.out.println( e.toString() );
}
}
}