java runtime exception
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
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 - JDBCjava runtime exception while i executing this source code:-
import...");
}
catch (
Exception e)
{
e.printStackTrace();
}
}
}
i got an
exception that classnotfoundexception . how can i remove
Advertisements
exception at runtime - JDBCexception 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
Exception JavaException Java Hi,
What are the
Exception Java?
Thanks
Hi,
Read it at
Java Exception.
Thanks
Java exceptionJava exception What happens if an
exception is not caught
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 ExceptionJava 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 exceptionJava exception What is the difference between Checked and Unchecked
exception Java exceptionJava exception What is the difference between
exception and error
exceptionexception wHEN
RUNTIME EXCEPTION CLASS IS SUB OF
EXCEPTION CLASS HOW CAN'T HANDLE UNCHECKED
EXCEPTION exception in javaexception in java StringIndexOutOfBounds
Exception in flames program
Hi Friend,
We have providing you a program. Try it:ADS_TO_REPLACE_1
import java.util.*;
public class FlamesProgram{
static String name1
Java exceptionJava exception What is NullPointerException and how to handle
Java ExceptionJava Exception Can a catch block exist without a try block
Java ExceptionJava Exception If I write System.exit (0); at the end of the try block, will the finally block still execute
List of Java Exception
List of
Java Exception
Exception in
Java are classified on the basis of the
exception
handled by the
java compiler.
Java consists of the following type of built
List of Java Exception
List of
Java Exception
...; the
exception
handled by the
java compiler.
Java consists of the following type... of the
Exception class or
any of its subclasses except
Runtime Exception class
Java exception handlingJava exception handling what are the constraints imposed by overriding on
exception handling
null pointer exception in javanull pointer
exception in java What is null pointer
exception in
Java and when it occurs? Show it with an example.Thanks!
Java Null Pointer
Exception java exception handlejava exception handle How error can be handled in the
exception class??
can we handle fatal error in
java Java exception handlingJava exception handling How does a try statement determine which catch clause should be used to handle an
exception Java exception handlingJava exception handling How does a try statement determine which catch clause should be used to handle an
exception Exception handling in javaException handling in
java
We are going to discus about
Exception handling in
java.
Java program many provides
exception. We are handle of error in program..._TO_REPLACE_2
Unchecked
Exception are handle of
Exception Runtime. Unchecked
Exception Exception - Java BeginnersChained
Exception in Java What is the Chained
Exception in
Java? Chained
Exception in JavaChained
Exception in
Java, this is a new... of exceptions, and these
exception can be caused by another exception.Exceptions in
Java exceptionexception chek in and check out
exception in
java
Please visit the following link:
Checked and Unchecked
Exception check null exception javacheck null
exception java check null
exception java - How to check the null
exception on
Java?
The null pointer
exception in
java occurs... on it.
See the example null pointer
exception Java exception handlingJava exception handling What happens if a try-catch-finally statement does not have a catch clause to handle an
exception that is thrown within the body of the try statement
Java Exception - Java BeginnersJava Exception Why we are using throws in the
java program even if we have try...catch block? If throws will throw the
exception then who will catch... links:
http://www.roseindia.net/
java/exceptions/how-to-throw-exceptions.shtml
Exception Handling - Java BeginnersException Handling hi,can u pls make me understand d clear cut difference between throw n throws keyword...
n how can we make our own
exception..i... want to force an
exception then we use throw keyword. the throw keyword is used
Exception Handlerin java..Exception Handlerin
java.. can a catch block accept multiple argument and return type?? please tell with explaination
Java sql ExceptionJava sql Exception difference between sql
exception class and sql warning class
Java exception handlingJava exception handling Does the order of placing catch statements matter in the catch block
exception in java - Java Beginnersexception in java
exception in java Hi Friend,
Exceptions are the errors that occur during the execution of the program. Exceptions...:
http://www.roseindia.net/
java/exceptions/
Thanks