1 pièce(s) jointe(s)
impossible d'éxécuter mon .jar qui utilise la librairie jexcelapi
Bonjour à tous, j’aurais besoin d'aide. Je viens de débuter en java et je commence à générer mes premiers exécutable en .jar.
Cependant je n'arrive pas à éxectuer ce code java (rien ne ce passe quand j’exécute le .jar) :
Code:
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
|
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import javax.swing.JOptionPane;
import jxl.Cell;
import jxl.Sheet;
import jxl.Workbook;
import jxl.read.biff.BiffException;
public class Main {
public static void main(String[] args) throws BiffException, IOException{
JOptionPane jop1, jop2;
Workbook workbook = null;
try {
workbook = Workbook.getWorkbook(new File("test.xls"));
}
catch (FileNotFoundException e) {
jop2 = new JOptionPane();
jop2.showMessageDialog(null, "aucun fichier trouvé", "Attention", JOptionPane.WARNING_MESSAGE);
}
Sheet sheet = workbook.getSheet(0);
Cell a1 = sheet.getCell(0,0);
String contenuA1= a1.getContents();
float monFloat = Float.parseFloat(contenuA1);
if (monFloat == 4.21F){
jop1 = new JOptionPane();
jop1.showMessageDialog(null, "ok ça marche", "Information", JOptionPane.INFORMATION_MESSAGE);
}
}
} |
Ce code utilise la librairie jexcelapi disponible ici : http://sourceforge.net/projects/jexc...les/jexcelapi/
Voici le fichier excel que le code doit lire :
Pièce jointe 198561