🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #14997

Re: Obtaining the package.

#14997
From: Tor Iver Wilhelmsen
Date: Fri, 23 Jul 1999 00:00
15 lines
1175 bytes
"Hugo Ferreira" <HugoF@cocaina.inescn.pt> writes:

> My problem is:
> Given only the class name and not the full path via a string, how can I get
> the Class ?

You _need_ the package name in order to get a Class: They don't exist
runtime without a fully qualified name. Java source lets you use
shortened names (via import) in your source, but they en up fully
qualified in the .class file.

If you do not know the package name, you cannot get the class. If you
know _something_ about the package: For instance, "it's the same
package as this class", then you can use the substring method and
append ".ClassName" before calling Class.forName().
Technical Details
Message-ID: <un1wn4ye8.fsf@sds.no>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <7n700i$mdu1@forums.borland.com> <uemi06gtg.fsf@sds.no> <7n74vv$mdu8@forums.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,1795c29638346898
X-Google-Attributes: gidf74b3,public
From: Tor Iver Wilhelmsen <tor.wilhelmsen@sds.no>
Subject: Re: Obtaining the package.
Date: 1999/07/23
Message-ID: <un1wn4ye8.fsf@sds.no>
X-Deja-AN: 504315558
Sender: towi@SDSA1761
References: <7n700i$mdu1@forums.borland.com> <uemi06gtg.fsf@sds.no> <7n74vv$mdu8@forums.borland.com>
Organization: Another Netscape Collabra Server User
Newsgroups: borland.public.jbuilder.java.language