• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Class.forName() error

 
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
They gave me pumpkin ice cream. It was not pumpkin pie ice cream. Wiping my tongue on this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic