Open a cmd line and type
jar tvf <yourjarfile>
You will see a list containing your classes, the dots replaced with slashes.
Now, check if your shap(e) files are in the same packacke/directory as
the class calling
his.getClass().getResource("map.shp");
If your class is called at.mycompany. myclass.class you should se
at/mycompany/myclass.class
at/mycompany/map.shp
If your shape file is in another package/directory, use
this.getClass().getResource(<location as shown in output of jar tvf>);
Hope this helps
Cheers
Christian
Quoting Jan Peters <[email protected]>:
> Dear all,
> last time I asked I tried to load a shapefile from the web and
> thanks to Ian Turton I got a solution for that.
>
> My problem now is that the loading of the file takes quite a while,
> so I would rather prefer to load it while my WebStart application
> starts so the user has the file locally stored in a jar file that is
> being retrieved on load of the application.
>
> Unfortunately these
>
> URL shapeurl = this.getClass().getResource("map.shp");
>
> and
>
> URL shapeurl = this.getClass().getClassLoader().getSystemResource("map.shp");
>
> do not work (null pointer exception, the application does not seem
> to find the path, but I tried every combination of package name,
> relative and absolute paths etc. to no avail).
>
> Am I missing something fundamental here?
>
> Regards and thanks in advance again
> Jan
> --
> Neu: GMX De-Mail - Einfach wie E-Mail, sicher wie ein Brief!
> Jetzt De-Mail-Adresse reservieren: http://portal.gmx.net/de/go/demail
>
> ------------------------------------------------------------------------------
> Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
> Finally, a world-class log management solution at an even better price-free!
> Download using promo code Free_Logger_4_Dev2Dev. Offer expires
> February 28th, so secure your free ArcSight Logger TODAY!
> http://p.sf.net/sfu/arcsight-sfd2d
> _______________________________________________
> Geotools-gt2-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>
----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires
February 28th, so secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users