[Advanced-java] jar filename

Rimvydas Vaidelis rimvydas.vaidelis at nomagic.com
Sun Dec 4 23:14:00 PST 2005


String path =
hello.class.getProtectionDomain().getCodeSource().getLocation().getFile();
JarFile j = new JarFile(path);

Regards,

--
Rimvydas


Marko wrote:

> Hi all,
> Can you somehow get the filename of the jar that your class is in.
> eg.
> Test.jar
> inside the jar is hello.class
> >From hello.class i wanna get the jar filename that the class is in.
> So if i placed hello.class in test2.jar i can still get the right filename.
> JarFile j = new JarFile(???);
>
> I know its an odd question, but any help would be appreciated.
>
> Thanx
> _______________________________________________
> Advanced-java mailing list
> Advanced-java at lists.XCF.Berkeley.EDU
> https://lists.XCF.Berkeley.EDU/mailman/listinfo/advanced-java






More information about the Advanced-java mailing list