Results 1 to 7 of 7
  1. #1
    kulangotski is offline Senior Member
    Join Date
    Feb 2009
    Posts
    117
    Rep Power
    0

    Default cant load the EmbeddedDriver

    i cant load the said driver. the class.forname(drivername); does not work! should i do something first or is there sumthing that needs to be set up first.

    and i cant also run the ij from the command shell.. is my classpath wrong? it goes directly to the directory where derby.jar is at

    your help is much appreciated..

  2. #2
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    8

    Default

    What is the error? "does not work" and "cant also run" are some of the worst problem descriptions ever.

    I just as well say
    Java Code:
    class.forname(drivername);
    "doesn't work" because it should be
    Java Code:
    Class.forName
    and you need to use a real driver name. And you can't run ij because you're typing uj.
    Last edited by masijade; 02-20-2009 at 07:20 PM.

  3. #3
    kulangotski is offline Senior Member
    Join Date
    Feb 2009
    Posts
    117
    Rep Power
    0

    Default thanks for the message

    sorry for the words, i am new to this forum thing

    that's what i have been doing for a couple of days now.. the same syntax that you typed there..

    do i need to set up anything before using the Class.forName(DriverName); method?

  4. #4
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    8

    Default

    Like I said, it might help to know what "doesn't work" mean.

    Post your code, any and all error/compile messages (in their entirety), and all observed unexpected behaviour, as well as unobserved expected behaviour.

  5. #5
    kulangotski is offline Senior Member
    Join Date
    Feb 2009
    Posts
    117
    Rep Power
    0

    Default hello

    this is my code

    package javaapplication27;
    public class Main
    {

    String drivername = "org.apache.derby.jdbc.EmbeddedDriver";

    Class.forName(drivername).newInstance();

    public static void main(String[] args)
    {
    }
    }

    this is my code before running.. i typed it in the netbeans, and with this code i have on the method Class.forName a red underline..

    and this is what it returned after i tried to run the program

    run:
    java.lang.ClassFormatError: Method "<error>" in class javaapplication27/Main has illegal signature "Ljava/lang/Class$forName;"
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java :620)
    at java.security.SecureClassLoader.defineClass(Secure ClassLoader.java:124)
    at java.net.URLClassLoader.defineClass(URLClassLoader .java:260)
    at java.net.URLClassLoader.access$000(URLClassLoader. java:56)
    at java.net.URLClassLoader$1.run(URLClassLoader.java: 195)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.j ava:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:3 06)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launche r.java:276)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:2 51)
    at java.lang.ClassLoader.loadClassInternal(ClassLoade r.java:319)
    Exception in thread "main"
    Exception in thread "main" Java Result: 1
    BUILD SUCCESSFUL (total time: 2 seconds)

    .................................................. ....................................

    tnx for your reply
    appreciated it

  6. #6
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    8

    Default

    You cannot perform actions in the class definition. That must take place inside of some method or static block.

  7. #7
    kulangotski is offline Senior Member
    Join Date
    Feb 2009
    Posts
    117
    Rep Power
    0

    Default hehehe

    that's a rookie mistake right there..

    thanks for your help, really appreciated it.



    hope you wot get tired of helping other people

Similar Threads

  1. How to load new libraries
    By Manfizy in forum NetBeans
    Replies: 2
    Last Post: 02-11-2009, 06:55 AM
  2. How can we load database?
    By java19857 in forum New To Java
    Replies: 5
    Last Post: 09-19-2008, 06:34 PM
  3. Load URL that contains spaces?
    By barkster in forum Java Applets
    Replies: 0
    Last Post: 01-30-2008, 09:40 PM
  4. how to load a lot of files?
    By gabriel in forum Java Servlet
    Replies: 1
    Last Post: 08-07-2007, 06:04 PM
  5. Help with load image
    By trill in forum New To Java
    Replies: 1
    Last Post: 08-01-2007, 07:16 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •