|
-
Feb 9th, 2009, 04:18 PM
#1
Thread Starter
New Member
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...
-
Feb 9th, 2009, 07:28 PM
#2
Hyperactive Member
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.
-
Feb 10th, 2009, 02:19 AM
#3
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
-
Feb 11th, 2009, 06:20 PM
#4
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|