Note that there are some explanatory texts on larger screens.

plurals
  1. PO"A Java Exception has Occurred" Apache POI Error
    text
    copied!<p>Im writing a program in java that takes an excel sheet from a local file and uploads the values given into the program for some calculations. When I compile inside eclipse everything works exactly as it is supposed to, but when I create a runnable jar file, I get a popup error "A Java Exception has Occurred". I went through the code, and if i remove the method to load the values from the spreadsheet the runnable jar works just fine. But if i put the code back in to load the values, it breaks. What is happening in this block of code that causes the whole program to break?</p> <pre><code> private static void loadValues() throws IOException{ //FileInputStream file = new FileInputStream(new File("src/PricingData.xls")); FileInputStream file = new FileInputStream(new File("F:/Sales/Stitt/PricingData.xls")); HSSFWorkbook wb = new HSSFWorkbook(file); HSSFSheet sheet = wb.getSheetAt(0); Cell cell = sheet.getRow(1).getCell(1); MLPPSF = cell.getNumericCellValue(); cell = sheet.getRow(2).getCell(1); COPPSF = cell.getNumericCellValue(); cell = sheet.getRow(3).getCell(1); GPPSF = cell.getNumericCellValue(); cell = sheet.getRow(4).getCell(1); UPFINISHED = cell.getNumericCellValue(); cell = sheet.getRow(5).getCell(1); LOWFINISHED = cell.getNumericCellValue(); cell = sheet.getRow(6).getCell(1); DPPSF = cell.getNumericCellValue(); cell = sheet.getRow(8).getCell(1); onePanelWaterHeater = cell.getNumericCellValue(); cell = sheet.getRow(9).getCell(1); twoPanelWaterHeater = cell.getNumericCellValue(); cell = sheet.getRow(10).getCell(1); saferoomCost = cell.getNumericCellValue(); cell = sheet.getRow(11).getCell(1); solarPVCost = cell.getNumericCellValue(); cell = sheet.getRow(12).getCell(1); metlundCost = cell.getNumericCellValue(); cell = sheet.getRow(13).getCell(1); ervCost = cell.getNumericCellValue(); cell = sheet.getRow(14).getCell(1); gasFireplaceCost = cell.getNumericCellValue(); cell = sheet.getRow(15).getCell(1); woodFireplaceCost = cell.getNumericCellValue(); cell = sheet.getRow(18).getCell(1); allCabVanPercent = cell.getNumericCellValue(); cell = sheet.getRow(19).getCell(1); allAppliancePercent = cell.getNumericCellValue(); cell = sheet.getRow(20).getCell(1); allLightFixPercent = cell.getNumericCellValue(); cell = sheet.getRow(21).getCell(1); allPlumbFixPercent = cell.getNumericCellValue(); cell = sheet.getRow(22).getCell(1); allFloorCoveringPercent = cell.getNumericCellValue(); cell = sheet.getRow(25).getCell(1); DepositPercent = cell.getNumericCellValue(); cell = sheet.getRow(26).getCell(1); Draw1Percent = cell.getNumericCellValue(); cell = sheet.getRow(27).getCell(1); Draw2Percent = cell.getNumericCellValue(); cell = sheet.getRow(28).getCell(1); Draw3Percent = cell.getNumericCellValue(); cell = sheet.getRow(29).getCell(1); Draw4Percent = cell.getNumericCellValue(); cell = sheet.getRow(30).getCell(1); Draw5Percent = cell.getNumericCellValue(); cell = sheet.getRow(31).getCell(1); Draw6Percent = cell.getNumericCellValue(); cell = sheet.getRow(32).getCell(1); Draw7Percent = cell.getNumericCellValue(); cell = sheet.getRow(33).getCell(1); Draw8Percent = cell.getNumericCellValue(); cell = sheet.getRow(34).getCell(1); Draw9Percent = cell.getNumericCellValue(); } </code></pre> <p>And the main is:</p> <pre><code> public static void main(String[] args) { // TODO Auto-generated method stub initialize(); try { loadValues(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } showGUI(); } </code></pre> <p>EDIT:</p> <p>Here is the error when I run it through command line.</p> <pre><code>C:\Documents and Settings\Conference Room\SESI&gt;java -jar SESI.jar Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/poi/ss/use rmodel/Cell at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Unknown Source) at java.lang.Class.getMethod0(Unknown Source) at java.lang.Class.getMethod(Unknown Source) at sun.launcher.LauncherHelper.getMainMethod(Unknown Source) at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source) Caused by: java.lang.ClassNotFoundException: org.apache.poi.ss.usermodel.Cell at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 6 more C:\Documents and Settings\Conference Room\SESI&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload