🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.java.help
Article #78

Re: Dynamically load and instantiate unknown classes at runtime.

#78
From: Matt the Rat
Date: Sat, 20 Mar 1999 00:00
13 lines
1100 bytes
Brent Peckover wrote in message <36F3DDDE.2FF6DBD4@archiveware.net>...
>How do I tell Java to Load a class (say I get the required class name
>out of a text file at runtime), create an instance of the class, and
>then call the new instance's methods (which may also be listed in the
>file)?


Look at the java.lang.reflect package and the Class class, in particular
Class.forName and Class.newInstance.

--
Matt the Rat
Reply to matt DOT helliwell AT net DOT ntl DOT com
Technical Details
Message-ID: <7d100o$6i4$2@nclient5-gui.server.ntli.net>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <36F3DDDE.2FF6DBD4@archiveware.net>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 113ae9,59c3d3f2dc30d0e6
X-Google-Attributes: gid113ae9,public
X-Google-Thread: f74b3,59c3d3f2dc30d0e6
X-Google-Attributes: gidf74b3,public
From: "Matt the Rat" <see@sig.nospam>
Subject: Re: Dynamically load and instantiate unknown classes at runtime.
Date: 1999/03/20
Message-ID: <7d100o$6i4$2@nclient5-gui.server.ntli.net>
X-Deja-AN: 456994289
References: <36F3DDDE.2FF6DBD4@archiveware.net>
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
Organization: Cable Online
Newsgroups: comp.lang.java.help,borland.public.jbuilder.java.language