Module for generic platform information: platform.py

John Farrell jfarrell at mincom.com
Thu Oct 28 20:58:29 EDT 1999


"M.-A. Lemburg" wrote:
> John Farrell wrote:
> > I've attached an image of an inspection tool I happened to be running
> > which lists all Java system properties. You can get any value in the
> > right column by calling System.getProperty() with the string parameter
> > in the left column.

> Do I have to import anything special to get the System symbol into
> the current namespace or is System a builtin in JPython ? E.g.
> would
> 
> def java_vendor():
>    return System.getProperty('java.vendor')
> 
> work out of the box on JPython ? (Don't have a working jpython
> installation here at the moment to test this myself.)

---- jv.py ----
from java.lang import System

def java_vendor():
   return System.getProperty('java.vendor')

print java_vendor()
---- output ----
C:\download\python>msjpython jv.py
Sun Microsystems Inc.

System is in java.lang, which is automatically imported into every
Java program. However in JPython you have to explicitly import it 
(which confused me a bit, since I was so used to it just being there).

John




More information about the Python-list mailing list