Results 1 to 4 of 4

Thread: run problems

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2009
    Posts
    1

    run problems

    Hi,

    I have a java file that have a runtime error. Could someone see what the problem is and how to fix this?

    Errror: Exeption in thread "main" java.lang.NoClassDefFoundError: DBTest
    Could not find the main class: DBTest. Program will exit


    File can be found in the appendix.(change the extention from .txt to .java) the code is to long to post in the forum...
    Attached Files Attached Files

  2. #2
    Hyperactive Member
    Join Date
    Mar 2002
    Location
    Boston, MA
    Posts
    391

    Re: run problems

    make sure you create the directory structure of the package for your program: Your class files must reside in jra1/sqltest.

    Then you would run it as: jra1.sqltest.DBTest from one level up from the jra1 directory.

  3. #3
    Arabic Poster ComputerJy's Avatar
    Join Date
    Nov 2005
    Location
    Happily misplaced
    Posts
    2,513

    Re: run problems

    Actually you should run javac (Java compiler) first to compile your class.

    And unless you're using Linux or Mac OS, this code was generated by an IDE (Probably eclipse). IDEs help you run your code
    "I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
    My Blog

  4. #4
    Frenzied Member oceanebelle's Avatar
    Join Date
    Jun 2005
    Location
    my n00k.
    Posts
    1,064

    Re: run problems

    And you'd need the jar files for the jdbc drivers that the code tries to load. Make sure they are in your classpath when compiling or running.

    com.mysql.jdbc.Driver
    org.postgresql.Driver

Posting Permissions

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



Click Here to Expand Forum to Full Width