Results 1 to 2 of 2

Thread: Getting NoClassDefFoundError

  1. #1
    Join Date
    Apr 2007

    Getting NoClassDefFoundError

    Hi ,

    I am trying to print the class name of a class which is present in a jar file. I have set the class path of the jar so that I can access the class.

    Please see the code below :
    public class Test {
    	public static void main(String[] args) {
    	//extensionFunctionCallClass = net.sf.saxon.functions.ExtensionFunctionCall.class;
    		//ExtensionFunctionCall = net.sf.saxon.functions.ExtensionFunctionCall.class;
    		Class extensionFunctionCallClass = null;
    		try {
    			extensionFunctionCallClass =Class.forName("net.sf.saxon.functions.ExtensionFunctionCall");
    		} catch (ClassNotFoundException e) {
    			// TODO Auto-generated catch block
    		System.out.println("Test ==== >>>"+extensionFunctionCallClass);
    The exception I am getting is :
    java.lang.NoClassDefFoundError: java/lang/AssertionError
    	at java.lang.Class.forName1(Native Method)
    	at java.lang.Class.forName(Class.java:142)
    	at Test.main(Test.java:28)
    Exception in thread "main"

    Can somebody help me how do I print the class name without any exception please?


  2. #2
    Join Date
    Oct 2004
    The very depths of programming hell
    Strange, the stack trace seems to indicate that Class itself is throwing an Error which doesn't exist. It's trying to reference java.lang.AssertionError, but doesn't appear to be finding it.

    Try updating your version of java. Also, to print the actual class name, you need to print extensionFunctionCallClass.getName() rather than just the Class object.
    >I suck at this game, can you give me some pointers?

    >> 0x278AB4FF, 0xB5822BB4, 0xAD6E673D.

    > I hate you.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center