Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa JDBC java runtime exception
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


raman
java runtime exception
1 Answer(s)      4 years and 5 months ago
Posted in : JDBC


while i executing this source code:-
import java.sql.*;

public class MysqlConnect
{
public static void main(String args[])
{
System.out.println("MySQL Connect Example.");
Connection con = null;
String url = "jdbc:mysql://localhost:3306/";
String dbName = "bank";
String driver = "com.mysql.jdbc.Driver";
String userName = "root";
String password = "1234";
try {
Class.forName(driver).newInstance();
con = DriverManager.getConnection(url+dbName,userName,password);
System.out.println("Connected to the database");
con.close();
System.out.println("Disconnected from database");
}
catch (Exception e)
{
e.printStackTrace();
}
}
}


i got an exception that classnotfoundexception . how can i remove this exception. i am executing my prgm on command prompt in window 7. is there is problem in setting the classpath then give me step to step procedure to correct this problem. pls help
thanks in advance

Advertisement
View Answers

August 20, 2010 at 10:52 AM


Hi Friend,

It seems that system is not getting some classes. Put mysql-connector-java-3.1.6-bin.jar file in the lib folder of your jdk and restart your compiler.

Thanks


Related Tutorials/Questions & Answers:
java runtime exception - JDBC
java runtime exception  while i executing this source code:- import..."); } catch (Exception e) { e.printStackTrace(); } } } i got an exception that classnotfoundexception . how can i remove
runtime exception hibernate
runtime exception hibernate  runtime exception hibernate
Advertisements
Java Runtime Exception: 0x4F4F:524A 0x4120:5445 0x4348:0D0A
Java Runtime Exception: 0x4F4F:524A 0x4120:5445 0x4348:0D0A   Sir I... server error INFO: Java Runtime Exception: 0x4F4F:524A 0x4120:5445 0x4348:0D0A... some error-- Client side error: Exception in thread "AWT-EventQueue-0
exception at runtime - JDBC
exception at runtime  while i executing this source code:- import... (Exception e) { e.printStackTrace(); } } } i got an exception that exception in thread main java.lang.noclassdeffounderror :class_name. how can i
RunTime Exception in stand alone app with hibernate. - Hibernate
RunTime Exception in stand alone app with hibernate.  I have written small stand alone application using hibernate-3.2. When I run the application, It causes following types of exceptions. log4j:WARN Please initialize
runtime error in java
runtime error in java  What is Run time error in Java?   ... the link, may this will be helpful for you. http://www.roseindia.net/java/java-exception/exception-java.shtml
java runtime error - JDBC
java runtime error  when i m running my program using type1 driver it is showing a runtime error of SQLException of unable to create the connection object.please give the solution
runtime error - Java Beginners
runtime error  I created a sample java source ,compiled it succesfully using command prompt but when i tried to run i got the folowing error " Exception in thread "main" java.lang.UnsupportedClassVersionError" I have set
java runtime error - JDBC
java runtime error  when i am running my jdbc program using thin driver this error is coming at runtime: Exception in thread "main..., the above exception will occur. Check, Project Properties | Build | Java
Java Runtime
Java Runtime       In this section, you will learn about Java Runtime Environment (JRE), it also known as Java Runtime. This is a part of Java Development Kit (JDK). It is a set
java runtime error - JDBC
java runtime error  when i m running my program by using jdk1.6.0 then it is giving the error of classunsupported major.minor version 50.0.to remove it i installed jdk1.5 but now it is giving the classunsupported major.minor
runtime error - Java Beginners
runtime error  sir run time error is coming again in this code also null pointer Exception at for( File f:contents) import java.io.*; public class RecentDocumentsDelete { public static void main(String[] args) { String
java runtime error - JDBC
java runtime error  when i m running my jdbc program it is giving the problem as class not found exception.so, please suggest me what may be the solution regarding this.  Hi friend, The problem is of Jar
java runtime error - JDBC
java runtime error  sir when i m running the jsp connectivity program it is giving the error as follows:' java.lang.NullPointerException at jsp_servlet.__resplogin._jspService(__resplogin.java:237
java runtime error
java runtime error  hi friends i am trying to run the fallowing program but i am getting the error Exception in thread "main" java.lang.UnsupportedClassVersionError: JDBCCreateTab le (Unsupported major.minor version 50.0
runtime error - Java Beginners
runtime error  import java.io.*; public class RecentDocumentsDelete { public static void main(String[] args) { String currentUser = System.getProperty("user.name"); System.out.println(currentUser
java runtime error - Development process
java runtime error  I Migrated jdk1.3 to jdk1.4. after that my ftp clint not working.iam getting class not found exception fileinputstreem. i am using sun package. can any one send pure java code for FTP process i think jdk
Java Exception
Java Exception  Why Runtime Exceptions are Not Checked
java runtime error - Java Beginners
java runtime error  import java.io.*; class Test { public static... Test Exception in thread "main" java.lang.NoClassDefFoundError: Test Caused... and set the following: JAVA_HOME=C:\Program Files\Java\jdk1.6.0; Path=C
java runtime error - Java Beginners
java runtime error  sir, i have installed jdk in my system.i had also set path.But i am unable to run the compiled class file.it shows run time...://www.roseindia.net/java/java-classpath.shtml Thanks
Java runtime not working - Java Beginners
Java runtime not working  import javax.swing.*; import java.awt....(String[] args) throws Exception { SwingFrame1 sf=new SwingFrame1(); } public SwingFrame(){ JFrame f = new JFrame("Frame in Java Swing"); f.getContentPane
Java Runtime error - Java Beginners
Java Runtime error  I have designed a simple chat application where the client and the server is the same computer itself. I have used the ipaddress of my computer and then designed a GUI application to interact between the two
Java runtime error - JSP-Servlet
Java runtime error  Following Error is showing when i way... File("/home/cipa/s1.png")); }catch(Exception e... Duplex"); }catch(Exception e){ e.printStackTrace
Java runtime example - JSP-Servlet
Java runtime example  in eclipse after submiting the data throgh jsp page i got the following error...); } } catch (Exception ex
JDBC:Runtime error - Java Beginners
JDBC:Runtime error  Dear sir/madam i am facing a problem with jdbc... " + ex.getMessage()); } catch (Exception e) { System.out.println("openConnection(): Exception " + e.getMessage
JDBC:Runtime error - Java Beginners
JDBC:Runtime error  Dear sir/madam, thanks to respond for my request...(): ClassNotFoundException " + ex.getMessage()); } catch (Exception e) { System.out.println("openConnection(): Exception " + e.getMessage()); } con
Exception Java
Exception Java  Hi, What are the Exception Java? Thanks   Hi, Read it at Java Exception. Thanks
Java Exception
Java Exception  Which is superclass of Exception
Java exception
Java exception  Can an exception be rethrown
Java exception
Java exception  What happens if an exception is not caught
Error during runtime NoClassDefFound in java
Error during runtime NoClassDefFound in java  code: package Jama...[n-1][n-1] - H[n][n]) / 2.0; q = p * p + w; z = Math.sqrt(Math.abs(q)); H[n][n] = H[n][n] + exshift; H[n-1
 

 

 

DMCA.com