Bonjour à tous,
Je créé un projet qui lis dans un fichier excel, pour cela j'utilise la librairie jxl.jar, et ant pour automatiser mes tâches.
Mon probleme intervient toujours au meme endroit, au moment de l'exécution du code sur <java>.
Peut etre est il utile que je vous mette l'arbo de mon projet :
ETL
|- class
|- lib
|-- jxl.jar
|- src
|-- intput.xls
|- build.xml
j'utilise le JDK 1.6 et la derniere version de ant télécharger sur le site
mon fichier build.xml
j'exécute mes commandes par MS DOS (je pense avoir bien configurer mes variables environnement), voici le résultat de l'exécution des mes tâches :
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 <?xml version="1.0" encoding="UTF-8"?> <project name="monProjet" basedir="."> <property name="jar" location="lib" /> <target name="delete" > <delete dir="build" /> </target> <!-- compilation --> <target name="compile" > <mkdir dir="build/classes" /> <!-- compilation des sources Java --> <javac classpath="./lib/jxl.jar" srcdir="class" destdir="build/classes" /> </target> <!-- creation du jar --> <target name="jar" > <mkdir dir="build/jar" /> <jar destfile="build/jar/myJexcelAPI.jar" basedir="build/classes"> <manifest> <attribute name="Main-Class" value="Main"/> </manifest> </jar> </target> <!-- exécution du code compilé --> <target name="run" > <java jar="build/jar/myJexcelAPI.jar" fork="true"/> </target> </project>
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 C:\Documents and Settings\ZGYK6628\workspace\ETLJava>ant compile Buildfile: build.xml compile: [mkdir] Created dir: C:\Documents and Settings\ZGYK6628\workspace\ETLJava\build\classes [javac] Compiling 3 source files to C:\Documents and Settings\ZGYK6628\workspace\ETLJava\build\classes BUILD SUCCESSFUL Total time: 0 seconds C:\Documents and Settings\ZGYK6628\workspace\ETLJava>ant jar Buildfile: build.xml jar: [mkdir] Created dir: C:\Documents and Settings\ZGYK6628\workspace\ETLJava\build\jar [jar] Building jar: C:\Documents and Settings\ZGYK6628\workspace\ETLJava\build\jar\myJexcelAPI.jar BUILD SUCCESSFUL Total time: 0 seconds C:\Documents and Settings\ZGYK6628\workspace\ETLJava>ant run Buildfile: build.xml run: [java] java.lang.NoClassDefFoundError: jxl/read/biff/BiffException [java] Caused by: java.lang.ClassNotFoundException: jxl.read.biff.BiffException [java] at java.net.URLClassLoader$1.run(URLClassLoader.java:200) [java] at java.security.AccessController.doPrivileged(Native Method) [java] at java.net.URLClassLoader.findClass(URLClassLoader.java:188) [java] at java.lang.ClassLoader.loadClass(ClassLoader.java:307) [java] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) [java] at java.lang.ClassLoader.loadClass(ClassLoader.java:252) [java] at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) [java] Could not find the main class: Main. Program will exit. [java] Exception in thread "main" [java] Java Result: 1 BUILD SUCCESSFUL Total time: 0 seconds
Partager