Is it possible to know the %TEMP% environment variable from my program?

I would like to know if my program want to save a file to the temp storage on my PC, how can I know the %TEMP% environment variable in Windows in my program?

You could pass in the %TEMP% as a system variable at startup. java -cp . -Dwhateveryouwanttocallit=/tmp.
Here's my guess as to what the .bat file might contain. I assume you are running on Windows(TM).
java -cp . -Dwhateveryouwanttocallit=%TEMP%
You could use a batch script to populate the variable and then start up your program. Then you could access the variable by using an extremely rude class called System. You can use System.getProperty("whateveryouwanttocallit") to retrieve the value.

Similar Messages

  • Setting windows environment variables from Java program

    Is there any way to set environment variables from Java program in Windows? Any help is appreciated.
    Here is my situation:
    I need to decrypt an encrypted Oracle user password in a batch file which will be used while running a sql script with sqlplus. I was planning to have bat file which will call a Java program decrypt the password and set it as an env variable in windows which will be available while calling sqlplus.
    thanks

    Runtime.exec has a lot of overloadings. Two of them
    allows you to specify the environment variables.
    exec
    public Process exec(String[] cmdarray,
    String[] envp,
    File dir)
    throws IOExceptionExecutes the specified command and
    arguments in a separate process with the specified
    environment and working directory.
    cmdarray - array containing the command to call and
    its arguments.
    envp - array of strings, each element of which has
    environment variable settings in format name=value.
    dir - the working directory of the subprocess, or null
    if the subprocess should inherit the working directory
    of the current process.
    I had this sample program:
    public class SetVarExample {
    public static void main (String[] args) throws Exception {
         String[] cmd_env= new String[] {"password="+"ABCD","Path=C:\\Sun\\AppServer\\jdk\\bin"};
         String cmd = "cmd /c SET ";
         Runtime.getRuntime().exec(cmd,cmd_env);
    System.out.println( "Finish ...." );
    I tried it in a command prompt. But looks like when the program exits, it's a whole new process and so it does not retain the env variables set in the java program.
    Any suggestions? Am I doing it worng?
    thanks

  • How to know the spool requests generated from my program?

    hi
         I want to get the spool request(s) that are generated from my report that's run either in foreground or background? how to know this? i know that we can go to sm37 and see, but is there any table or fm which stores this data? if i give my program name that's run on a particular date, i should get the spool request numbers. tsp01 only has the spool no. and not the program name..pl suggest...thanks all
    Sathish. R

    Hi ,
    The system field sy-spono contains the spool numbers .
    If you have such requirement, you can create one custom table with fields :
    spool no, program , date , time
    whenever you run ur program update this table ,
    with system fields . spono , sy-repid , sy-datum and sy-uzeit .
    Thaks .

  • Is it possible to run the Classic Environment INSIDE Rosetta on a MacBook Pro (Early 2008) with Leopard?

    Hi there,
    Rosetta works up until Snow Leopard. The Classic Environment works up until a late version of Tiger. Rosetta makes apps. built for PowerPC Macs work. The Classic Environment make apps. for Mac OS 9 work on Mac OS X for PowerPC Macs.
    Would it consequently be possible to run the Classic Environment INSIDE Rosetta?
    I have read https://discussions.apple.com/docs/DOC-2292, but I am still unconvinced unless there is a flaw to my logic. At any rate, I subscribe to the Churchillian adage of never giving in unless the forces of common sense and doctrine dictate otherwise.
    If it won't work, then why?
    Best Regards,
    Stefan

    Hi there, Klaus1, BDAqua and a brody,
    Thank you ever so much for your kind replies! (I tried giving you the 10 pts. of 'Correct Answers' to each of you, but unfortunately it was only possible for Klaus1, so the points were distributed between him and BDAqua even though you were all helpful!)
    My next question will naturally be: Is SheepShaver legal? My Google search didn't yield any conslusive proof that it was, nor any that it wasn't, but as the E-Maculation web page seemed quite official and above board I would assume that it is.
    The next logical step would be to ask whether it's safe for both HW and SW to run SheepShaver. HW, it appears, is very rarely, if ever, affected by SW settings, so I would assume that hardwarewise, I'm good to go. Could it ruin the kernel of Mac OS X's Unix-based operating system?
    Kind Regards,
    Stefan

  • Possible to know the URL of page while within the working iWeb on desktop?

    Is it possible to know the URL of any page in a website by looking at the working iWeb copy on the desktop? I made my website over a year ago and used iWeb '06 and cannot remember that far back. Now I am using iWeb '08. I keep getting SORRY messages when I hit the VISIT button.
    This is making me nervous.
    Lorna

    See this topic...
    http://discussions.apple.com/thread.jspa?threadID=1215442&tstart=0

  • Please help apps. Crashing on 64 gb 4 gen touch. Run 5.0.1 I know the temp fix of logging in but want to fix report shows "low mmemory crash" which is not true

    Please help apps. Crashing on 64 gb 4 gen touch. Run 5.0.1 I know the temp fix of logging in but want to fix report shows "low mmemory crash" which is not true

    Why do you say "not true"? The 4G iPod only has 256 MB of memory and out of memoty errors are not uncommon with iOS 5.
    memory is different that the 8, 32 ir 64 GB or storage on the 4G iPods.
    To resolve double click the Home button and delete the apps from the mulitasking dock that you are not using and the power off and back on the iPod. You have to do that periodically.

  • Is it possible to know the size of EEPROM that available through Applet?

    Hi Friends..
    I want to know is it possible to know the available EEPROM size through Applet..
    I mean i want to create an Applet that checks the size of EEPROM that still available..
    Thanks in advance

    http://www.cs.ru.nl/~woj/javacardapi221/javacard/framework/JCSystem.html#getAvailableMemory%28byte%29
    but no more than 32K are reported.
    regards
    sebastien

  • The NLS_LANG environment variable for Form Builder 10g on Linux

    Hi,
    I have installed Oracle Developer Suite 10g on Linux Enterprise AS4 successfully,and set environment variable NLS_LANG="SIMPLIFIED CHINESE_CHINA.ZHS16GBK",LANG="zh_CN.UTF-8".When i executed the following: /home/oracle/Orant/bin/frmbld
    I got the error as:
    X Error of failed request:BadFont(invalid Fond parameter)
    Major opcode of failed request:56(X_ChangeGC)
    Resource id in failed request:Ox2c000af
    Serial number of failed request:3376
    Current serial number in output stream 3517
    FRM-18122: ’Form Builder Debugger.
    If i delete the NLS_LANG environment variable,the Form Builder can be running,but i can't keyboard input[b] chinese characters in the PL/SQL Editor.
    I don't know how to solve the problem,anybody can help me?

    Hello Howard,
    Check out the following link here you can find your desired NLS parameters.
    http://www.oracle.com/technology/tech/globalization/htdocs/nls_lang%20faq.htm
    And about the NLS_LANG for developer why you want to create for developer. Its is already there in REGISTRY. Just seaching in developer registry you can find there.
    how do I set more than 1 at a time.
    You can set only one NLS_LANG parameter at a time.
    -Ammad
    Edited by: Ammad Ahmed on Apr 15, 2010 8:52 PM

  • Is it possible to delete the boot/startup volume from Terminal

    Is it possible to delete the boot/startup volume from Terminal?
    What sort of command would/could allow this?

    Is it possible to delete the boot/startup volume from Terminal?
    Do you mean is it possible to destroy your system from the Terminal? Anyone that has spend long enough working with Unix from a command line knows that answer. Yes! And a painful lesson it has been for many of us.
    The real question is, what is your goal?
    If you just want to erase lots of files, then the 'rm' command is available. Once all the files are erased, the rm command will be one of them, and so that is the end of the game. You will not be able to execute any more commands. The file system is still there, and the data in all those files is still on the disk, you have just eliminated the easy way to access that data (via file names).
    If you want to initialize a new file system on the disk, you could most likely do that (diskutil - it will be the last command you run from the terminal, but you could most likely do it). Again, the data is still there, but the file system structure that held all the names and allocation information has been eliminated.
    If you want to securely erase the disk, that is also possible (diskutil), and again, that will be the last command you will run from the terminal. Now nothing is left behind, neither data nor file system structure.
    What sort of command would/could allow this?
    rm and diskutil come to mind (in combination with sudo).
    You could also just boot from the installation DVD, and then from the Menu select the Disk Utility and erase the disk as well as give it a new file system. And since you are running from the OS stored on the DVD, you can do other things after the Disk Utility is finished.

  • Is it possible to disable the Force closur button from QE11?

    Hi
    Is it possible to disable the Force closur button from QE11 transaction code level?
    Thanks and Regards
    GVD

    Hello Chanti,
    Disabling the force closure button is not possible by creating a security role as security restrictions work on organizational elements like co codes, plant, s loc etc.
    Could you please let me know if the requirement is for all users or few users.
    Also you may want to try the transaction variant/ Screen variant option. The force button is available in program SAPLQEEM and Function ABFO which you need to tick the inactive button during recording. Take help from ABAP if required.
    Thanks
    Sahil

  • Is it possible to call the Print Quote functionality from Custom ADF page

    Hi,
    We are researching if it is possible to call the Print Quote functionality from the Custom ADF application.
    Goal is to pop up the PDF report upon clicking the Print Quote button on the custom page. Is it possible ?
    Atleast advice on the direction to go forward is appreciated.
    Thanks
    Sai

    Hi ,
    Please check following thread on forum -
    Re: ADF: Calling OAF Page from ADF page
    Check this may also be useful-
    https://blogs.oracle.com/shay/entry/to_adf_or_oaf_or
    I have not tried yet but Steven Chan (Sr. Director OATG) suggest following methodolgy for this-
    https://blogs.oracle.com/stevenChan/entry/appsdatasource_jaas_ebs
    Thanks,
    Ashish

  • How to load a class , which isn't in the classpath environment variable.

    Hi, you folks.
    I have one problem. I want to load a class, which isn't in the classpath
    environment variable and I don't want to put into classpath. which method
    JVM can use to load it?
    Waitting for your sage advice.
    Regareds
    Hunter.Xiao

    You will have to write your own ClassLoader, or use something like URLClassLoader (I've never used this myself, but I've seen it mentioned elsewhere in this forum). Look here.

  • Is it possible to get the value of variable through answers page ?

    Hi all,
    I had Dynamic variable ETLRundate . I want use this variable in Answers page to see the out put ?
    Is it possible to get the value of variable through answers page ?if so how I can use ?

    Hi
    Use the link below and download the documentation
    http://www.oracle.com/technology/documentation/bi_ee.html
    I think you will find what you are looking for in the Answers, Delivers, and Interactive Dashboards User Guide, but in short the syntax to display a variable value is as follows:
    As shown above the syntax for using a presentation variable is:
    @{variablename}{defaultvalue}
    For Session variables use:
    @{biServer.variables['NQ_SESSION.variablename']}
    For repository variables use:
    @{biServer.variables['variablename']}
    Rgds
    Ed

  • WPF: How to know the selection is come from datagrid or from ListBox?

    Our application has a page which includes DataGrid and ListBox.
    Both ItemSource are binding to PlateCells.
    public ObservableCollection<CellVM> PlateCells
    public class CellVM : BaseViewModel
    public CellVM(int wellNumber)
    WellNumber = wellNumber;
    Row = wellNumber / define.NumberofWellsInRow;
    Col = wellNumber % define.NumberofWellsInRow;
    // row and col are 0-based
    public int WellNumber { get; set; }
    public int Row { get; set; }
    public int Col { get; set; }
    bool _isSelected;
    public bool IsSelected
    get { return _isSelected; }
    set
    _isSelected = value;
    OnPropertyChanged("IsSelected");
    string _sampleId;
    public string SampleId
    { get { return _sampleId; }
    set
    _sampleId = value;
    OnPropertyChanged("SampleId");
    when a cell is selected, the cell will be highlight in both DataGrid and ListBox.
    We also implement SelectAll button for both DataGrid and ListBox.
    And SelectAll is ToggleButton. First time click is select All cells and second time click, it will unselect All cells.
    What we notice when SelectAll button is click, all cells in both DataGrid and List box  are highlight.
    After that click on a grid any cell, all cells becomes unselected in both DataGrid and ListBox.
     We assume this the behavior from DataGrid, after click SelectAll and click any cell in DataGrid will remove all selection and only highlight one cell in the datagrid.
    However, this is behavior does not happen in ListBox. click any cell in ListBox only unselect that cell and not unselect all cells.
    So we need to know click(selection) is coming from DataGrid or ListBox and take different actions.
    How do we know the click is coming from DataGrid or ListBox? Thx!
    JaneC

    >>How do we know the click is coming from DataGrid or ListBox? Thx!
    It depends on where in the code you want to be able to determine this. In the view model class you cannot really know if the user clicked in the ListBox or in the DataGrid because the view model knows nothing (and shouldn't know either) about any of these
    controls. It only exposes a property that may be set from anywhere.
    Handling the GotFocus event for any or each of the controls seems to be a good solution because then you can take the appropriate action depending on which control was focused/clicked.
    You could of course move the code that is being executed when the GotFocus event occurs, i.e. the code in your event handler, from the code-behind of the view to the view model class by using a command in the view model class and then hook up the GotFocus
    event to this command using event triggers:
    <DataGrid>
    <i:Interaction.Triggers>
    <i:EventTrigger EventName="GotFocus" >
    <i:InvokeCommandAction Command="{Binding YourCommand}" />
    </i:EventTrigger>
    </i:Interaction.Triggers>
    </DataGrid>
    How to do this is a topic of its own though. Please refer to my blog post about how to handle events in MVVM for more information:
    http://blog.magnusmontin.net/2013/06/30/handling-events-in-an-mvvm-wpf-application/. You will need to reference an assembly that is part of the Expression Blend SDK which you can download from here:
    http://www.microsoft.com/en-us/download/details.aspx?id=10801.
    Anyway, as mentioned, handling the GotFocus event seems like a good idea here since you cannot determine which control that was clicked in the setter of the source property in the view model class.
    Hope that helps.
    Please remember to close your threads by marking helpful posts as answer and please start a new thread if you have a new question.

  • Is it possible to use the microphone dictation in windows based program?

    Is it possible to use the microphone dictation in windows based program? I have tried dictating into Pages and copying and pasting, but the Windows based (Allscripts EHR) recognizes only the first attempt to copy and paste. Any future copying results on the first pasted dictation to show up in the Allscripts EHR.

    Hi,
    >>>configuration instead of coding etc
    currenly it is not possible to achive it without any coding
    >>>repeat messages with RSNAST00
    RSNAST00 is not used to repeat messages (idocs) but to send them
    try using standard IDOC in your sd invoice scenario
    if you don't want to do any coding
    Regards,
    michal

Maybe you are looking for

  • 2 user accounts on iMac, want to share one iTunes library between the 2

    I saw some old discussions on this topic from 2006. But I wanted to ask users of the current versions of iTunes and Lion, how they are acomplishing this. We want to share the same music libray between 2 user accounts. Just think of it as an old schoo

  • Creating a user in Active Direcory

    Hi, Here is the scenario. I am loading accounts into IdM through flatfile, after loading accounts into IdM, through actvesync I am trying to push any updated or new accounts into Active Directory. but I am unable to create account in AD, strangely I

  • Number range transport problem in Internal orders

    Hi, I created new internal order type in KOT2_OPA t. code and at the time of saving it is asking number range. so i assigned one number range interval to the order type and saved the application in development server and noted down the request number

  • Inbound IDOC:First record is not an IDoc control record

    Dear Experts, I am currently testing an inbound IDOC with program RSEINB00. Unfortunatelly I always get the errror "First record is not an IDoc control record (please check file)". So apparently it picks up the file, but there are some format errors

  • Filter data in prompts

    Hello experts!!! One very interesting requirement. I have all the reports in dashboard ready with parameters (prompts) but the issue is whenever user wants to set the prompt, he clicks on the prompt option--> (which opens the prompt) then there is ma