uri is not hierarchical 学习了:http://blog.csdn.net/zdsdiablo/article/details/1519719 在swt中获取jar包中的文件: Image backgroundImage = null; try { backgroundImage = new Image(Display.getCurrent(), this.getClass().getResourceAsStream("login.jpg")); } catch…
// 第一种: 2 File f = new File(this.getClass().getResource("/").getPath()); // 结果: /Users/admin/Documents/IdeaProjects/Demo/out/production/Demo System.out.println(f); f = new File(this.getClass().getResource("").getPath()); // 多返回了包名 // 结…