Java-database connection Java-MySQL connection ③-2: How to set CLASSPATH to the build bus of Eclipse (Pleiades All in One) / September 2017

CLASSPATH setting

Parts (jar files) that are not included in the standard system library are called "external libraries". The JDBC driver is one of the external libraries. In order to use an external library in addition to the standard system library, it is necessary to make settings to tell the compiler and JVM (JavaVirtualMachine: Java virtual environment) the location of this external library. This setting is called "CLASSPATH setting".

There are several ways to set the CLASSPATH, In this Qiita personal memo,

  1. How to set CLASSPATH to environment variable
  2. How to set CLASSPATH to the build bus of Eclipse (Pleiades All in One) Will be described.

How to set CLASSPATH to Eclipse (Pleiades All in One) build bus

Here, we will describe the creation of ChkLoadJdbc, which will be created later, as an example.

Start Eclipse (Pleiades).

The operation will be performed from the Java perspective. (If it is not a Java perspective, switch to that perspective)

Right-click on a blank area in Package Explorer -> New-> Select Java Project

The "New Java Project" screen is displayed

Project name: ChkLoadJdbc will do Using the execution environment JRE: JavaSE-1.8 will do

Press the "Next" button

Select the "Library" tab here (You can also set it later in the << Confirmation method >> part)

Press the "Add External JAR" button

Open C: \ Program Files \ Java \ jdk x.x.x_xxx \ lib

Select mysql-connector-java-x.x.xx-bin.jar and press the "Open" button

Click the "Finish" button.

<< How to check >> Right click on Java project folder (ChkLoadJdbc) Select property Select "Java Build Path" Select "Library Tab" Make sure that mysql-connector-java-x.x.xx-bin.jar and the JRE system library are registered. If it is registered, the setting is complete.

If it is not registered, make the following settings.


Press the "Add External JAR" button Open C: \ Program Files \ Java \ jdk x.x.x_xxx \ lib

Or later,

  1. Load the JDBC driver (check if you can connect to the database (MySQL) using the JDBC driver)

  2. Create two programs (applications) in the order of connection to MySQL (connect to database (MySQL) to search table information and display search results).



Java-database connection / Java-MySQL connection ① Overview of JDBC and JDBC driver (2) JDBC driver acquisition method (for MySQL) and data connection preparation ③-1 How to set CLASSPATH in environment variable ③-2 How to set CLASSPATH to Eclipse build busLoad JDBC driverConnect to database (MySQL) to search table information and display search results


Recommended Posts

Java-database connection Java-MySQL connection ③-2: How to set CLASSPATH to the build bus of Eclipse (Pleiades All in One) / September 2017
Java-database connection Java-MySQL connection ③-1: How to set CLASSPATH in environment variable / September 2017
How to set Lombok in Eclipse
Fix the file name of war to the one set in Maven
How to increment the value of Map in one line in Java
English translation of Pleiades All in One
How to set the indent to 2 single-byte spaces in the JAXB implementation of the JDK
Eclipse Pleiades All in One for Mac released
[Java] (for MacOS) How to set the classpath
How to set environment variables in the properties file of Spring boot application
How to set the log level to be displayed in the release version of orhanobut / logger
Summary of how to use the proxy set in IE when connecting with Java
How to set the display time to Japan time in Rails
Java-database connection Java-MySQL connection ⑤: Connect to the database (MySQL) to search table information and display search results / September 2017
How to set chrony when the time shifts in CentOS7
Create a tomcat project using Eclipse Pleiades All in One
How to derive the last day of the month in Java
eclipse all in one installation
How to set the IP address and host name of CentOS8
How to get the id of PRIMAY KEY auto_incremented in MyBatis
How to install the language used in Ubuntu and how to build the environment
How to get the length of an audio file in java
How to run JUnit in Eclipse
How to change the maximum and maximum number of POST data in Spark
How to find the total number of pages when paging in Java
How to constrain the action of the transition destination when not logged in
How to change the value of a variable at a breakpoint in intelliJ
How to get the absolute path of a directory running in Java
Android development, how to check null in the value of JSON object
How to set tabs and spaces to be visible by using the tab key to insert spaces in Java files in Eclipse