Results 1 to 8 of 8
Thread: problem while using .class file
- 06-15-2011, 04:08 PM #1
Member
- Join Date
- Jun 2011
- Posts
- 5
- Rep Power
- 0
problem while using .class file
Hi Guys,
I'm a new member in this forum
and I've used to register to have a small hint with my project
I have done a game using JApplet and its working greate on netbeans and it connects to mysql and select,insert,delete & upgrade
but when I build the project and run it from the internet explorer
the applet didn't connect to the DB
I've tried this code to see if .class file connects to the DB
when I run this code in NetBeansJava Code:public String t() { String temp=""; Class driver_class=null; try { driver_class = Class.forName("com.mysql.jdbc.Driver"); } catch (ClassNotFoundException e) { e.printStackTrace(); } temp=("Found driver " + driver_class); return temp; } public void paint(Graphics g) { super.paint(g); if(t().equals("")) g.drawString("Driver Not Found", getWidth()/2, getHeight()/2); else g.drawString(t(), getWidth()/2, getHeight()/2); }
I get
"Found driver com.mysql.jdbc.Driver" as a result
and when I run the .class file I get "Driver Not Found"
I know the problem (not loading the JDBC Driver) but I didn't know what to do
please help me I have to give this project to my doctor tomorrow & thank you alot ..gif)
best regards,
HSN.
- 06-15-2011, 04:16 PM #2
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
Is your mysql jdbc jar file in the runtime class path?
(The answer would be no, otherwise you wouldn't get that exception)
- 06-15-2011, 04:50 PM #3
Can you show how you "run the class"? If its an applet, normally it executes in a browser. Is the html and class file on local drive or loaded from a server? Does the html <APPLET tag's archive= attribute point to the jar file with the driver?when I run the .class file I get "Driver Not Found"
- 06-15-2011, 09:05 PM #4
Member
- Join Date
- Jun 2011
- Posts
- 5
- Rep Power
- 0
sorry for the bad english
but I didnt speak English,
"run the class" is to open it with the browser using the built files in file Build which call the class files that I have to use them in my project
and my html <applet tags archive= attribute point to the .class file not jar file
If you want we can have private chat on msn and enter my pc using the "teamviewer" to see the problem I have
ok ?
thank you dude.
- 06-15-2011, 09:08 PM #5
Member
- Join Date
- Jun 2011
- Posts
- 5
- Rep Power
- 0
- 06-15-2011, 10:42 PM #6
The Applet tag's code= should be to the classname. The archive= should point to a jar file.
Set the html <APPLET tag's archive= attribute to point to the jar file with the driver.
- 06-15-2011, 11:16 PM #7
Member
- Join Date
- Jun 2011
- Posts
- 5
- Rep Power
- 0
okay dude I will try that now and see what will happen
- 06-15-2011, 11:55 PM #8
Member
- Join Date
- Jun 2011
- Posts
- 5
- Rep Power
- 0
Similar Threads
-
Display Array on another class after extracting from txt file and into array problem
By jonathan920 in forum NetBeansReplies: 0Last Post: 05-12-2011, 07:04 PM -
File.class - Problem with SecurityManager
By bhuvana_t in forum Advanced JavaReplies: 0Last Post: 01-06-2011, 09:40 AM -
JCreator problem; class Exercise1 is public, should be declared in a file named Exerc
By JehanMustafa in forum New To JavaReplies: 1Last Post: 10-08-2010, 02:19 AM -
problem in accessing array values of one class in to jframe class
By cenafu in forum AWT / SwingReplies: 8Last Post: 03-21-2009, 09:34 AM -
Able to find class file in WEB-INF/classes but not after add sub folders in class dir
By vitalstrike82 in forum Web FrameworksReplies: 0Last Post: 05-13-2008, 06:16 AM


LinkBack URL
About LinkBacks
Reply With Quote
.gif)

Bookmarks