agora inbox for pljava-dev@postgresql.org  
help / color / mirror / Atom feed
Subject: [Pljava-dev] reading a file
Date: Thu, 11 Nov 2004 21:08:45 +0100
Message-ID: <thhal-0UV9vAvFgby4XuIsvFB4e0Uth9zp9hk@mailblocks.com> (raw)
In-Reply-To: <000901c4c826$a24c2c30$cd8055aa@ftgebus33>
References: <000901c4c826$a24c2c30$cd8055aa@ftgebus33>
	<4193C6CD.1040700@mailblocks.com>
	<thhal-0UF9vAu9gby4+GyfKzwWysQu9b865eo@mailblocks.com>

Russ,

>Hi,
>I wrote a Java class that needs to read in a properties text file.
>Where should I put the properties file in the Postgres environment so
>my class doesn't get a "File not found" error?
>Thanks,
>Russ
>  
>
PL/Java doesn't have an opinion about the location of files. I guess 
that what you are after is some mechanism that would allow you to use a 
path that is relative to your PostgreSQL environment? If you're using 
PostgreSQL 8.0, you can accomplish this by defining a property in the 
postgresql.conf file. Simply add the following:

    pljava.vmoptions = '-Dpgsql.home=/the/path/to/the/pgsql/dir'

You can access this property from Java using:

    String pgsqlHome = System.getProperty("pgsql.home");

I know this is perhaps not a perfect solution. Suggestions on 
improvements are more then welcome.

Regards,
Thomas Hallgren






view thread (4+ messages)  latest in thread

Message-ID: <thhal-0UV9vAvFgby4XuIsvFB4e0Uth9zp9hk@mailblocks.com>
Permalink:  ../thhal-0UV9vAvFgby4XuIsvFB4e0Uth9zp9hk@mailblocks.com/
Also on:    postgresql.org/message-id/thhal-0UV9vAvFgby4XuIsvFB4e0Uth9zp9hk@mailblocks.com

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pljava-dev@postgresql.org
  Subject: Re: [Pljava-dev] reading a file
  In-Reply-To: <thhal-0UV9vAvFgby4XuIsvFB4e0Uth9zp9hk@mailblocks.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox