I need to open a video file with my code, and it works fine in Eclipse, but when I export to the runnable JAR, I get the error "URI is not hierarchical."
I have seen people suggest using getResourceAsStream (), but I need to have a file object since I use Desktop.getDesktop.open (File). Can anyone help me out?
Here is the code:
try {
URI path1 = getClass().getResource("/videos/tutorialVid1.mp4").toURI();
File f = new File(path1);
Desktop.getDesktop().open(f);
} catch (Exception e) {
e.printStackTrace();
}
if that helps my list of folders like
EDIT: I plan to run this only on windows and use launch4j to create exe.
source
share