开发者

Java Relative URL for URL class

开发者 https://www.devze.com 2023-04-06 17:03 出处:网络
I have 开发者_StackOverflow社区a file in my working project. It\'s in the current directory of source code.

I have 开发者_StackOverflow社区a file in my working project. It's in the current directory of source code.

Main
   -> src
       [packeges]
   -> plugin
        ->MyLib.jar
   -> other

I have a class in a packege of the src folder. Now I want to load the jar file to URL class like,

new URL("jar:file:/./plugin/MyLib.jar!/") // this relative file path is wrong

Could you please tell me what is the corrent relative path here?


I think that "." refers to the current directory of your binaries (*.class), not of your source code. Try create a url relative to your binaries.

0

精彩评论

暂无评论...
验证码 换一张
取 消