Hi Rafael, Those GDAL-related errors are actually because you have too many jars, not too few. Some of the grid coverage related modules in GeoTools require GDAL. I'm not sure which one(s) are the culprit (it's late on Sunday evening local time so I won't go looking now). But the important thing is that this highlights the difficulty of using GeoTools without using Maven to (a) include only the GeoTools modules you really need and (b) have it take care of the dependencies for you including other GeoTools modules and 3rd party jars.
Many of us have a love-hate relationship with Maven but we use it because the alternative, with a GeoTools project, is endless obscure errors and wasted time, ie. Maven is the lesser evil (or as Ben, one of the developers says: resistance is futile). I'm also using a Mac + NetBeans 7.1 + Java 1.6. NB has really good Maven support so that helps ease the pain :) The learning curve for Maven, especially if you start with the Quickstart explanation of the pom.xml file, is not too bad. That said, there was a Quickstart tutorial at one stage for non-Maven builds (delivered as a workshop) but it involved taking several of the GeoTools jars out of the mix. I haven't tried it myself for a couple of years - Jody or others here might be able to advise you. I'll check the list tomorrow (my time, Sydney) to see how you're going. Michael On 1 April 2012 20:53, Rafael Santos <[email protected]> wrote: > Michael, thanks for the quick reply. Unfortunately I am also having problems > with V8. > > Hello Rafael, > > I've tried the steps in > http://docs.geotools.org/latest/userguide/tutorial/quickstart/netbeans.html > (without using maven, I've just added all .jars from the binary > distribution to my project). > The source code in that example does not compile -- the error is > method showMap in class org.geotools.swing.JMapFrame cannot be > applied to given types; > required: org.geotools.map.MapContext > > This sounds like a confusion of versions. Perhaps you are working with > the latest quickstart code, which is intended to be used with GeoTools > version 8, but compiling it against GeoTools 2.7 ? It works as > advertised with GeoTools v8. > > Here are my steps: > > Downloaded Geotools 8.0 M4 and unzipped it. > Create a new project in Netbeans. > Instead of using maven (please see excuse below) I've manually added all > .jars to my project. > Got the code from (it says "GeoTools 8.0-M3 User Guide, but...") and copied > it, only changed the name of the package. > Got an exception (shown at the end of the message). > > > I'm not using maven because for this project I will add some other jars and > since I am not familiar with it I decided to skip an additional layer of > complexity. If it is absolutely required I would reconsider. > I am on a Mac, so Java is 1.6 and JAI is already installed. Here are the > exceptions, which I sort of understand but seems to me some jars are > missing. > Should I go to V8 M3 or (gasp) use maven to solve this? > > thanks > Rafael > > > run: > Exception in thread "main" java.lang.NoClassDefFoundError: > it/geosolutions/imageio/gdalframework/GDALImageReaderSpi > at java.lang.ClassLoader.defineClass1(Native Method) > at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631) > at java.lang.ClassLoader.defineClass(ClassLoader.java:615) > at > java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141) > at java.net.URLClassLoader.defineClass(URLClassLoader.java:283) > at java.net.URLClassLoader.access$000(URLClassLoader.java:58) > at java.net.URLClassLoader$1.run(URLClassLoader.java:197) > at java.security.AccessController.doPrivileged(Native Method) > at java.net.URLClassLoader.findClass(URLClassLoader.java:190) > at java.lang.ClassLoader.loadClass(ClassLoader.java:306) > at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) > at java.lang.ClassLoader.loadClass(ClassLoader.java:247) > at java.lang.Class.forName0(Native Method) > at java.lang.Class.forName(Class.java:247) > at sun.misc.Service$LazyIterator.next(Service.java:271) > at > javax.imageio.spi.IIORegistry.registerApplicationClasspathSpis(IIORegistry.java:190) > at javax.imageio.spi.IIORegistry.<init>(IIORegistry.java:121) > at > javax.imageio.spi.IIORegistry.getDefaultInstance(IIORegistry.java:142) > at apple.awt.CToolkit.registerDefaultServices(CToolkit.java:1335) > at apple.awt.CToolkit.<init>(CToolkit.java:144) > at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) > at > sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) > at > sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) > at java.lang.reflect.Constructor.newInstance(Constructor.java:513) > at java.lang.Class.newInstance0(Class.java:355) > at java.lang.Class.newInstance(Class.java:308) > at java.awt.Toolkit$2.run(Toolkit.java:859) > at java.security.AccessController.doPrivileged(Native Method) > at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:826) > at > javax.swing.JFileChooser.installShowFilesListener(JFileChooser.java:369) > at javax.swing.JFileChooser.setup(JFileChooser.java:354) > at javax.swing.JFileChooser.<init>(JFileChooser.java:333) > at javax.swing.JFileChooser.<init>(JFileChooser.java:286) > at > org.geotools.swing.data.JFileDataStoreChooser.<init>(JFileDataStoreChooser.java:130) > at > org.geotools.swing.data.JFileDataStoreChooser.<init>(JFileDataStoreChooser.java:114) > at > org.geotools.swing.data.JFileDataStoreChooser.<init>(JFileDataStoreChooser.java:66) > at > org.geotools.swing.data.JFileDataStoreChooser.showOpenFile(JFileDataStoreChooser.java:227) > at > org.geotools.swing.data.JFileDataStoreChooser.showOpenFile(JFileDataStoreChooser.java:211) > at QuickStart.main(QuickStart.java:30) > Caused by: java.lang.ClassNotFoundException: > it.geosolutions.imageio.gdalframework.GDALImageReaderSpi > at java.net.URLClassLoader$1.run(URLClassLoader.java:202) > at java.security.AccessController.doPrivileged(Native Method) > at java.net.URLClassLoader.findClass(URLClassLoader.java:190) > at java.lang.ClassLoader.loadClass(ClassLoader.java:306) > at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) > at java.lang.ClassLoader.loadClass(ClassLoader.java:247) > ... 39 more > Java Result: 1 > BUILD SUCCESSFUL (total time: 2 seconds) > ------------------------------------------------------------------------------ This SF email is sponsosred by: Try Windows Azure free for 90 days Click Here http://p.sf.net/sfu/sfd2d-msazure _______________________________________________ GeoTools-GT2-Users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
