Gloria Muñoz wrote:
> Hi all!
> I am creating my project using geotools2.0 in *Eclipse*. When I export 
> it to an executable jar file (through eclipse) the jar file does not 
> work. When double-clicked I have:
>  "* *Could not find the main class. Program will exit. "
> and  running from command-line I have:
> "Exception in thread "main" java.lang.NoClassDefFoundError: 
> org/geotools/map/MapContext
> Caused by: java.lang.ClassNotFoundException: org.geotools.map.MapContext
>         at java.net.URLClassLoader$1.run(Unknown Source)
>         at java.security.AccessController.doPrivileged(Native Method)
>         at java.net.URLClassLoader.findClass(Unknown Source)
>         at java.lang.ClassLoader.loadClass(Unknown Source)
>         at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
>         at java.lang.ClassLoader.loadClass(Unknown Source)
>         at java.lang.ClassLoader.loadClassInternal(Unknown Source)".
> When the project is run within Eclipse IDE everything works.
I am not sure I know the exact problem - but I do have one word of caution.

The we depend on the jar files having some extra data; each geotools jar 
has a META_INF/services folder that lists what "plug-ins" the jar 
provides. If you bundle them all up together in an executable jar I am 
not sure if system will work; you will need to test.
> My manifest file has the following lines:
> Manifest-Version: 1.0
> Class-Path: jars/geoapi-1.1.0alpha.jar jars/geoapi-2.0.jar jars/gt2-ar
>  cgrid-2.1.x.jar jars/gt2-legend.jar jars/gt2-main.jar jars/gt2-shapef
>  ile.jar jars/gt-legend.jar jars/jai_core.jar jars/jlfgr-1.0.jar jars/
>  JTS-1.6.jar jars/opengis-css-0.1.jar jars/sample-data.jar jars/units-
>  0.01.jar jars/vecmath-1.3.jar
> Main-Class: shapefileSimplification.GUI
> where GUI is the class containing the 'main()' method.
Best of luck; Can you try making a new main() method that just checks if 
CommonFactoryFinder.getFilterFactory( null ) works? That will answer my 
question...
Jody

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to