Bonjour, je réalise mon premier fichier build.xml, et je m'en vois pour inclure les jar externes dans le jar final.
Lors de l'éxécution j'ai java.lang.ClassNotFoundException.
Voici à quoi mon fichier ressemble:
Merci pour vos éclairages
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56 <project name="export" default="dist" basedir="."> <property name="lib" value="lib" /> <property name="src" value="src" /> <property name="build" value="build" /> <property name="dist" value="dist" /> <property name="main-class" value="mod.Main" /> <path id="library.Project"> <fileset dir="lib/"> <include name="*.jar"/> </fileset> </path> <pathconvert property="lib.project.manifest.classpath" pathsep=" "> <path refid="library.Project"/> <flattenmapper/> </pathconvert> <target name="init"> <mkdir dir="${build}" /> <mkdir dir="${dist}" /> </target> <target name="compile" depends="init"> <javac srcdir="${src}" destdir="${build}" debug="on"> <classpath> <pathelement location="${lib}/mysql-connector-java-5.0.6-bin.jar" /> <pathelement location="${lib}/util.jar" /> </classpath> </javac> <copy file="properties" todir="${build}" /> </target> <target name="dist" depends="compile"> <jar jarfile="${dist}/mid_export.jar" basedir="${build}"> <manifest> <attribute name="Main-Class" value="${main-class}" /> <attribute name="Class-Path" value="${lib.project.manifest.classpath}"/> </manifest> </jar> </target> <target name="clean"> <delete dir="${build}" /> <delete dir="${dist}" /> </target> </project>
Partager