Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
I was playing with some code to make a "closure like" construct ( not working btw ) Everything looked fine but when I tried to access a final local variable in the code, the exception InstantiationException is thrown. If I remove the access to the local variable either by removing it altogether or by making it class attribute instead, no exception happens. The doc says: InstantiationExcep...
Is there any possibility of exceptions to occur other than RuntimeException in Java? Thanks.
I have a class X, which has 2 constructors. One constructor accepts single argument of type String, other constructor accepts single argument of a type Y. Now when I try to instansiate class X from spring using constructor-args and passing it value of type java.lang.String I get Instantiation Exception. What can be cause for this?
I'm new to OSGi and am building a first DS-implementation. Everything is coded according to "the book" but when running I get this error: java.lang.InstantiationException: com.mine.logger.internal.udp.UdpListener at java.lang.Class.newInstance0(Unknown Source) at java.lang.Class.newInstance(Unknown Source) at org.eclipse.equinox.internal.ds.model.ServiceComponent.createInstance(ServiceCompone...
 /*
  * Copyright 1995-2005 Sun Microsystems, Inc.  All Rights Reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Sun designates this
  * particular file as subject to the "Classpath" exception as provided
  * by Sun in the LICENSE file that accompanied this code.
 *
 * This code is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * version 2 for more details (a copy is included in the LICENSE file that
 * accompanied this code).
 *
 * You should have received a copy of the GNU General Public License version
 * 2 along with this work; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
 * CA 95054 USA or visit www.sun.com if you need additional information or
 * have any questions.
 */
package java.lang;

Thrown when an application tries to create an instance of a class using the newInstance method in class Class, but the specified class object cannot be instantiated. The instantiation can fail for a variety of reasons including but not limited to:
  • the class object represents an abstract class, an interface, an array class, a primitive type, or void
  • the class has no nullary constructor

Author(s):
unascribed
Since:
JDK1.0
See also:
Class.newInstance()
public
class InstantiationException extends Exception {
    
Constructs an InstantiationException with no detail message.
    public InstantiationException() {
        super();
    }

    
Constructs an InstantiationException with the specified detail message.

Parameters:
s the detail message.
    public InstantiationException(String s) {
        super(s);
    }
New to GrepCode? Check out our FAQ X