找不到Java ANT build.xml错误驱动程序

时间:2018-07-02 13:49:31

标签: java eclipse postgresql ant postgresql-10

你好,我有问题

我是第一次尝试使ant命令成功运行,但是我遇到了一些问题。

当我在项目文件夹中的cmd ant上输入数字时,prject会正确编译,然后当我必须连接到我的postgres服务器时,它崩溃并说: DBManager,SignIn,找不到适合jdbc的驱动程序:postgresql://127.0.0.1:5432 / dbName

在这里您可以看到我的build.xml文件(但我不确定错误是否在那里)

<?xml version="1.0" encoding="UTF-8"?>

-<project basedir="." default="execute" name="BuildReader">

<!-- Config File -->


<!-- - - - - - - - - - - - - - - - - - - - -->


<!-- DON'T TOUCH HERE -->


<property name="path" value="./"/>

<property name="name" value="reader"/>

<property name="source_dir" value="."/>


-<path id="build.classpath">

<fileset dir="./Lib" includes="*.jar"/>

</path>


-<target name="init">

<echo message="* Creating folder '${path}/export'"/>

<mkdir dir="${path}/export"/>

<mkdir dir="${path}/export/tmp"/>

</target>


-<target name="build" depends="init">

<echo message="* Starting Building '${name}'"/>


-<javac srcdir="${source_dir}" destdir="${path}/export/tmp" includeantruntime="false">

<classpath refid="build.classpath"/>

</javac>

</target>


-<target name="jar" depends="build">

<echo message="* Creating JAR packet of '${name}'"/>


-<jar basedir="${path}/export/tmp" destfile="${path}/export/${name}.jar">


-<manifest>

<attribute name="Main-Class" value="Server.ServeMainClass"/>

</manifest>

</jar>

<delete dir="${path}/export/tmp"/>

</target>


-<target name="execute" depends="jar">

<echo message="* Starting App '${name}'"/>

<java jar="${path}/export/${name}.jar" fork="true"/>

</target>

</project>

正如我所说,当我在项目文件夹中输入ant时程序就启动了,但是当我输入服务器凭据时却出现了此错误(程序不会崩溃,但不会登录到服务器)

在这里您可以看到对服务器的连接

private void setup() throws SQLException {
        Scanner scan = new Scanner(System.in);
        while ((conn == null) || (conn.isClosed())) {

            System.out.println("Insert host");
            String host = scan.nextLine();
            System.out.println("Insert Username");
            String user = scan.nextLine();
            System.out.println("Insert Password");
            String psw = scan.nextLine();

            String connectionStringU = "jdbc:postgresql://" + host + ":5432/dbSeatIn";

            // conn = DriverManager.getConnection(connectionString, userName, password);
            try {
                conn = DriverManager.getConnection(connectionStringU, user, psw);
            } catch (Exception e) {
                Logger.WriteError(e, "sas", "sssss");
                try {
                    PulisciConsole();
                } catch (IOException e1) {

                }
                System.out.println("Connection failed");
                Logger.WriteError(e, "DBManager", "SignIn");
            }
        }
        System.out.println("Connection up");

        System.out.println("Loading setUpList");

        CommonList.Updatesip(conn);
        CommonList.UpdateCourse(conn);
        CommonList.UpdateSubj(conn);

        System.out.println("List loaded");

    }

有人可以帮助我找出我做错了什么地方吗?

0 个答案:

没有答案