File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Class.forName() error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Class.forName() error" Watch "Class.forName() error" New topic
Author

Class.forName() error

mike zhang
Ranch Hand

Joined: Feb 26, 2002
Posts: 59
when I used jdk1.1, this method works fine, but when it is upgraded to jdk1.3, the following error pops up:
*****************
...
java.net.URLClassLoader.findClassURL
...
...
at java.lang.ClassLoader.loadClassInternal
at java.lang.ClassLoader.forName(native method)
*********************
Can someone help out a solution that will work in both jdk1.1 and jdk1.3 ?
Thanks,
Mike
Sunny Liu
Ranch Hand

Joined: Mar 15, 2002
Posts: 63
Hi Mike,
Make sure that class you are going to load is in your classpath first. second, you should look at top of stack trace, there is a reanson why it throws such exception.
JDK1.3 is using same method.
but you may use Class.forName("your.class").newInstance();
I wish it would help???
[ March 22, 2002: Message edited by: Sunny Liu ]

If I am rich, I will spend more.<p>IBM 486 (OOAD & UML) & 141 (XML) passed<br />Oracle 1Z0-007 passed<br />MCSD MCDBA MCSE <br />SCJP SCSSA<br />CCNA CNA A+
mike zhang
Ranch Hand

Joined: Feb 26, 2002
Posts: 59
the argument I used inside the Class.forName() is something like "com.sun.jdbc..." driver name. so I didn't put it in the classpath. The point is it worked fine in jdk1.1 but not 1.3. I also tried the "Class.forName().newInstance()", same error happens.
mike zhang
Ranch Hand

Joined: Feb 26, 2002
Posts: 59
Oh, I want to add, I used "getProperty()" kind method to get the Driver_names and put it into Class.forName(). It works fine in jdk1.1, but failed in jdk1.3 with the above error. The driver name is in the classpath indeed.
please help with some insight.
Thanks,
Mike
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Class.forName() error