[postgis-users] PostGIS and Java

David Potts dave.potts at pinan.co.uk
Tue Mar 4 02:47:36 PST 2008


If it does't compile, then its not seeing the contents of thejar files,
then its a classpath issue. Its not a problem with the software, just the
software envronment.

The setting of a classpath is a platform specfic issues because of the
different file seperator used between different platforms.

On windows you say

javac -classpath D:\myprogram;D:\myprogram\lib\supportLib.jar
org.mypackage.HelloWorld

This instructs java on windows to look in the directories d:\myprogram and
d:\myprogram\lib\supportLib.jar when attempting to find classes.

On a unix boxes, you would replace the \ character with a / and the ;
character with a :

See http://en.wikipedia.org/wiki/Classpath_(Java) and 
http://www.kevinboone.com/classpath.html for more information.

Please note that when you invoke your program, you will also need to
include the classpath.



> Thanks for you help David,
>
> The problem is that it doesn't compile because theses classes are
> missing or don't work. On my classpath I have:
> - postgis-1.3.2.jar
> - postgresql-8.2-508.jdbc2.jar or postgresql-8.2-508.jdbc3.jar
> Which Jar is missing?
>
> Gérald
>
> 2008/3/4, David Potts <dave.potts at pinan.co.uk>:
>> whats the nature of the error message ?
>>
>>  Do you get messages about not being able to find the class when your
>>  building your application or some type of error when you run your
>>  application?
>>
>>  >From what you have said so far I would suspect a class issue problem,
>> ie
>>  the jar file that includes the correct postgres deriver is not on your
>>  classpath.
>>
>>  There is one jar file that includes all the class files that are
>> required
>>  to access a postgres database.  There another jar file include with the
>>  postgis download, it includes all the addional classes required to
>> access
>>  the postgis data types.  It must be include in your class path as well
>> as
>>  thenormal postgres java driver class.
>>  D.
>>
>> > Hello,
>>  >
>>  > I am using PostGIS 1.3.2 with PostgreSQL 8.2 and Java 6 and Debian
>>  > Linux Testing.
>>  >
>>  > The Java/JDBC examples provided in chapter 4.8 of documentation don't
>>  > work.
>>  > http://postgis.refractions.net/docs/ch04.html#id2911266
>>  >
>>  > I can't find the org.postgresql.Connection class, does it still
>> exist?
>>  > If I use the org.postgresql.PGConnection instead, addDataType methods
>>  > are deprecated and do nothing (the resultSet.getObject("geom")
>> returns
>>  > a String instead of PGgeometry).
>>  >
>>  > At the moment, the only workaround I found is using the basic JDBC
>>  > connection without modification and then I do
>>  > PGgeometry pgGeometry = new PGgeometry( (String)
>>  > resultSet.getObject("geom") );
>>  >
>>  > Is it the right way to read the geo data?
>>  >
>>  > Thanks for your help,
>>  > Gerald
>>
>> > _______________________________________________
>>  > postgis-users mailing list
>>  > postgis-users at postgis.refractions.net
>>  > http://postgis.refractions.net/mailman/listinfo/postgis-users
>>  >
>>
>>
>>  --
>>  Any views expressed in this message are those of the individual sender,
>>  except where the sender specifically states them to be the views of the
>>  Pinan Software
>>
>>
>>  _______________________________________________
>>  postgis-users mailing list
>>  postgis-users at postgis.refractions.net
>>  http://postgis.refractions.net/mailman/listinfo/postgis-users
>>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>


-- 
Any views expressed in this message are those of the individual sender,
except where the sender specifically states them to be the views of the
Pinan Software





More information about the postgis-users mailing list