JDBC - java.lang.ClassNotFoundException: com.mysql.jdbc.Driver Solution
Error:
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
at java.net.URLClassLoader$1.run(Unknown Source)at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
Solution:
Extract that file get mysql-connector-java-5.1.22-bin.jar
i) Paste that file in:/usr/lib/jvm/java-6-openjdk/jre/lib
and :/usr/lib/jvm/java-6-openjdk/jre/lib/ext
(or)
ii)Paste that file in:/usr/lib/jvm/java-6-sun-1.6.0.26/jre/lib
and :/usr/lib/jvm/java-6-sun-1.6.0.26/jre/lib/ext
when compile my java coding i got below warning:
Note: PurchaseDetails.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Warning
when compile my java coding i got below warning:
Note: PurchaseDetails.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Solution:
This comes up in Java 5 and later if you're using collections without type specifiers (e.g., Arraylist()instead of ArrayList<String>()). It means that the compiler can't check that you're using the collection in a type-safe way, using generics.To get rid of the warning, just be specific about what type of objects you're storing in the collection. So, instead of
List myList = new ArrayList();
use
List<String> myList = new ArrayList<String>();
No comments:
Post a Comment