Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How compare two URLs for equality if one uses jar protocol?

843785Dec 5 2008 — edited Dec 6 2008
I'm trying to see if some URLs are referring to the same jar file but some of them come with the prepend/append of "jar:file:/" and "!/" and some are just as "file:/". So when I call "URL.equals(...)", it returns false. How do I properly compare these two?
//Returns false, even though both can be used to find the jar file
new URL( "jar:file:/home/me/tmp.jar!/" ).equals( new URL( "file:/home/me/tmp.jar" ) );
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 3 2009
Added on Dec 5 2008
3 comments
217 views