Quantcast
Channel: Active questions tagged excel - Stack Overflow
Viewing all articles
Browse latest Browse all 88081

include excel in .jar

$
0
0

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


Viewing all articles
Browse latest Browse all 88081

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>