[libpostgresql-jdbc-java] 22/93: Add a MainClass that tells the user they can't just run the JDBC driver
Emmanuel Bourg
ebourg-guest at moszumanska.debian.org
Mon Jan 9 10:18:48 UTC 2017
This is an automated email from the git hooks/post-receive script.
ebourg-guest pushed a commit to annotated tag REL9_3_1102
in repository libpostgresql-jdbc-java.
commit 9ef04115559d1292b06e0a38f76742434ac25167
Author: Craig Ringer <craig at 2ndquadrant.com>
Date: Sat Jan 11 12:06:22 2014 +0800
Add a MainClass that tells the user they can't just run the JDBC driver
After one too many reports of
"Failed to load Main-Class manifest attribute from postgresql-xxx.jar"
I'm submitting a dummy main-class that tells the user what they should
do instead.
The message looks like:
------------
PostgreSQL x.y JDBC4.1 (build bbbb)
Found in: jar:file:/path/to/postgresql-x.y-bbbb.jdbc41.jar!/org/postgresql/Driver.class
The PgJDBC driver is not an executable Java program.
You must install it according to the JDBC driver installation instructions for your application / container / appserver, then use it by specifying a JDBC URL of the form
jdbc:postgresql://
or using an application specific method.
See the PgJDBC documentation: http://jdbc.postgresql.org/documentation/head/index.html
This command has had no effect.
------------
---
build.xml | 3 +++
org/postgresql/util/PGJDBCMain.java | 24 ++++++++++++++++++++++++
2 files changed, 27 insertions(+)
diff --git a/build.xml b/build.xml
index 949fdd8..2b86a36 100644
--- a/build.xml
+++ b/build.xml
@@ -216,6 +216,9 @@
<metainf dir="META-INF">
</metainf>
+ <manifest>
+ <attribute name="Main-Class" value="org.postgresql.util.PGJDBCMain"/>
+ </manifest>
</jar>
</target>
diff --git a/org/postgresql/util/PGJDBCMain.java b/org/postgresql/util/PGJDBCMain.java
new file mode 100644
index 0000000..8a17b16
--- /dev/null
+++ b/org/postgresql/util/PGJDBCMain.java
@@ -0,0 +1,24 @@
+package org.postgresql.util;
+
+public class PGJDBCMain {
+
+ public static void main(String[] args) {
+
+ PSQLDriverVersion.main(args);
+
+ System.out.println(
+ "\nThe PgJDBC driver is not an executable Java program.\n\n" +
+
+ "You must install it according to the JDBC driver installation " +
+ "instructions for your application / container / appserver, " +
+ "then use it by specifying a JDBC URL of the form \n" +
+ " jdbc:postgresql://\n" +
+ "or using an application specific method.\n\n" +
+ "See the PgJDBC documentation: http://jdbc.postgresql.org/documentation/head/index.html\n\n" +
+ "This command has had no effect.\n"
+ );
+
+ System.exit(1);
+ }
+
+}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/libpostgresql-jdbc-java.git
More information about the pkg-java-commits
mailing list