Category: Java/.NET Runtime

Q

Why does my application crash on startup?

A

In all likelihood, you have a bug in your application, either a runtime misconfiguration or a bug in your code. When you're starting out, there are some common mistakes that almost everyone makes, so don't feel too bad about it.

In addition, you're probably not handling all exceptions that you should be handling, therefore the first thing you should do is to surround all your code with a try/catch block:

try
{
    // all your code in Main() goes here
}
catch( Throwable t )
{
    Console.WriteLine( t.ToString() );
}
catch( JuggerNETException jne )
{
    Console.WriteLine( jne.ToString() );
}
                  

When you run your application again, hopefully it will only not work rather than crash. You might even get a good exception message out of this! Having such a top-level proxy exception handler in place in all threads on which you use proxy types is one of the top coding guidelines.

If you get a ClassNotFoundException, you have probably forgotten to configure the classpath to include your specific Java classes. If you're using explicit configuration, you should have something looking like this:

    loader.AppendToClassPath( "../lib/myapp.jar" );
    loader.AppendToClassPath( "../lib/myutil.jar" );

If you're using file-based configuration, you should have an element like this:

   <add key="AppendToClassPath" value="../lib/myapp.jar"/>   
   <add key="AppendToClassPath" value="../lib/myutil.jar"/>

 


Copyright 2006-2011 by Codemesh, Inc., ALL RIGHTS RESERVED

:
frequently asked questions
home products support customers partners newsroom about us contact us