Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Class.forName() error

 
mike zhang
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
mike zhang
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic