If you're using maven, simply update the line in the pom.xml:
<!-- https://mvnrepository.com/artifact/org.postgresql/postgresql -->
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.2.2</version>
</dependency>
If you're using gradle, simply update the dependency in the build.gradle:
// https://mvnrepository.com/artifact/org.postgresql/postgresql
compile group: 'org.postgresql', name: 'postgresql', version: '42.2.2'
If you aren't using any dependency management system, you can put the *.jar file into the classpath of your java project (ensure to delete the old one first!) - or you could simply rename the jar file like a_horse_with_no_name already suggested.
You can add the library to the class path like that:
In Intellij 13, it looks it's slightly different again. Here are the
instructions for Intellij 13:
- click on the Project view or unhide it by clicking on the "1: Project" button on the left border of the window or by pressing Alt +
1
- find your project or sub-module and click on it to highlight it, then press F4, or right click and choose "Open Module Settings" (on
IntelliJ 14 it became F12)
- click on the dependencies tab
- Click the "+" button on the right and select "Jars or directories..."
- Find your path and click OK
- In the dialog with "Choose Categories of Selected File", choose Classes (even if it's properties), press OK and OK again
- You can now run your application and it will have the selected path in the class path
-> Source: https://stackoverflow.com/a/24843914/4934937