On Wed, 16 Dec 1998 [EMAIL PROTECTED] wrote:

> Right then.
> 
> I notice that the GIMP is very in that it creates a `~/.gimp subdirectory' 
> to place multiple configurations. So does the the CDE on my Solaris box in 
> `~/.dt'. On non-Unix machine the `dot' directory does not make a lot of 
> sense. Is there a way to find if the JVM is running on a unix box or not?
> 
> 
> If not I can do it the hard way.
> can you mail me your UNIX & non UNIX settings:
> 
> System.out.println( "os.name    = "+ System.getProperty( "os.name"));
> System.out.println( "os.arch    = "+ System.getProperty( "os.arch"));    
> System.out.println( "os.version = "+ System.getProperty( "os.version"));
> 
> Somebody must have already have done this, if not I publish the results in 
> a web table in 1999!
> 
> Peter Pilgrim
> 
If you run this (snitched from the book justJava)
// Show how to read and write property files

import java.io.*;
import java.util.*;
 
public class y {
 
  public static void main(String args[]) {
    try {
      //String p = System.getProperty("os.version");  // get one property
      //System.out.println("ver="+p);
 
      ByteArrayOutputStream bos = new ByteArrayOutputStream();
      Properties P = new Properties(System.getProperties());
      System.getProperties().save(bos,"basic props");
      DataOutputStream ds = new DataOutputStream(bos);
      ds.writeBytes("awt.image.incrementaldraw=true\n");
      ds.writeBytes("awt.image.redrawrate=50\n");
      ds.close();
 
      byte[] tmp = bos.toByteArray();
      ByteArrayInputStream bis = new ByteArrayInputStream(tmp);
      P.load(bis);
      System.setProperties(P);
      System.getProperties().list(System.out);  // list all properties
 
     } catch (Exception e) {e.printStackTrace();}
 
   }
}

you will get a list of all properties. Amongst them you will find file and
path separators: use these and don't care what you're running on. By using
these properties, youa void the possibility of being caught out with a
system that you've not heard of.


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

Reply via email to