On Mon, 14 Dec 1998 [EMAIL PROTECTED] wrote:

The stuff you outline here depends on your shell: even on Unix it won't
work in all cases without some changes.

Solutions on NT:
1  Get bash and use that to run your java app. Then you can use your
backticks and other funnies. I think you can get it at www.cygnus.com. I
was looking at bash source code a while back and it looks intended to
compile for OS/2. Maybe the standard version will compile for NT with the
right compiler (probably gcc), maybe not. Look for gcc at cygnus too.

2  Use the set command:
set <environment.dat
and process the file. Will work on Linux too though the file may look
different.

3  Use java.util.Properties. This is what it's for. Here's what the stored
format looks like:
[summer@possum etc]$ cat sp.profile
#Some comments supplied by app
#Mon Dec 14 13:38:48 GMT 1998
watchthis=BHP
dbserver=http://database/cgi-bin/
MyCharts.y=698
MyCharts.x=1216
watchlist=http://database/cgi-bin/list
[summer@possum etc]$ 


> I am getting some requests from NT users on an application that I wrote on 
> a Java/Linux environment. I have a Java application that runs fine on Unix 
> and I am trying to get to run perfectly on NT. I have a run time shell 
> script that passes the entire environment to the JVM using a system 
> property.
> 
>         java -Denv=`env` xenon.xsql.editor.Xsql
> 
> The env produces the multiline environment variables list that we know and 
> love. On running the application the program looks for the value of system 
> property called `env'. Hence the JVM gets the entire environment. I have 
> source code that breaks down the multiline value and cuts out each variable 
> definition like `HOME=/home/peterp'. The definition is further split into a 
> name and value (`HOME' and `/home/peterp') and then place stored in the 
> system properties as renamed property `env.HOME' and `/home/peterp'. In 
> short all the environment variable are prepended with `env.'. Using this 
> hand-me-down old deprecated source code from an unknown URL, I can write 
> code like this:
> 
>         String imagesDir=System.getProperty("env.IMAGES_DIR");
>         String searchPath=System.getProperty("env.JAVAFILESEARCHPATH");
>         
> 
> Of course this does not work with Windows NT (or 95/98). I am not an expert 
> on NT. I do not think there is an equivalent for `env' under NT.
> Is there such thing ?
> 
> Of course I could write a work around that involve just passing a limited
> number of properties to JVM in a NT batch command `.BAT' file.
> 
>         java -DIMAGES_DIR=%IMAGES_DIR%  ...  xenon.sql.editor.Xsql
> 
> Admittedly the full final code would look terrible ugly. I am clueless if 
> the DOS? W95/NT Shell allows long character lines. Can you even do `back 
> subtitution' using the W95/NT shell is also quite another thing as well? 
> Also when I tried extending my `PATH' under W95 I got `out of environment 
Read the docs on command.com - you need to expand the environment space.
Commandline lenght is acutely limited and you can't expand it.

> space' or something?
> 
> However do any other java-linuxers know of a better solution or API?
> 
> Any help receives my grateful kudos.
> 
> Pete
> 

-- 
Cheers
John Summerfield
http://os2.ami.com.au/os2/ for OS/2 support.
Configuration, networking, combined IBM ftpsites index.

Reply via email to