I recently upgraded to JDK 9, and Eclipse complains that it sun.misc.Launchercould not be imported. It seems sun.misc.Launcherunsafe. I am looking for an alternative to replace this line of code in my project.
final URL url = Launcher.class.getResource("/");
Any help would be appreciated.
Update: a more complete version of the above code block:
final URL url = Launcher.class.getResource("/");
final File fs = new File(url.toURI());
for (File f : fs.listFiles()) {
System.out.println(f.getAbsolutePath());
}
This is for printing all the files in the folder srcwhen the program starts in the IDE.
source
share