how can I catch the exception of Class.forName? 
Author Message
 how can I catch the exception of Class.forName?

I'm writing a database applet.
This applet uses RMIJDBC.
Because the IE doesn't support the RMIJDBC properly, I have to download and
install the patch from the microsoft ftp server.
after this, it works.

BUT:
Of course there may be user who wants to use the applet from a machine which
has no RMICJBC installation from the microsoft ftpo server.
so, if the user wants to use the applet, I have to warn him to install the
RMI patch first.

in the source code I load the driver with this line:

            Class.forName("RmiJdbc.RJDriver").newInstance();

If the driver is properly installed on the client it works.
If the driver isn't properly installed on the client it gives me an error
message:

java.io.FileNotFoundException:
sawd21557nmp:80//test/rmi_test/java/rmi/NotBoundException.class
java.lang.NoClassDefFoundError: java/rmi/NotBoundException

my problem is, I CAN'T catch this error message:

try{
    Class.forName("RmiJdbc.RJDriver").newInstance();

Quote:
}

catch (Exception e){
    System.out.println("BIG ERROORRRRR");

Quote:
}

It doesn't work. if I try to use the applet without installed RMI patch, the
applet will stop after the forName but the catch block doesn't catch the
error.

What's wrong?



Sat, 13 Apr 2002 03:00:00 GMT
 how can I catch the exception of Class.forName?

An Error is different from an Exception. You are not expected to recover
from an Error but there is a way.

      try {
        byte[] frame = new byte[2147483647];
      }
      catch (Error e){
        e.printStackTrace();
      }

You should get a

java.lang.OutOfMemoryError

 <<no stack trace available>>

Hopefully, you are able to catch your Error with this code segment. I was
not able to duplicate your condition running as a application and it's
really too troublesome for me to rig it as an applet :)

Or maybe this is one of those MS "Java" only errors?


Quote:
> I'm writing a database applet.
> This applet uses RMIJDBC.
> Because the IE doesn't support the RMIJDBC properly, I have to download
and
> install the patch from the microsoft ftp server.
> after this, it works.

> BUT:
> Of course there may be user who wants to use the applet from a machine
which
> has no RMICJBC installation from the microsoft ftpo server.
> so, if the user wants to use the applet, I have to warn him to install the
> RMI patch first.

> in the source code I load the driver with this line:

>             Class.forName("RmiJdbc.RJDriver").newInstance();

> If the driver is properly installed on the client it works.
> If the driver isn't properly installed on the client it gives me an error
> message:

> java.io.FileNotFoundException:
> sawd21557nmp:80//test/rmi_test/java/rmi/NotBoundException.class
> java.lang.NoClassDefFoundError: java/rmi/NotBoundException

> my problem is, I CAN'T catch this error message:

> try{
>     Class.forName("RmiJdbc.RJDriver").newInstance();
> }
> catch (Exception e){
>     System.out.println("BIG ERROORRRRR");
> }

> It doesn't work. if I try to use the applet without installed RMI patch,
the
> applet will stop after the forName but the catch block doesn't catch the
> error.

> What's wrong?



Sat, 13 Apr 2002 03:00:00 GMT
 
 [ 2 post ] 

 Relevant Pages 

1. Oracle Aurora and Class.forName

2. Class.forName() and DriverManager.registerDriver()

3. Cant load driver with Class.ForName()

4. JDBC-ODBC Class.forName() Error

5. Class.forName and MS Access

6. What is Class.forName?

7. Class.forName does not work from an applet

8. Oracle Thin Driver and Class.forName

9. Class.forName and Drivermanager.registerDriver

10. JDBC Class.forName problem

11. class.forName problem in Visual J++

12. Oracle Thin Driver and Class.forName


 
Powered by phpBB® Forum Software