Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Inner class instantiation


  • From: NRothwell@xxxxxxxxxxx (Nick Rothwell)
  • Subject: Inner class instantiation
  • Date: Thu, 30 Sep 1999 16:15:36 +0100

Is there any reason why an inner class cannot be instantiated using
Class.forName(name).newInstance()? The inner class is static (so it doesn't
need an enclosing instance's context) and it is public, as is its enclosing
class. With something like

package com.Foo;

public class Outer
{
	public static class Inner { .... };
}

I should be able to instantiate a "com.Foo.Outer.Inner" but I'm getting
ClassNotFoundError. The Java spec. suggests that this is the right naming
convention (dotted separator between class names) but it's ambiguous with
the package structuring, so maybe that's the problem?

(As to why I'm doing this: it's in an internal testset, and I really want
one file and class per test.)


---
To unsubscribe, mail advanced-java-unsubscribe@xxxxxxxxxxxxxxxx
To get help, mail advanced-java-help@xxxxxxxxxxxxxxxx