I need to know what is the best way to export excel file into my .jar code.
I used GetDesktop open file statement, and that works good when I run it inside of Eclipse IDE. But when I export my code into a .JAR, the excel sheet will not open, it will not do anything.
public void actionPerformed(ActionEvent e) {
try { Desktop desktop = null;
if (Desktop.isDesktopSupported()) {
desktop = Desktop.getDesktop();
}
desktop.open(new File("Resources/pics/chart 2.xls"));
} catch (IOException ioe) {
ioe.printStackTrace();
}}
I have a picture image in a jframe, and I have 2 buttons, inside of the picture, for the user to click on. Depends on which button they click on, I need that certain excel file to open. Just for viewing purposes, no editing is involved. I tried using apache POI, but the excel file did not open at all, but when I use the code above at least it opens in eclipse. I see that there is others with the same problem, but mine I need it to just open excel not edit. thanks