First exercise using Java Mapscript

Peter Lee (Planning Data Factory) peter.lee at PLANNINGDATAFACTORY.COM.AU
Fri Oct 19 02:13:14 EDT 2007


Dear List,

I have some experience using Mapserver CGI but am a newie to Java Manpscript. I tried to compile my first program in windows XP with the error:

import edu.umn.gis.mapscript.*;

public class mapscript_basic {
   public static void main(String[] args) {
      System.loadLibrary("mapscript");

      mapObj mapobject;
      imageObj mapimage;
      String mapfile;

      // set the map file to use
      mapfile = "global.map";
      
      // create a mapObj, initilized with the mapfile above
      mapobject = new mapObj(mapfile);

      // create an imgObj that has an image of the map
      mapimage = mapobject.draw();

      // save the mapimage to a file
      mapimage.save("worldmap.png",mapobject);
   }
}

Error:
mapscript_basic.java:1: package edu.umn.gis.mapscript does not exist
......

In fact, I have placed the two library files mapscript.jar and mapscript.dll in the folder JAVA_HOME\lib and set the env variable CLASSPATH  to JAVA_HOME\lib.

I got the files from the ms4w download ver 2.2.6. The library files are located at the folder C:\ms4w\Apache\cgi-bin\mapscript\java.

Any help to solving the problem will be greatly appreciated.



Peter



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20071019/93af5fe4/attachment.html


More information about the mapserver-users mailing list