This question already has answers here:
Connect Java to a MySQL database
(14 answers)
Closed 8 months ago.
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
got this error also after adding sql-connector-jar to lib of dynamic web project.please help me with this.
at first you need to create a java project and name it
after creating you can see a folder called referenced libraries down to your java project folder
so add your jar which is in this directory (if you have Mysql installed in your system )
C:\Program Files (x86)\MySQL\Connector J 8.0
in this folder you can find the .jar add to the referenced libraries
and start executing the code it will work
or execute this
Class.forName("com.mysql.cj.jdbc.Driver");
this might work
Related
This question already has answers here:
How do I resolve ClassNotFoundException?
(28 answers)
Closed 2 years ago.
I'am trying to send an automatic email with JavaMail on Oracle. I added external JARs on Java Build Path (mail.jar and activation.jar). I don't know what I'm doing wrong because I get this error message:
java.lang.ClassNotFoundException: javax.mail.internet.AddressException
org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1358)
org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1180)
I'm using Tomcat v8.5.
You should add Javax mail dependency to make it work.
You need to add the JavaMail library Jars either to the Tomcat lib folder, or it has to be part of your WAR file when you deploy your WebApp. Adding it to the Build Path makes it only available during compile time. Although, depending on the configuration for the Deployment, it could be deployed, too – but obviously, not in your case.
This question already has answers here:
How do I fix a NoSuchMethodError?
(33 answers)
Closed 4 years ago.
While run in NetBeans it runs perfectly but when build and go to dist and run executable jar file report cannot run. Then I tried to run in cmd I got an error
java.lang.NoSuchMethodError: org.objectweb.asm.ClassWriter.<init> (Z) V
It looks like the version of ASM library is different when program runs inside NetBeans and when run in cmd. Review your project setup and ensure that your IDE setup matches your standalone setup.
This question already has answers here:
How can I convert my Java program to an .exe file?
(16 answers)
Closed 8 years ago.
I have created java project that contains 6 Class file and 1 java file
And I run this project in net beans IDE now my problem is when I clean and build this project am unable to create exe file
How can I make this project as exe (an executable file)?
all 7 files in one single as executable
and found this and tried from here making executable file from a java project using NetBeans Can some one help me to solve my problem
The JAR file format provides many benefits.
You can make your Java application runnable via a double-click by packaging it into an executable jar.
This answer will help you.
This question already has answers here:
How do I import the javax.servlet / jakarta.servlet API in my Eclipse project?
(16 answers)
Closed 7 years ago.
I was working with a fully functional .war file I imported for a intro to Java tutorial I'm following. I had to change the jdk I was using (via the installed jre page). Now after changing this I'm getting a "javax.servlet cannot be resolved" error with my code. Anyone have any ideas?
check project build path whether Servlets api. jar file is included or not. you can add it in two ways:
1) add servlets api .jar file to build path
or
2) add server runtime (i add Tomcat server runtime library) in build path
Hope this helps.
This question already has answers here:
Eclipse: How to build an executable jar with external jar?
(6 answers)
Closed 9 years ago.
I have written a java program which uses ojdbc14.jar and the program is working fine until it is in eclipse.when I create an executable jar file the ojdbc14.jar is not getting packaged along with it hence my program is not having the driver to make the required connection with the DB.can someone help me in coming up with the steps to create an executable jar file along with the required drivers.
PS: I am doing all this in eclipse so steps relating to eclipse would be highly appreciated.
If you Export a Runnable Jar File, the dependencies will be packaged within the file.
See: http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Ftasks%2Ftasks-37.htm
Also, you can select how the dependencies will be included/packaged:
http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Freference%2Fref-export-runnable-jar.htm&anchor=library-handling