java runtime exception

Ads

 
 

Share on Google+Share on Google+

raman
java runtime exception
1 Answer(s)      7 years 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
Ads
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

Ads









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
Java Exception
Java Exception  Why Runtime Exceptions are Not Checked
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
Exception Java
Exception Java  Hi, What are the Exception Java? Thanks   Hi, Read it at Java Exception. Thanks
Java exception
Java exception  What happens if an exception is not caught
Java exception
Java exception  Can an exception be rethrown
Java Exception
Java Exception  Which is superclass of Exception
java exception
java exception   define an exception called no match exception tat z... { public static void main(String[] args) throws Exception { String z="Hello"; if(!z.equals("India")){ throw new Exception
Java exception
Java exception  What is the difference between Checked and Unchecked exception
Java exception
Java exception  What is the difference between exception and error
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 Exception
Java Exception  Explain about checked and unchecked Exceptions... this exception will be caught by a well-written application and will also prompt... are the exceptions which occur during the runtime of the program. Unchecked exceptions
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
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
exception in java - Java Beginners
exception in java  exception in java
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
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 Exception
Java Exception  What are monitors
Java Exception
Java Exception  What are Chained Exceptions
Java exception
Java exception  What is NullPointerException and how to handle
Java exception
Java exception  Can try statements be nested
Java Exception
Java Exception  What is the purpose of finalization
Java Exception
Java Exception  What is ?Resource leak
Java Exception
Java Exception  Why Errors are Not Checked
Java Exception
Java Exception  Can a catch block exist without a try block
Java Exception
Java Exception  If I write System.exit (0); at the end of the try block, will the finally block still execute
exception in java
exception in java  StringIndexOutOfBounds Exception in flames program   Hi Friend, We have providing you a program. Try it: import java.util.*; public class FlamesProgram{ static String name1 = ""; static
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

Ads

 
Advertisement null

Ads