I have finished developing my application which uses geotools. Now I have to
deliver it and I can't run JAR file. This is quite an awkward situation and I
don't know how to solve this problem, so please hurry up with help.The problem
is as follows:I built JAR file using maven shade plugin. When I try to run my
runnable JAR, my application starts and then crashes. Here is the exception:
Exception in thread "main" java.io.FileNotFoundException:
C:\Users\ilija\Desktop\MavenizedCP\cp-map\target\file:\C:\Users\ilija\Desktop\MavenizedCP\cp-map\target\cp-map-0.0.1-SNAPSHOT.jar!\maps\ParcelsCountyRDMFinal5.shp
(The filename, directory name, or volume label syntax is incorrect) at
java.io.RandomAccessFile.open(Native Method) at
java.io.RandomAccessFile.<init>(Unknown Source) at
org.geotools.data.shapefile.ShpFiles.getReadChannel(ShpFiles.java:834)
at
org.geotools.data.shapefile.shp.ShapefileReader.<init>(ShapefileReader.java:240)
at
org.geotools.data.shapefile.ShapefileDataStore.openShapeReader(ShapefileDataStore.java:558)
at
org.geotools.data.shapefile.ShapefileDataStore.readAttributes(ShapefileDataStore.java:785)
at
org.geotools.data.shapefile.ShapefileDataStore.getSchema(ShapefileDataStore.java:743)
at
org.geotools.data.AbstractFileDataStore.getFeatureSource(AbstractFileDataStore.java:77)
at
org.geotools.cp_map.SelectionLab.displayShapefile(SelectionLab.java:216)
at org.geotools.cp_map.SelectionLab.main(SelectionLab.java:206)
And here is the code line that 216 and 206:
public static void main(String[] args) throws Exception {
SelectionLab me = new SelectionLab(); final File file = new
File(ClassLoader.class.getResource("/maps/ParcelsCountyRDMFinal5.shp").getPath());
me.displayShapefile(file); \\206}
public void displayShapefile(File file) throws Exception {
FileDataStore store = FileDataStoreFinder.getDataStore(file);
featureSource = store.getFeatureSource(); \\216 So here is the exception!!!!
setGeometry();
I am assuming that FileDataStoreFinder.getDataStore(file) is not capable to
deal with file address from within JAR but I'm not sure. Please help with
this!!!P.S. when I run my application from Eclipse everything works just fine!
------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
GeoTools-GT2-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users