Page 2 of 2 FirstFirst 12
Results 21 to 36 of 36
  1. #21
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,401
    Rep Power
    25

  2. #22
    Joel's Avatar
    Joel is offline Member
    Join Date
    May 2011
    Location
    Placerville, CA
    Posts
    86
    Rep Power
    0

    Default

    Quote Originally Posted by JosAH View Post
    Now you're talking about quite another error: the JVM can't find your ListStudentInfo class; it isn't whining about not being able to open a Connection for you. Fix your classpath value. b.t.w. don't suffix your class names with ".class"; it is not needed and not wanted by the class loaders.

    kind regards,

    Jos
    My Classpath value is : c:\mysql-connector-java-5.1.17-bin.jar
    ~MSP430 Lover~

  3. #23
    Joel's Avatar
    Joel is offline Member
    Join Date
    May 2011
    Location
    Placerville, CA
    Posts
    86
    Rep Power
    0

    Default

    Quote Originally Posted by Norm View Post
    Where is the jar file in your test folder?
    whoops here it is:

    Microsoft Windows XP [Version 5.1.2600]
    (C) Copyright 1985-2001 Microsoft Corp.

    C:\Documents and Settings\Joel>cd\normssuggestion

    C:\NormsSuggestion>dir
    Volume in drive C has no label.
    Volume Serial Number is E47E-AFDF

    Directory of C:\NormsSuggestion

    08/29/2011 01:38 PM <DIR> .
    08/29/2011 01:38 PM <DIR> ..
    08/29/2011 12:30 PM 2,897 ListStudentInfo.class
    08/29/2011 12:30 PM 2,583 ListStudentInfo.java
    07/04/2011 04:24 PM 787,920 mysql-connector-java-5.1.17-bin.jar
    3 File(s) 793,400 bytes
    2 Dir(s) 3,530,039,296 bytes free

    C:\NormsSuggestion>java -cp mysql-connector-java-5.1.17-bin.jar;. ListStudentInf
    o
    Exception in thread "main" java.lang.NoClassDefFoundError: ListStudentInfo$Stude
    nt
    at ListStudentInfo.getStudent(ListStudentInfo.java:80 )
    at ListStudentInfo.main(ListStudentInfo.java:14)
    Caused by: java.lang.ClassNotFoundException: ListStudentInfo$Student
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 2 more

    C:\NormsSuggestion>
    ~MSP430 Lover~

  4. #24
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,401
    Rep Power
    25

    Default

    You didn't copy all of the class files into the test folder. You need to have ALL of the ones created when your source is compiled.

  5. #25
    Joel's Avatar
    Joel is offline Member
    Join Date
    May 2011
    Location
    Placerville, CA
    Posts
    86
    Rep Power
    0

    Default

    Only one other file:

    Microsoft Windows XP [Version 5.1.2600]
    (C) Copyright 1985-2001 Microsoft Corp.

    C:\Documents and Settings\Joel>cd\normssuggestion

    C:\NormsSuggestion>dir
    Volume in drive C has no label.
    Volume Serial Number is E47E-AFDF

    Directory of C:\NormsSuggestion

    08/29/2011 01:58 PM <DIR> .
    08/29/2011 01:58 PM <DIR> ..
    08/29/2011 12:30 PM 2,897 ListStudentInfo.class
    08/29/2011 01:56 PM 355 ListStudentInfo.ctxt
    08/29/2011 12:30 PM 2,583 ListStudentInfo.java
    07/04/2011 04:24 PM 787,920 mysql-connector-java-5.1.17-bin.jar
    4 File(s) 793,755 bytes
    2 Dir(s) 3,529,383,936 bytes free

    C:\NormsSuggestion>java -cp mysql-connector-java-5.1.17-bin.jar;. ListStudentInf
    o
    Exception in thread "main" java.lang.NoClassDefFoundError: ListStudentInfo$Stude
    nt
    at ListStudentInfo.getStudent(ListStudentInfo.java:80 )
    at ListStudentInfo.main(ListStudentInfo.java:14)
    Caused by: java.lang.ClassNotFoundException: ListStudentInfo$Student
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 2 more

    C:\NormsSuggestion>
    ~MSP430 Lover~

  6. #26
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,401
    Rep Power
    25

    Default

    You are missing this file: ListStudentInfo$Student.class

  7. #27
    Joel's Avatar
    Joel is offline Member
    Join Date
    May 2011
    Location
    Placerville, CA
    Posts
    86
    Rep Power
    0

    Default

    OK I actually erased the class, re-coded it, compiled a new and several files created from compiling:

    Microsoft Windows XP [Version 5.1.2600]
    (C) Copyright 1985-2001 Microsoft Corp.

    C:\Documents and Settings\Joel>cd\NormsSuggestion

    C:\NormsSuggestion>dir
    Volume in drive C has no label.
    Volume Serial Number is E47E-AFDF

    Directory of C:\NormsSuggestion

    08/29/2011 02:05 PM <DIR> .
    08/29/2011 02:05 PM <DIR> ..
    08/29/2011 02:03 PM 504 ListStudentInfo$Student.class
    08/29/2011 02:03 PM 2,897 ListStudentInfo.class
    08/29/2011 02:03 PM 355 ListStudentInfo.ctxt
    08/29/2011 02:03 PM 2,583 ListStudentInfo.java
    07/04/2011 04:24 PM 787,920 mysql-connector-java-5.1.17-bin.jar
    08/29/2011 02:03 PM 0 package.bluej
    08/29/2011 02:03 PM 483 README.TXT
    7 File(s) 794,742 bytes
    2 Dir(s) 3,529,363,456 bytes free

    C:\NormsSuggestion>java -cp mysql-connector-java-5.1.17-bin.jar;.ListStudentInfo

    Usage: java [-options] class [args...]
    (to execute a class)
    or java [-options] -jar jarfile [args...]
    (to execute a jar file)
    where options include:
    -d32 use a 32-bit data model if available
    -d64 use a 64-bit data model if available
    -client to select the "client" VM
    -server to select the "server" VM
    -hotspot is a synonym for the "client" VM [deprecated]
    The default VM is client.

    -cp <class search path of directories and zip/jar files>
    -classpath <class search path of directories and zip/jar files>
    A ; separated list of directories, JAR archives,
    and ZIP archives to search for class files.
    -D<name>=<value>
    set a system property
    -verbose[:class|gc|jni]
    enable verbose output
    -version print product version and exit
    -version:<value>
    require the specified version to run
    -showversion print product version and continue
    -jre-restrict-search | -no-jre-restrict-search
    include/exclude user private JREs in the version search
    -? -help print this help message
    -X print help on non-standard options
    -ea[:<packagename>...|:<classname>]
    -enableassertions[:<packagename>...|:<classname>]
    enable assertions with specified granularity
    -da[:<packagename>...|:<classname>]
    -disableassertions[:<packagename>...|:<classname>]
    disable assertions with specified granularity
    -esa | -enablesystemassertions
    enable system assertions
    -dsa | -disablesystemassertions
    disable system assertions
    -agentlib:<libname>[=<options>]
    load native agent library <libname>, e.g. -agentlib:hprof
    see also, -agentlib:jdwp=help and -agentlib:hprof=help
    -agentpath:<pathname>[=<options>]
    load native agent library by full pathname
    -javaagent:<jarpath>[=<options>]
    load Java programming language agent, see java.lang.instrument

    -splash:<imagepath>
    show splash screen with specified image
    See Java SE Documentation at a Glance for more details.

    C:\NormsSuggestion>
    ~MSP430 Lover~

  8. #28
    Joel's Avatar
    Joel is offline Member
    Join Date
    May 2011
    Location
    Placerville, CA
    Posts
    86
    Rep Power
    0

    Default

    NORM! This might be a good sign buddy (I removed the space between the ;. and ListSudentInfo:

    C:\NormsSuggestion>dir
    Volume in drive C has no label.
    Volume Serial Number is E47E-AFDF

    Directory of C:\NormsSuggestion

    08/29/2011 02:05 PM <DIR> .
    08/29/2011 02:05 PM <DIR> ..
    08/29/2011 02:03 PM 504 ListStudentInfo$Student.class
    08/29/2011 02:03 PM 2,897 ListStudentInfo.class
    08/29/2011 02:03 PM 355 ListStudentInfo.ctxt
    08/29/2011 02:03 PM 2,583 ListStudentInfo.java
    07/04/2011 04:24 PM 787,920 mysql-connector-java-5.1.17-bin.jar
    08/29/2011 02:03 PM 0 package.bluej
    08/29/2011 02:03 PM 483 README.TXT
    7 File(s) 794,742 bytes
    2 Dir(s) 3,529,363,456 bytes free

    C:\NormsSuggestion>java -cp mysql-connector-java-5.1.17-bin.jar;. ListStudentInf
    o
    Eugene Santalov esantalov@gmail.com
    Joel Banaszak jbwebzone@yahoo.com
    Larry Robertson larryr@r-quest.com

    C:\NormsSuggestion>

    However, when running in the IDE isn't it supposed to ouput to the terminal window?
    ~MSP430 Lover~

  9. #29
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,401
    Rep Power
    25

    Default

    Add a space between the options on the command line.

    EDIT: Just noticed the end. So now it works?

    isn't it supposed to ouput to the terminal window
    Sorry I don't know anything about your IDE.

  10. #30
    Joel's Avatar
    Joel is offline Member
    Join Date
    May 2011
    Location
    Placerville, CA
    Posts
    86
    Rep Power
    0

    Default

    Quote Originally Posted by Norm View Post
    Add a space between the options on the command line.

    EDIT: Just noticed the end. So now it works?


    Sorry I don't know anything about your IDE.
    I am running BlueJ 3.0.4. In my code, I actually System.out these values, but I am still getting the same error as before. (NullPointerException)
    ~MSP430 Lover~

  11. #31
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,401
    Rep Power
    25

    Default

    but I am still getting the same error as before. (NullPointerException)
    C:\NormsSuggestion>java -cp mysql-connector-java-5.1.17-bin.jar;. ListStudentInfo
    Eugene Santalov esantalov@gmail.com
    Joel Banaszak jbwebzone@yahoo.com
    Larry Robertson larryr@r-quest.com

    C:\NormsSuggestion>
    What was this post about then?

  12. #32
    Joel's Avatar
    Joel is offline Member
    Join Date
    May 2011
    Location
    Placerville, CA
    Posts
    86
    Rep Power
    0

    Default

    well it outputs everything through the command line, but I want to output the rows from my application I coded. Shouldn't this work :

    Java Code:
    public static void main(String[] args)
        {
            ResultSet students = getStudentResultSet();
            
            try
            {
                while (students.next())
                {
                    String msg; 
                    Student st = getStudent(students);
                    
                    msg = st.name + " ";
                    msg += st.email + " ";
                    System.out.println(msg);
                }
                
            }
            catch (SQLException e)
            {
                System.out.println(e.getMessage());
                e.printStackTrace();
            }
            
        }
    We now know the DB is connected to ListStudentInfo class, but for some reason it won't System.out the DB information. BTW the forum won't allow me to add to your Rep power...:(
    ~MSP430 Lover~

  13. #33
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,401
    Rep Power
    25

    Default

    I want to output the rows from my application
    Where do you want the output to go?

    Shouldn't this work :
    What does "work" mean?

  14. #34
    Joel's Avatar
    Joel is offline Member
    Join Date
    May 2011
    Location
    Placerville, CA
    Posts
    86
    Rep Power
    0

    Default

    well what I want to have happen is name + email string get concatenated into String msg and output msg in the Terminal Window, not the command line. This way I'll be able to change the output location into a JOptionPane.showMessage or something. I guess "work" is the wrong word. Not sure if what I am doing is making any sense to you. I appreciate your help though. I am a slightly low-intermediate level when it comes to Java, but I think once I pass this hurdle the road will open up for me...
    ~MSP430 Lover~

  15. #35
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,401
    Rep Power
    25

    Default

    output msg in the Terminal Window, not the command line.
    Where is the Terminal Window? That must belong to your IDE. It is not part of java. SOP goes to the console.

  16. #36
    Joel's Avatar
    Joel is offline Member
    Join Date
    May 2011
    Location
    Placerville, CA
    Posts
    86
    Rep Power
    0

    Default

    Oh I see. I guess I also answered my own question re: JOptionPane.showMessageDialog(null, msg); it outputs one by one but I am sure I can figure out how to output the whole table into a swing window. The weird thing is, when I run the program through BlueJ it keeps throwing a NullPoinerException and there is still a ClassNotFOundException. Anyway if you have any thoughts on that issue I'd love to hear. Grateful for your help sir; if you were anywhere near Sacramento CA I would definitely buy you a beer. Cheers!~
    ~MSP430 Lover~

Page 2 of 2 FirstFirst 12

Similar Threads

  1. ClassNotFoundException: com.mysql.jdbc.Driver
    By tBKwtWS in forum New To Java
    Replies: 9
    Last Post: 06-15-2011, 07:01 PM
  2. com.mysql.jdbc.Driver
    By uthpalaw in forum Eclipse
    Replies: 2
    Last Post: 10-14-2010, 05:09 AM
  3. Problems with MySQL Driver
    By islan in forum JDBC
    Replies: 7
    Last Post: 08-06-2009, 04:47 PM
  4. can't register a MySQL driver
    By prfalco in forum New To Java
    Replies: 4
    Last Post: 02-03-2008, 11:13 PM
  5. mysql driver problem
    By mokingsu in forum JDBC
    Replies: 4
    Last Post: 01-17-2008, 05:27 PM

Posting Permissions

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