How to get system Environment variable?

How to get system Environment variable without using jni?
just like "JAVA_HOME" or "PATH"...
Any reply is help to me!! :-)

Thx for your reply...
I get it!!!
Read environment variables from an application
Start the JVM with the "-D" switch to pass properties to the application and read them with the System.getProperty() method. SET myvar=Hello world
SET myothervar=nothing
java -Dmyvar="%myvar%" -Dmyothervar="%myothervar%" myClass
then in myClass String myvar = System.getProperty("myvar");
String myothervar = System.getProperty("myothervar");
This is useful when using a JAVA program as a CGI.
(DOS bat file acting as a CGI) java -DREQUEST_METHOD="%REQUEST_METHOD%"
-DQUERY_STRING="%QUERY_STRING%"
javaCGI
If you don't know in advance, the name of the variable to be passed to the JVM, then there is no 100% Java way to retrieve them.
NOTE: JDK1.5 provides a way to achieve this, see this HowTo.
One approach (not the easiest one), is to use a JNI call to fetch the variables, see this HowTo.
A more low-tech way, is to launch the appropriate call to the operating system and capture the output. The following snippet puts all environment variables in a Properties class and display the value the TEMP variable. import java.io.*;
import java.util.*;
public class ReadEnv {
public static Properties getEnvVars() throws Throwable {
Process p = null;
Properties envVars = new Properties();
Runtime r = Runtime.getRuntime();
String OS = System.getProperty("os.name").toLowerCase();
// System.out.println(OS);
if (OS.indexOf("windows 9") > -1) {
p = r.exec( "command.com /c set" );
else if ( (OS.indexOf("nt") > -1)
|| (OS.indexOf("windows 2000") > -1 )
|| (OS.indexOf("windows xp") > -1) ) {
// thanks to JuanFran for the xp fix!
p = r.exec( "cmd.exe /c set" );
else {
// our last hope, we assume Unix (thanks to H. Ware for the fix)
p = r.exec( "env" );
BufferedReader br = new BufferedReader
( new InputStreamReader( p.getInputStream() ) );
String line;
while( (line = br.readLine()) != null ) {
int idx = line.indexOf( '=' );
String key = line.substring( 0, idx );
String value = line.substring( idx+1 );
envVars.setProperty( key, value );
// System.out.println( key + " = " + value );
return envVars;
public static void main(String args[]) {
try {
Properties p = ReadEnv.getEnvVars();
System.out.println("the current value of TEMP is : " +
p.getProperty("TEMP"));
catch (Throwable e) {
e.printStackTrace();
Thanks to W.Rijnders for the W2K fix.
An update from Van Ly :
I found that, on Windows 2003 server, the property value for "os.name" is actually "windows 2003." So either that has to be added to the bunch of tests or just relax the comparison strings a bit: else if ( (OS.indexOf("nt") > -1)
|| (OS.indexOf("windows 2000") > -1 )
|| (OS.indexOf("windows 2003") > -1 ) // works but is quite specific to 2003
|| (OS.indexOf("windows xp") > -1) ) {
else if ( (OS.indexOf("nt") > -1)
|| (OS.indexOf("windows 20") > -1 ) // probably is better since no other OS would return "windows" anyway
|| (OS.indexOf("windows xp") > -1) ) {
I started with "windows 200" but thought "what the hell" and made it "windows 20" to lengthen its longivity. You could push it further and use "windows 2," I suppose. The only thing to watch out for is to not overlap with "windows 9."
On Windows, pre-JDK 1.2 JVM has trouble reading the Output stream directly from the SET command, it never returns. Here 2 ways to bypass this behaviour.
First, instead of calling directly the SET command, we use a BAT file, after the SET command we print a known string. Then, in Java, when we read this known string, we exit from loop. [env.bat]
@set
@echo **end
[java]
if (OS.indexOf("windows") > -1) {
p = r.exec( "env.bat" );
while( (line = br.readLine()) != null ) {
if (line.indexOf("**end")>-1) break;
int idx = line.indexOf( '=' );
String key = line.substring( 0, idx );
String value = line.substring( idx+1 );
hash.put( key, value );
System.out.println( key + " = " + value );
The other solution is to send the result of the SET command to file and then read the file from Java. ...
if (OS.indexOf("windows 9") > -1) {
p = r.exec( "command.com /c set > envvar.txt" );
else if ( (OS.indexOf("nt") > -1)
|| (OS.indexOf("windows 2000") > -1
|| (OS.indexOf("windows xp") > -1) ) {
// thanks to JuanFran for the xp fix!
p = r.exec( "cmd.exe /c set > envvar.txt" );
// then read back the file
Properties p = new Properties();
p.load(new FileInputStream("envvar.txt"));
Thanks to JP Daviau
// UNIX
public Properties getEnvironment() throws java.io.IOException {
Properties env = new Properties();
env.load(Runtime.getRuntime().exec("env").getInputStream());
return env;
Properties env = getEnvironment();
String myEnvVar = env.get("MYENV_VAR");
To read only one variable : // NT version , adaptation for other OS is left as an exercise...
Process p = Runtime.getRuntime().exec("cmd.exe /c echo %MYVAR%");
BufferedReader br = new BufferedReader
( new InputStreamReader( p.getInputStream() ) );
String myvar = br.readLine();
System.out.println(myvar);
Java's System properties contains some useful informations about the environment, for example, the TEMP and PATH environment variables (on Windows). public class ShowSome {
public static void main(String args[]){
System.out.println("TEMP : " + System.getProperty("java.io.tmpdir"));
System.out.println("PATH : " + System.getProperty("java.library.path"));
System.out.println("CLASSPATH : " + System.getProperty("java.class.path"));
System.out.println("SYSTEM DIR : " +
System.getProperty("user.home")); // ex. c:\windows on Win9x system
System.out.println("CURRENT DIR: " + System.getProperty("user.dir"));
Here some tips from H. Ware about the PATH on different OS.
PATH is not quite the same as library path. In unixes, they are completely different---the libraries typically have their own directories. System.out.println("the current value of PATH is: {" +
p.getProperty("PATH")+"}");
System.out.println("LIBPATH: {" +
System.getProperty("java.library.path")+"}");
gives the current value of PATH is:
{/home/hware/bin:/usr/local/bin:/usr/xpg4/bin:/opt/SUNWspro/bin:/usr/ccs/bin:
/usr/ucb:/bin:/usr/bin:/home/hware/linux-bin:/usr/openwin/bin/:/usr/games/:
/usr/local/games:/usr/ccs/lib/:/usr/new:/usr/sbin/:/sbin/:/usr/hosts/:
/usr/openwin/lib:/usr/X11/bin:/usr/bin/X11/:/usr/local/bin/X11:
/usr/bin/pbmplus:/usr/etc/:/usr/dt/bin/:/usr/lib:/usr/lib/lp/postscript:
/usr/lib/nis:/usr/share/bin:/usr/share/bin/X11:
/home/hware/work/cdk/main/cdk/../bin:/home/hware/work/cdk/main/cdk/bin:.}
LIBPATH:
{/usr/lib/j2re1.3/lib/i386:/usr/lib/j2re1.3/lib/i386/native_threads:
/usr/lib/j2re1.3/lib/i386/client:/usr/lib/j2sdk1.3/lib/i386:/usr/lib:/lib}
on my linux workstation. (java added all those execpt /lib and /usr/lib). But these two lines aren't the same on window either:
This system is windows nt the current value of PATH is:
{d:\OrbixWeb3.2\bin;D:\jdk1.3\bin;c:\depot\cdk\main\cdk\bin;c:\depot\
cdk\main\cdk\..\bin;d:\OrbixWeb3.2\bin;D:\Program
Files\IBM\GSK\lib;H:\pvcs65\VM\win32\bin;c:\cygnus
\cygwin-b20\H-i586-cygwin32\bin;d:\cfn\bin;D:\orant\bin;C:\WINNT\system32;C:\WINNT;
C:\Program Files\Dell\OpenManage\Resolution Assistant\Common\bin;
d:\Program Files\Symantec\pcAnywhere;
C:\Program Files\Executive Software\DiskeeperServer\;C:\Program Files\Perforce}
LIBPATH:
{D:\jdk1.3\bin;.;C:\WINNT\System32;C:\WINNT;d:\OrbixWeb3.2\bin;D:\jdk1.3\bin;
c:\depot\cdk\main\cdk\bin;c:\depot\cdk\main\cdk\..\bin;
d:\OrbixWeb3.2\bin;D:\Program Files\IBM\GSK\lib;
H:\pvcs65\VM\win32\bin;c:\cygnus\cygwin-b20\H-i586-cygwin32\bin;d:\cfn\bin;
D:\orant\bin;C:\WINNT\system32;
C:\WINNT;C:\Program Files\Dell\OpenManage\ResolutionAssistant\Common\bin;
d:\Program Files\Symantec\pcAnywhere;
C:\Program Files\Executive Software\DiskeeperServer\;C:\Program Files\Perforce}

Similar Messages

  • How to get an environment variable from OS in class ?

    Hello,
    How to get an environment variable from OS in class ?
    Thanks !

    An example of a Java application that does this is Ant, when you add a line like this in your build.xml:
    <!-- Import environment variables -->
    <property environment="env"/>
    I have looked at the source code of Ant 1.3, especially the file src/main/org/apache/tools/ant/taskdefs/Execute.java. Look at the methods getProcEnvironment() and getProcEnvCommand(). Ant uses an OS-dependent trick to get the environment variables.
    You can download the Ant source code from http://jakarta.apache.org/ant
    Jesper

  • How do you get LOCAL_ADDR environment variable from weblogic?

    How can you access environment variables, such as LOCAL_ADDR? The request object does not expose methods to get at all the environment variables? I need to know which NIC Card the request is coming off of, which the LOCAL_ADDR will tell me.

    Some variables you can?t get this way.
    I made shellscript that just looked like this.
    set > /yourdir/yourfile.txt
    Then in my class I did Runtime.exec(shellxcript);
    then you just read in "/yourdir/yourfile.txt" as Resource and load it in
    a Property object.
    After that you can get variables to.

  • Windows System Environment Variables in "Sql * plus"

    Can i use/reference Windows System Environment variables in "Sql * plus"?
    For example, i want to create sql-script to run in database server computer that asks variable "ORA_HOME" and uses this value to execute some sql/plsql sentences.
    Oracle 10g Personal, Windows 7.
    Edited by: CharlesRoos on 12.11.2010 17:28

    CharlesRoos wrote:
    Business problem:
    I have created 2 databases in my computer. Both databases needs tablespaces created by a script. Tablespaces' datafiles (.dbf files) names are same for both database. Both database has it's own directory where it holds datafiles at the moment. At the moment the datafiles for Database1 are in folder something like "%ORACLE_HOME%"\oradata\%databasename1%\*.dbf, and second database has its datafiles in other folder, somewhere ""%ORACLE_HOME%"\oradata\%databasename1%\*.dbf". I want now the script to create tablespace called "INDX" with same datafile name "indx1.dbf" into both database. So into both mentioned folder the file "indx1.dbf" must be created by script. I think the script should do following:
    1. get ORACLE_HOME.
    2. connect to database "databasename1"
    3. EXECUTE IMMEDIATE "Create TableSpace INDX....file=%ORACLE_HOME% || databasename1 || indx1.dbf"
    4. connect to database "databasename2"
    5. EXECUTE IMMEDIATE "Create TableSpace INDX....file=%ORACLE_HOME% || databasename2 || indx1.dbf"I don't have Oracle database near by anymore, so the code was pseudocode.
    I don't understand how to use ?-shortcut.OK, my first impression is "why does this even NEED to be scripted? Creation of new tablespaces is usually a one-off operation.
    But that aside how about this sqlplus command-line substitution variables. This example is in linux, but will work as well in Windows with the change of the way environment variables are referenced:
    *nix - echo $myvariable
    Windows - echo %myvariable%
    First, the sqlscript to create the TS. Note the use of the substitution variable "&1"
    {code}
    [oracle@vmlnx01 ~]$ cat cat makets.sql
    set echo on feedback on verify on trimsp on
    prompt &1
    CREATE SMALLFILE TABLESPACE EDSTEST
    DATAFILE '/ora01/oradata/&1/edstest.dbf'
    SIZE 5M
    REUSE
    AUTOEXTEND ON
    NEXT 1280K
    MAXSIZE 32767M
    LOGGING
    EXTENT MANAGEMENT LOCAL
    SEGMENT SPACE MANAGEMENT AUTO
    drop tablespace edstest
    including contents and datafiles
    exit
    {code}
    So, at the OS prompt: Notice that the @ is separated by a space, makeing it a command line parm instead of part of the connect string
    {code}
    [oracle@vmlnx01 ~]$ export myparm=vlnxora1
    [oracle@vmlnx01 ~]$ sqlplus system/pswd @makets $myparm
    SQL*Plus: Release 10.2.0.4.0 - Production on Fri Nov 12 13:18:05 2010
    Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    SQL> prompt &1
    vlnxora1
    SQL> --
    SQL> CREATE SMALLFILE TABLESPACE EDSTEST
    2 DATAFILE '/ora01/oradata/&1/edstest.dbf'
    3 SIZE 5M
    4 REUSE
    5 AUTOEXTEND ON
    6 NEXT 1280K
    7 MAXSIZE 32767M
    8 LOGGING
    9 EXTENT MANAGEMENT LOCAL
    10 SEGMENT SPACE MANAGEMENT AUTO
    11 ;
    old 2: DATAFILE '/ora01/oradata/&1/edstest.dbf'
    new 2: DATAFILE '/ora01/oradata/vlnxora1/edstest.dbf'
    Tablespace created.
    SQL> --
    SQL> drop tablespace edstest
    2 including contents and datafiles
    3 ;
    Tablespace dropped.
    SQL> exit
    Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    [oracle@vmlnx01 ~]$
    {code}

  • Reading Operationg System Environment Variables

    How can i read Operating System environment variables for examples in Windows without using java -D option
    just to simply get the value from windows enviroment variables settings... such as "MyApp"
    is there a way i can get the value using java???
    need something that is backward compatible ... like between jdk version 1.2.2 to 1.3.1???
    help...
    :~(
    Thanks in Advance,
    Cheah

    Some ugly hack like using Runtime.getRuntime().exec("echo %wasteoftime%") and examining its output might work.

  • How can I use environment variables in a controller?

    Hi all,
    How can I use environment variables in a controller?
    I want to pass a fully qualified directory and file name to FileInputStream and would like to do it by resolving an env variable, such as $APPLTMP.
    Is there a method somewhere that would resolve this??
    By the way,Did anyone used the class of "oracle.apps.fnd.cp.request.RemoteFile"?
    The following is the code.
    My EBS server is installed with 2 nodes(one for current,and other is for application and DB).I want to copy the current server's file to the application server's $APPLTMP directory. But the result of "mCtx.getEnvStore().getEnv("APPLTMP")" is current server's $APPLTMP directory.
    Can anyone help me on this?
    private String getURL()
    throws IOException
    File locC = null;
    File remC = new File(mPath);
    String lurl = null;
    CpUtil lUtil = new CpUtil();
    String exten;
    Connection lConn = mCtx.getJDBCConnection();
    ErrorStack lES = mCtx.getErrorStack();
    LogFile lLF = mCtx.getLogFile();
    String gwyuid = mCtx.getEnvStore().getEnv("GWYUID");
    String tmpDir = mCtx.getEnvStore().getEnv("APPLTMP");
    String twoTask = mCtx.getEnvStore().getEnv("TWO_TASK");
    // create temp file
    mLPath = lUtil.createTempFile("OF", exten, tmpDir);
    lUtil.logTempFile(mLPath, mLNode, mCtx);
    Thanks,
    binghao

    However within OAF on the application it doesn't.
    what doesnt work, do you get errors or nothing ?XX_TOP is defined in adovars.env only. Anywhere else this has to go?
    No, it is read from the adovars.env file only.Thanks
    Tapash

  • How to use windows environment variable "%appdata%" in TEXT_IO built-in

    Hello Sir/Madam,
    I'm currently using TEXT_IO built-in package to write data file user's "C" drive in Oracle Forms 6i on Windows XP OS. We are in the process of upgrading the OS to Windows7. This new version does not allow to write to "C" or "D" drive. I was wondering how I can use windows environment variable "%appdata%" in this built-in to write the data file to user's AppData folder?
    I would appreciate your help.
    Regards,
    Vani Sonti

    You are obviously not familiar with the architecture of webforms. See here http://www.oracle.com/technetwork/developer-tools/forms/275632-133265.pdf
    I guess you are running your forms locally, so the forms server and the client run on the very same machine. This won't be the case once you run in production, as you will have an application server and clients connecting to the server.
    text_io, tool_env and all the forms built ins will be executed on the machine the forms runtime runs on, and in a 3 tier architecture this is the application server, not the client as the real client will run just a java applet which actually just does what the forms runtime on the server tells it to do (or passes client side events like mouse clicks to the forms runtime on the server).
    A very simple explanation for the architecture would be that the whole GUI part has been ripped off the forms runtime and put into a java applet; the logic part (the old-fashioned forms runtime) where the whole Forms PL/SQL code is executed communicates with the GUI part (which is implemented as a java applet) via HTTP, so there is no need to have both running on the very same machine.
    So if you are writing a file with text_io on c:\dummy.txt this file will be generated on the application server machine as it is executed where the forms runtime runs. If you read environment variables with tool_env.getvar you will get the environment variable from the application server machine.
    If you need those variables from your application server then those built-in packages are what you need, but if you need the real client variables there is no way around java in webforms 6i. But the beans should be simple enough to have them written within no time ;)
    cheers

  • Referencing a system environment variable

    Hi all,
    I am attempting to reference a system environment variable in an OS command within a package. However, it continues to error out with the generic "Wrong process return code" error. For now, I am assuming this is due to my reference to a system variable in the file path.
    Note: when I'm directly on the ODI server and type in the exact same command into a command window, it works fine. It doesn't work when I call it from the generated scenario, via the Operator client on my computer.
    Here is an example of my call line:
    essmsh.exe %SysVarName%\somefile.mxl
    Does anyone know how to reference the system environment variable correctly? Or...is there a better way to accomplish the same task?
    Thanks!
    -OS

    Thank you for your response, Ankit!
    Yes, essmsh.exe must be visible to the agent, because if I replace the reference to the system variables with hard-coded values, the scenario executes with no error.
    I am not familiar with Jython procedures, and I am hesitant to create any as the there is no one on the team who can support them. Is there no direct reference one can use directly from the package/scenario? It seems odd that there is no current way to handle this, but perhaps I am naive.

  • How can I pass environment variables to the child process?

    How can I pass environment variables to the child process? This is what I tried and it didn't work.
         static public void main (String[] args) throws Exception {
              ProcessBuilder b = new ProcessBuilder("java", "-cp", ".", "Child");
              Map<String, String> map = b.environment();
              map.put("custom.property", "my value");
                 b.redirectErrorStream(true);
              Process p = b.start();
              BufferedReader reader = new BufferedReader (new InputStreamReader(p.getInputStream()));
              String line = null;
              while (null != (line = reader.readLine())) {
                   System.out.println(line);
         public static void main(String[] args) {
              System.out.println("The value of custom.property is : " + System.getProperty("custom.property"));
         }and the result is:
    The value of custom.property is : null

    Complete test:
         static public void main (String[] args) throws Exception {
              ProcessBuilder b = new ProcessBuilder("java", "-Dcustom.property=my property value", "-cp", ".", "Child");
              Map<String, String> map = b.environment();
              map.put("custom.property", "my environment value");
                 b.redirectErrorStream(true);
              Process p = b.start();
              BufferedReader reader = new BufferedReader (new InputStreamReader(p.getInputStream()));
              String line = null;
              while (null != (line = reader.readLine())) {
                   System.out.println(line);
         public static void main(String[] args) {
              System.out.println("Property value of custom.property is : " + System.getProperty("custom.property"));
              System.out.println("Environment value of custom.property is : " + System.getenv("custom.property"));          
         }

  • Unable to access value in System Environment Variable using Java

    I am using Java code to get the value of a System Environment Variable using the Runtime, Process java classes.
    The code works fine in tomcat, but when deployed in 9ias the code is unable to retrieve the value stored in the System environment variable in Windows 2000.

    Thanks for the comment steve, here is the code which i am using.
         public String getEnvironmentVariable()
                   // This will get the FEDREP_HOME environment variable
                   String FEDREP_HOME = null;
                   Process p = null;
                   Runtime rt = Runtime.getRuntime();
                        try {
                             // invokes a shell-command to retrieve FEDREP_HOME variable
                             String OS = System.getProperty("os.name").toLowerCase();
                                  // Get the Windows 95 environment variable
                                  if (OS.indexOf("windows 9") > -1)
                                            p = rt.exec( "command.com /c echo %FEDREP_HOME%" );
                                  // Get the Windows NT environment variable
                                  else if (OS.indexOf("nt") > -1)
                                            p = rt.exec( "cmd.exe /c echo %FEDREP_HOME%" );
                                  // Get the Windows 2000 environment variable
                                  else if (OS.indexOf("2000") > -1)
                                            p = rt.exec( "cmd.exe /c echo %FEDREP_HOME%" );
                                  // Get the Windows XP environment variable
                                  else if (OS.indexOf("xp") > -1)
                                            p = rt.exec( "cmd.exe /c echo %FEDREP_HOME%" );
                                  // Get the unix environment variable
                                  else if (OS.indexOf("linux") > -1)
                                            p = rt.exec( "sh -c echo $FEDREP_HOME" );
                                  // Get the unix environment variable
                                  else if (OS.indexOf("unix") > -1)
                                            p = rt.exec( "sh -c echo $FEDREP_HOME" );
                                  // Get the unix environment variable
                                  else if (OS.indexOf("sunos") > -1)
                                            p = rt.exec( "sh -c echo $FEDREP_HOME" );
                                  } else
                                            System.out.println("OS not known: " + OS);
                             // set up to read subprogram output
                             InputStream is = p.getInputStream();
                             InputStreamReader isr = new InputStreamReader(is);
                             BufferedReader br = new BufferedReader(isr);
                             // read output from subprogram
                             FEDREP_HOME = br.readLine();
                             br.close();
                        } catch(Exception ex)
                                  System.out.println("Error when getting FEDREP_HOME environment variable");
                                  ex.printStackTrace();
              return(FEDREP_HOME);

  • Is there any way to get windows environment variables like %USERNAME% with javascript?

    is there any way to get windows environment variables like %USERNAME% with javascript using Adobe 10 pro?

    There is a fair amount of Acrobat JavaScript and Acrobat knowledge need to sort all of this out.
    The identity object holds a lot of sedative information. First, upon installation of Acrobat, only the login name is available in the identity object and the end user of the application needs to complete the "Name", "email" and "Organization Name" in the application's preferences. These are the only fields that are available to Acrobat JavaScript identity object as corporation, email, loginName, and name.
    Using the instructions in The Acrobat JavaScript Console (Your best friend for developing Acrobat JavaScript) you can run the following script in the JS console to see the items of the identity object:
    for(i in identity) {
    console.println(i +": " + identity[i]);
    and the following will appear in the console:
    loginName: georgeK
    name: George Kaiser
    corporation: Example
    email: [email protected]
    true
    The documentation states you need to use a trusted function to access this data, but you can access it at startup of Acrobat/Reader and add the properties of the identity object to an array:
    // application variable to hold the properties of the identity object
    var MyIdentity = new Array();
    // loop through the properties of the identity object
    for (i in identity) {
    // place each property of the identity object into an element of the same name in the Identity array
    MyIdentity[i] = identity[i];
    console.println(i +": " + MyIdentity[i])
    You access the items with:
    var loginUser = MyIdentity[loginName];  // get the loginName property
    In the user application level JavaScript file. See Acrobat Help / User JavaScript Changes for 10.1.1 (Acrobat | Reader) for the location of the application level folder you need to use.
    I would change the name of the array used in this post so an untrusted user cannot get to your data. Some of this data can be used in hacking into a user's system.

  • Which Oracle folders into "PATH" system Environment Variable

    Which Oracle folders must exist into "PATH" system Environment Variable in Windows OS?
    The folders must contain Oracle command line utilities, like "sql * plus", "exp" and so on.

    The path to your bin folder ...
    for eg :
    D:\oracle\product\10.2.0\db_1\bin;Cheers :)
    Renjith Madhavan

  • How to get System status Check Boxes into Query selection screen

    Dear experts,
    Pleas help in knowing how to get System status Check Boxes into quick view query (SQVI), selectionscreen.
    Regards
    Jogeswara Rao
    Edited by: K Jogeswara Rao on Jul 6, 2010 7:26 PM

    Problem solved through other Forum
    (Checkboxes not possible, some alternative solution to my requirement found)

  • How to get system idle time

    Hello Sir,
    I am Udhaya. I don't know how to capture system idle time using java. Please any one help me how to get system idle time. Any class is available in java to get idle time?
    Thank in advance
    Udhaya

    jwenting wrote:
    DrLaszloJamf wrote:
    jwenting wrote:
    the moment you ask the system for its idle time that idle time becomes 0, so just returning a constant value of 0 would always yield the correct answer.But when you don't call this constant method the value it would return is wrong. This is the sort of thing that keeps me up at night.Except of course that when you don't call it it doesn't return it and therefore still behaves properly.
    Or were you thinking of philosphical problems like "what does a method do when it's not called?"?Actually I was trying to see if I could get the OP to say boo to a goose.

  • How to get system temp dir. path on the fly ,system may be XP or Linux ??

    How to get system temp dir. path on the fly ,system may be XP or Linux ??
    please suggest solution

    The default temporary-file directory can be retrieved
    using:
    System.getProperty("java.io.tmpdir")
    Thanks a lot for u r reply this one works !!!!

Maybe you are looking for