Extract some content from jar-file downloaded with JWS

后端 未结 2 518
没有蜡笔的小新
没有蜡笔的小新 2021-01-24 05:21

im trying to extract some files from a jar-file downloaded using java-webstart. below code was used to locate the jar and initiate the FileSystem

1 final Protect         


        
2条回答
  •  青春惊慌失措
    2021-01-24 06:12

    the logs says: url=http://localhost:8080/myjarfile.jar

    That was a security decision made by Sun, before Oracle acquired them. They decided it was no business of applets or JWS apps. to know the location of the resources on the local file-system, so the URI returned will now always point back to the server, even if they are cached locally & the app. has all-permissions security level.

    So any good ideas of how to proceed?

    Redesign the app. That is the only practical solution.

    There are a number of ways to iterate a Zip or Jar for the content, but the simplest method is to include a list of the content in a known location of the Jar, locate it using getResource(), read it, then extract each resource.

提交回复
热议问题