System.getProperty("os.name")

Hey
Can any one tell me what does the return string value for System.getProperty("os.name") on unix platform. i am asking this since i dont have unix installed on my system to test it.
Tkx in advance

It comes back w/ the basic flavor.
ie
AIX -> AIX
Linux -> Linux
HP-UX -> HP-UX
Solaris -> Solaris

Similar Messages

  • System.getProperty("user.name") not working without /etc/passwd, CentOS 4.3

    Dear all,
    I'm having trouble getting the system property user.name (which we need in our ant scripts) on our CentOS box. :(
    When running the program below thru
    java dumpproperties2
    it prints "user.name='?'" on our CentOS 4.3. On win32 it works. It turns out that if you add the account corresponding to the EUID to /etc/passwd it works correctly. However, we don't use passwd authentication but an enterprise wide LDAP-system. Our /etc/nsswitch.conf says:
    passwd: files ldap
    One work around is to replace the java executable with a script that does
    /path/to/jdk/bin/java -Duser.name=$USER -Duser.home=$HOME $@
    Used jdk is j2se 1.5.0_13 Linux 32-bit.
    Some questions for the experts:
    1) Is there any other way?
    2) Is it a known issue that Linux versions of the jdk just looks in /etc/passwd to map uid to user name (and home dir) instead of doing what the rest of the system, like whoami, does? I haven't found anything in either the readme or installation instructions, nor in the bug db.
    Br, Jesper Tr�g�rdh
    public class dumpproperties2 {
        public static void main(String[] args) {
         String s = System.getProperty("user.name");
         System.out.println("user.name='" + s + "'");
    }

    Does this work?
    //public final class System
    public static String getenv(String name)Then you can access the USER environment from inside Java.

  • System.getProperty("pc.name") ???

    As the title of this post implies, I would like to get the PC name from within a client-side java app. Unfortunately "pc.name" is not a valid system property key. Nor are there any, as far as I can tell, that give me what I want.
    Can anybody tell me how a client-side app can get the name of the PC on which it is running?
    To be completely clear, I want the name that shows up when I click Start > Settings > Control Panel > System > Network Identification. (Yes, I'm running Win2K...)
    Thanks!
    Bill

    Hi,
    :. Try this one. Comments in Portuguese.
    class ... whatever you want, a library for instance.
      public static final String OS_WINDOWS        = "Windows";
      public static final String OS_LINUX          = "Linux";
      public static final int CMD_SUCCESS          = 0;
      // = = = = = = = = = = = = = = = = = = = = = = =
      // Carrega as variaveis de ambiente (#014)
      public static boolean loadEnvironmentVariables()
      { boolean bRet  = false;
        String cmd    = "";
        String opsys  = System.getProperty("os.name","");
        try
        { if (opsys.startsWith(OS_LINUX))   cmd = "sh -c set";
          if (opsys.startsWith(OS_WINDOWS)) cmd = "command.com /c set";
          if (!cmd.equals(""))
          { Process p = Runtime.getRuntime().exec(cmd);
            if (p.waitFor() == CMD_SUCCESS)
            { InputStream is = p.getInputStream();
              Properties pr  = new Properties(System.getProperties());
              pr.load(is);
              System.setProperties(pr);
              bRet = true;
        catch(Exception e) {}
        finally
          return bRet;
      // = = = = = = = = = = = = = = = = = = = = = = =
      // Hostname (#016)
      public static String getHostname()
      { String sRet  = "";
        String opsys = System.getProperty("os.name","");
        if (opsys.startsWith(OS_LINUX))
        { sRet = System.getProperty("HOSTNAME","");
        else if (opsys.startsWith(OS_WINDOWS))
        { sRet = System.getProperty("COMPUTERNAME","");
        return sRet;
      // = = = = = = = = = = = = = = = = = = = = = = =
      // Username (#017)
      public static String getUsername()
      { String sRet  = "";
        String opsys = System.getProperty("os.name","");
        if (opsys.startsWith(OS_LINUX))
        { sRet = System.getProperty("USER","");
        else if (opsys.startsWith(OS_WINDOWS))
        { sRet = System.getProperty("USERNAME","");
        return sRet;
    :. First, call loadEnvironmentVariables method then getUsername,  getHostname, etc. Hope it helps and it was what you meant.
    Regards.
    Roque.

  • Where does user.name come from when using System.getProperty(user.name)

    Hello,
    Based on the user's requirements, I implemented authentication based on the results of the System.getProperty(user.name) feature. The audit group has some concerns on where the user.name value is coming from.
    Does anyone have any idea where this property is coming from, and if it is coming from a file, whether it is stored as text.

    Environment variable that is read internally by the JRE. If you go to dos (in windows) and type "set" and hit return, you'll see Username=whatever your login name is. If course, someone with the right credentials can change this.
    Unix has a similar feature.

  • System.getproperty("Var Name") gives null in RedHatLinux5

    Please provide some solution for this strange problem. I am able to get the system property value from terminal but when I use System.getproperty() I am getting null.
    Ex:
    echo $client
    ans: /home/naveen/client/classes
    from java program
    System.getproperty("client"); it gives null

    use getenv(), instead of getProperty()

  • Applet, System.getProperty question

    I am trying to develop a simple applet that would capture the NT user name with System.getProperty("user.name"). This will not work with servlet because it will only return the server user.name. With applets running on clients systems, I was hoping that this will work. My applet has only 1 button and 1 text field. It runs fine in a debug mode in Forte 2.0. It generates an error msg when I run in in Forte. It doesn't do anything if I add the class to a html file. Am I on the right track here or what do I need to do to get this to work?
    private void button1ActionPerformed(java.awt.event.ActionEvent evt) {
    String login = System.getProperty("user.name");
    textField1.setText(login);
    This works in a debug mode in Forte, but fails when I run it. This is the error message:
    Exception occurred during event dispatching:
    java.security.AccessControlException: access denied (java.util.PropertyPermission user.name read)
    at java.security.AccessControlContext.checkPermission(AccessControlContext.java:272)
    at java.security.AccessController.checkPermission(AccessController.java:399)
    at java.lang.SecurityManager.checkPermission(SecurityManager.java:545)
    at java.lang.SecurityManager.checkPropertyAccess(SecurityManager.java:1278)
    at java.lang.System.getProperty(System.java:560)
    at LoginApplet.button1ActionPerformed(LoginApplet.java:40)
    at LoginApplet.access$0(LoginApplet.java:39)
    at LoginApplet$1.actionPerformed(LoginApplet.java:20)
    at java.awt.Button.processActionEvent(Button.java:329)
    at java.awt.Button.processEvent(Button.java:302)
    at java.awt.Component.dispatchEventImpl(Component.java:2595)
    at java.awt.Component.dispatchEvent(Component.java:2499)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:319)
    at java.awt.EventDispatchThread.pumpOneEvent(EventDispatchThread.java:103)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:84)

    Hi,
    As you can see you received a Security exception, for a good reason. If you could access a username and/or password then your computer could be compromised. Anyone could then write an unseen applet embedded in their web page that gathers username/password for any computer that requests the web page. The security manager on that specific PC (or web browser) would have to be modified specifically to allow this sort of access, which is not advised because then anyone else with this type of applet could get the same information that you are attempting to get (if you request a web page on another site with that applet requesting you system information).
    Hopefully this helps.

  • What is windows2000's system property (os.name)?

    Thanks for replying!!!

    Windows 2000
    from:
    System.err.println("OS NAME = ***"+System.getProperty("os.name")+"***");
    prints out:
    OS NAME = ***Windows 2000***

  • Java 7 u45 System.getProperty returns null

    After upgrade to u45, our web launch application stopped working. it failed at System.getProperty("myproperty").
    "myproperty" is defined as a
    <resources>       
    <j2se version="1.6+" initial-heap-size="64m" max-heap-size="256m"/>
           <jar href="nms_wsclient.jar" download="eager" main="true"/>
           <jar href="commons-httpclient.jar" download="eager"/>      
          <jar href="commons-codec.jar" download="eager"/>       
          <jar href="commons-logging.jar" download="eager"/>       
          <jar href="log4j.jar" download="eager"/>       
          <property name="myproperty"   value="http://138.120.128.94:8085/"/>
        </resources>
    with older version java ,System.getProperty("myproperty") works fine to return the value, but with u45 it returned null.
    Does anyone have the same problem? any idea how to fix it or work around it?
    Thanks,
    Zhongyao

    So did you succeed with the jnlp template ?
    After frustrating hours of that information useless JNLPSigningException trial & error, It seems that as :
    1. You can't make the j2se version variable
    2. You can't have your own variable property/values
    I've opened a bug report...
    The documentation is atrocious, with a vague "we reserve the right to blacklist variable elements, but we will never say which ones".
    The JNLP example in the various example is a joke - Its a hello world jnlp, not a real world one.
    The JNLPSigningException must have been written my the same guys at Microsoft that did the "An Unknown Error As Occurred".
    I've had to clear the cache at every test, seems that the JNLP Template check didn't get the new updated JNLP from the web server.
    /rant over
    I think I'll try to bypass that JNLP property mess and get javaws to download my own "jnlp name".xml.config...

  • Alternative to System.getProperty("microedition.hostname")

    Hey is there any other alternative for 'System.getProperty("microedition.hostname")' to get the ip address of the device running the j2me midlet ??
    When you run the midlet on the emulator, System.getProperty("microedition.hostname") returns the PC's Name, but on a Nokia series 40(3rd E) device, it returns null.
    So is there an alternative to this to select the device's ip address ?

    First this is a pretty specific question which applies to a specific device rather than to reflection/reference. You might want to look for a forum that addresses the specific device.
    Second, you can print the system properties normally. Whether you can do that on the device depends on the device. If you succeed you might find an alternative.
    Third normally one uses the java.net.IpAddress to get a device IP. Does that not work for that device?

  • System.getProperty("user.home") is giving diferent results on diff versions

    I am working on windows 2000. When I try to get user.home using System.getProperty it gives me c:\documents and settings\my name.
    But the same things when tried on a windows 2003 server tries to look in c:documents and settings\default directory. Why is this?
    Please help.....

    In XP, the environment variable USERPROFILE is set to C:\Documents and Settings\<username>, and that value is picked up for user.home. Since the "user's home directory" varies by os, there will be variations. 98 is different than Linux than XP, etc.

  • Portal infomration System Number  and Name required

    Hi all,
    I need to know few details about the portal information. I am looking for System Number  and Name of portal mainly through WD program program . Could you please help me how to find this. I promise to award points. Do I need to have any Lib/Jar files required to get this info. Program tips are most helpfull and appreciated as well.
    General way to find in portal
    Log into Portal- >System Information -> Name info (Under Database)
    Log into Portal- >System Information -> System Number info  (under Licenses)
    Thank you,
    Regards
    Maruti

    System.getProperty("SAPSYSTEMNAME");  // System ID
    System.getProperty("SAPSYSTEM");   // System Number

  • Problem with System.getProperty( "com.stc.application.dataroot" ) in JCAPS6

    Hello everybody,
    I'm using JCAPS 6 but I have to follow a guideline of projects implemented with JCAPS 5.1.3.
    The project for example, has written for the logs-directory in method user initialize this code:
    // JCAPS uses JVM version 1.5
    logger.info( "--- BEGIN ------ JCAPS userInitialize" );
    String currRoot = System.getProperty( "com.stc.application.dataroot" );
    String log4j_props = currRoot + "/../../NameDirectory/" + collabContext.getProjectPath() + "/" +
    collabContext.getCollaborationName() + "_log4j.properties";
    With JCAPS 6 I don't know how to substitute "System.getProperty( "com.stc.application.dataroot" );" because with it don't function.
    Somebody can help me?
    Thanx!
    Fabrizio

    This is the correct code:
    // JCAPS uses JVM version 1.5
    logger.info( "--- BEGIN ------ JCAPS userInitialize" );
    String currRoot = System.getProperty( "com.stc.application.dataroot" );
    String log4j_props = currRoot + "/../../NoemaLife/" + collabContext.getProjectPath() + "/" + collabContext.getCollaborationName() + "_log4j.properties";
    but I have the same problem...

  • Define Logical Systems and Template Names for BW Reports

    Hi experts
    I would like to know if someone used the mentioned functionality 'Define Logical Systems and Template Names for BW Reports, I would like to know too IF I create a Z REPORT for example in webdynpro and insert it in this configuration it will work and where it will appear in sourcing cockpit?
    sds.
    Javier

    Hello Muthu,
    BW reports will be shown in SRM Box if the corresponding BW roles for SRM are integrated with SRM roles.
    You might to activate the corresponding datasource of this in SRM.
    And since you have to connect the source system to BW, I think you have to define SRM system as logical system in BW.
    Regards,
    Pavan

  • Source system 8(ODS name) does not exist

    Hi experts!
    When I transport some Process Chane from DEV to PRD I faced with issue that the source system 8(ODS name) does not exist.
    Is anyone faced with same error?
    Thx!

    Hi.......
    Look.......
    U cannot Transport it........First Right click on the Infoprovider in PRD >> Export Datasource...........then replicate it from bw myself........
    U hav to generate it in Production also.............hav u done this before replication.....?
    Regards,
    Debjani....

  • How to change the sender name "workflow system" to Diff name

    Hi ,,
      How to change the mail sender name that is "workflow system" to different name. Whenever the mail is triggered it shows the sender name as "workflow system" . i want to change the name of the sender..Even i changed the name of the WF-Batch(name) user but no use.. Pls advice.
    regards,
    Roops.

    Hi Roops,
    Check if the following [link1|Re: How to change text of wf batch??] [link2|Update should not happen in the name of WF-BATCH] helps you.
    Regards,
    Saumya

Maybe you are looking for

  • Creating distribution lists in SAP CRM 5.0 business workplace

    Hi Experts, We have CRM 5.0 and I have tried to create distribution lists for mailsending. After defining a name and a folder (that is then created) for the list the recipient list insertion is a following task. I can search for partners of different

  • How do i change the icloud on my devices

    Hi there, I have an Iphone and a Ipad and I was using the same Icloud account to do the backups, but now is full from my photos on streaming and the doccuments i use to do my work So i created a new Icloud account so i can use that new account for my

  • Overriding the DTD reference in XML

    Hi I have an xml file which references a dtd within the DOCType tag. The problem I have is that currently the reference is as follows: file:///D:/castor/castor-0.9.3.21/castor-0.9.3.21/doc/mapping.dtd which makes it specific to my machine. This file

  • Setup failure not recorded in Execution.ResultStatus

    If a step fails during the Setup section of my sequence, the result visible in a VB.NET event handler is "Passed", rather than the expected "Failed" or "Error". Private Sub ExecutionTwoFinished(ByVal sender As Object, ByVal e As NationalInstruments.T

  • Can I use 6.40 version sca's to Install NWDI for Netweaver 2004s SP14?

    Hi, I have installed Netweaver 2004s Java SP14 and wanted to install NWDI. I know I can use the sca's for Web AS 7.0 such as CMS, CBS, DTR. But I don't have those files right now, but I do have the three NWDI files JBUILDTOOL, OFFLINE,ONLINE sca file