I have been searching for 3 days now nonstop looking at every post I can find. My program runs on IntelliJ, but cannot run on an executable. Your help would be appreciated :)
More importantly, where can I find a in depth user-friendly tutorial? Is there a course or book I can pay for? On Udemy, the java classes completely fail to mention I/O such as classpath and URI. TutorialsPoint briefly goes over I/O buts its not indepth. Did I miss something? Is there an easier way to do all this??
Similar posts that have not worked for me: Java Jar file: use resource errors: URI is not hierarchical https://stackoverflow.com/a/27149287/155167
I am trying to load an excel file. I am using Maven. Apache POI says it needs a File. So InputStream does not work. http://poi.apache.org/components/spreadsheet/quick-guide.html#FileInputStream
When I java -jar jarFile, it gives me the error:
C:\Users\1010\Documents\Personal\MonsterManager>java -jar monsterManagerVer3.jar
Exception in thread "main" java.lang.IllegalArgumentException: URI is not hierarchical
        at java.base/java.io.File.<init>(File.java:421)
        at LoadExcel.<init>(LoadExcel.java:62)
        at monsterRunner.<init>(monsterRunner.java:13)
        at monsterRunner.main(monsterRunner.java:24)
Here is the code
public LoadExcel() throws IOException, URISyntaxException, InvalidFormatException {
        mNames = null;
        URL ins = this.getClass().getResource("/excel_List.xlsx");
        if (ins == null)
            throw new FileNotFoundException("The XLSX file didn't exist on the classpath");
        ins.toString().replace(" ","%20"); //<-Runs without this part
        File file = new File(ins.toURI()); //this is line 62
       // File f = new File(getClass().getResource("/MyResource").toExternalForm());
        //String path = this.getClass().getClassLoader().getResource("/excel_List.xlsx").toExternalForm();
        //File file = new File(path);
        OPCPackage pkg = OPCPackage.open(file);
        XSSFWorkbook wb = new XSSFWorkbook(pkg);
        //FileInputStream fis=new FileInputStream(new File(excelFile));
       // XSSFWorkbook wb = new XSSFWorkbook(fis);
        XSSFSheet sheet = wb.getSheetAt(0);
        loadExcel(sheet);
        cacheNames();
      //  fis.close();
        wb.close();
    }
If it helps here is the path to the excel file: src\main\resources\excel_List.xlsx
UPDATE: so I took the excel file out of the resources folder \nameOfMyProgram\excel_List.xlsx and now I get this error. I tried several versions of using the classLoader, Class and Thread to solve this error from Different ways of loading a file as an InputStream but I still cannot get it to compile.
 
    