ANT mysql treiber einbinden

sign

Bekanntes Mitglied
Hi, bekomm beim ausführen meiner jar folgenden Fehler:
java.lang.ClassNotFoundException: com.mysql.jdbc.driver

Kann mir jamand sagen wie ich die Klasse in der build.xml angeben muss??
[JAVA=42]
<?xml version="1.0" encoding="UTF-8" ?>
- <project name="SDVerteiler" default="build" basedir=".">
<description>Builds, tests, and runs the project sDVersteiler</description>
<import file="nbproject/build-impl.xml" />
- <target name="-do-jar-with-manifest">
<mkdir dir="${dist.dir}" />
- <jar destfile="${dist.dir}/sDHostLogs.jar">
<fileset dir="${build.classes.dir}" includes="sD/classes/**" />
<fileset dir="${build.classes.dir}" includes="sD/engine/**" />
<fileset dir="${build.classes.dir}" includes="sD/start/**" />
- <manifest>
<attribute name="Main-Class" value="sD/start/MainSDGetHostLogs" />
<attribute name="Built-By" value="${user.name}" />
<attribute name="Package" value="${package}" />
<attribute name="Extension-Name" value="${name}" />
<attribute name="Specification-Title" value="${title}" />
<attribute name="Implementation-Version" value="${version}" />
<attribute name="Implementation-Vendor" value="${vendor}" />
</manifest>
</jar>
</target>
- <target name="-do-jar-without-manifest">
<echo message="skip -do-jar-without-manifest" />
</target>
- <target name="-do-jar-with-mainclass">
<echo message="skip -do-jar-with-mainclass" />
</target>
- <target name="-do-jar-with-libraries">
<echo message="skip -do-jar-with-libraries" />
</target>
</project>
[/code]

Danke
lg
 
dein manifest braucht dann noch den Eintrag "ClassPath"... oder du startest dein jar dann mit dem richtigen classpath, dann brauchst du im ant file nix ändern.
 
Kann pls wer helfen. Hab in meiner build.xml
Java:
 <fileset dir="${build.classes.dir}" includes="lib/**" />
somit wird wenigsten schon mal die lib mit in mein .jar geschrieben. Leider bekomm ich immer noch oben genannten Fehler.
java.lang.ClassNotFoundException: com.mysql.jdbc.driver
 
Habs hinbekommen 🙂. Post mal meine build.xml evt. kanns ja jemand brrauchen.

Java:
<project name="SDVerteiler" default="default" basedir=".">
    <description>Builds, tests, and runs the project sDVersteiler</description>
    <import file="nbproject/build-impl.xml" />


    <target name="-do-jar-with-manifest">

        <property name="dist.dir.lib" value="${dist.dir}/lib"/>
        <property name="libs" value="c:/java/lib/mysql-connector-java-5.1.13-bin.jar" />

        <mkdir dir="${dist.dir.lib}" />
        <copyfile src="${libs}" dest="${dist.dir.lib}/mysql-connector-java-5.1.13-bin.jar" />

        <mkdir dir="${dist.dir}" />

        <jar destfile="${dist.dir}/sDHostLogs.jar">
            <fileset dir="${build.classes.dir}" includes="sD/classes/**" />
            <fileset dir="${build.classes.dir}" includes="sD/engine/**" />
            <fileset dir="${build.classes.dir}" includes="sD/start/**" />
    
            <manifest>
                <attribute name="Main-Class" value="sD/start/MainSDGetHostLogs" />
                <attribute name="Class-Path" value="lib/mysql-connector-java-5.1.13-bin.jar" />
                <attribute name="Built-By" value="${user.name}" />
                <attribute name="Package" value="${package}" />
                <attribute name="Extension-Name" value="${name}" />
                <attribute name="Specification-Title" value="${title}" />
                <attribute name="Implementation-Version" value="${version}" />
                <attribute name="Implementation-Vendor" value="${vendor}" />
            </manifest>
        </jar>
        
    </target>
lg
 

Zurück
Oben