在我的应用程序以这种方式加载资源的资源:加载包含在一个罐子里
WinProcessor.class.getResource("repository").toString();
,这给了我:
file:/root/app/repository (and I replace "file:" with empty string)
,当我从IDE运行我的应用程序也能正常工作,但是当我运行我的应用程序的罐子:
java -jar app.jar
的路径变为:
jar:/root/app.jar!/repository
有没有什么办法可以解决这个问题?
我会为了创建这个使用“仓库”目录名称:
ConfigurationContext ctx = (ConfigurationContext) ConfigurationContextFactory.createConfigurationContextFromFileSystem(repositoryString, null);
以同样的方式,我会得到一个文件名(而不是目录),我将使用它是这样的:
System.setProperty("javax.net.ssl.trustStore", fileNameString)
同意。每当你不能100%肯定地说你会处理物理单个文件(java web start for one)时,你应该总是用流编码。 – 2009-02-22 12:16:38