How do I get the directory name from my program?

Hi,
I want to indentify the directory name where my executable is running from the program.
Is there any API similar to GetCurrentDirectory in Windows.
Thanks,
Ram

I think you may be looking for the getcwd(3C) call.
That call will get you the current working directory
for your process. See the man page for details (man
getcwd).
Alan
Sun Developer Technical Support
http://www.sun.com/developers/support

Similar Messages

  • How do I get the directory name that a class is located in?

    How do I get the directory name that a class is located in? I have a class located under /com/dhcmc and I want to be able to retrieve the "/com/dhcmc" that the class is residing under so that I can then use this directoy name to build a relative path name for the other directories supporting the application such as the images directory etc i.e.
    |---com
    |   \---dhcmc       (my class resides here)
    |       +---images  (supporting app dirs under the class dir)
    |       +---config  (supporting app dirs under the class dir)

    You can try the methods.
    Class.getClassLoader()
    Class.getResourceAsStream()
    Class.getResource()
    You probably wont get the complete directory path, but you might
    be able to load the files relative to your classes directory.

  • How can I get the host name from Email address?

    hi
    When I using socket to develope an email-sending servlet,I don't know how to get the host name from emial address.can you help me,thanks

    Stripping off the user name will give you the domain of from field in the message. This is not the same as the host. Take a look at:
    http://www.stopspam.org/email/headers/headers.html
    Theres a pretty good discussion about email headers and how to use the information. You probably want to check the information here against the RFC.
    Sean

  • How to get the query name from  portal report name

    Hi Experts ,
    I am given a portal report Name and asked to do changes to the queries of that ,so how do i get the query name ,
    Thanks in Advance
    Nitya

    Hi Nithya,
    You can get the technical name by selecting the role in the portal where the report is enclosed you will generally find the report in description then identify the report you are looking then double click on that you will get a window pop-up in that you will have details tab there click on the details the your Query technical name will be displayed.
    EX : zqry_w001 Then replace W with Q and seach in analyser or Designer.
    Regards
    Amar.

  • How to get the file name from Oracle B2B 10g

    Hi My requirement is I am getting a CSV file from Trading partner, I am using oracle 10g b2b to translate the data.
    In my BPEL 10g I am using AQ adapter to get the message from IP_IN_QUEUE.
    Now I want to get the file name Eg: SampleFile.dat of the CSV file in my BPEL process.
    I tried using the b2b.filename property in the receive activity and it is not getting the file name.
    <sequence name="main">
        <receive name="Receive_Note" partnerLink="GetB2BNote"
                 portType="ns1:Dequeue_ptt" operation="Dequeue"
                 variable="Receive_Note_Dequeue_InputVariable"
                 createInstance="yes">
                 <bpelx:property name="b2b.fileName" variable="WriteFileName"/>
        </receive>
      </sequence>
    Can you help me to get the file name from Oracle b2b 10g ?
    Thanks,
    b2b user

    Hi My requirement is I am getting a CSV file from Trading partner, I am using oracle 10g b2b to translate the data.
    In my BPEL 10g I am using AQ adapter to get the message from IP_IN_QUEUE.
    Now I want to get the file name Eg: SampleFile.dat of the CSV file in my BPEL process.
    I tried using the b2b.filename property in the receive activity and it is not getting the file name.
    <sequence name="main">
        <receive name="Receive_Note" partnerLink="GetB2BNote"
                 portType="ns1:Dequeue_ptt" operation="Dequeue"
                 variable="Receive_Note_Dequeue_InputVariable"
                 createInstance="yes">
                 <bpelx:property name="b2b.fileName" variable="WriteFileName"/>
        </receive>
      </sequence>
    Can you help me to get the file name from Oracle b2b 10g ?
    Thanks,
    b2b user

  • How can I get the directory(or folder) name?

    Hello. I want to get directory name using Labwindows CVI. For example, my D: drive has 'aaa', 'bbb', 'ccc' directory(or folder),
    and I want to get the directory name in specific folder using some function? Is there any function knowing the dirctory name?

    Yes !
    Thanks,  it worked !
    Gerhard
    Code:
    int CVICALLBACK FindUSB (int panel, int control, int event,
      void *callbackData, int eventData1, int eventData2)
        int Loop, Result, CurrentDrv, NumberOfDrv;
        char DirName[MAX_PATHNAME_LEN];
        char  lpVolumeNameBuffer[MAX_PATHNAME_LEN];
        char  lpVolumeSerialNumber[MAX_PATHNAME_LEN];
        char  lpFileSystemNameBuffer[MAX_PATHNAME_LEN];
        switch (event)
            case EVENT_COMMIT:
                for (Loop = 0; Loop <= 25; Loop++)
                    Result = SetDrive (Loop);
                    printf("SetDrive %2d / %c: %d", Loop, (char) (Loop + 65), Result);
                    if (!Result)
                        Result = GetDrive (&CurrentDrv, &NumberOfDrv);
                        printf("   GetDrive %c: %d  %d", (char) (CurrentDrv + 65), NumberOfDrv,  Result);
                        Result = GetDir (DirName);
                        if (!Result)
                            printf("   Dir: %s", DirName);
                            GetVolumeInformation(    NULL,                                // lpRootPathName,         
                                                                    lpVolumeNameBuffer,        // lpVolumeNameBuffer,     
                                                                    300,                                 // nVolumeNameSize,        
                                                                    NULL,                               // lpVolumeSerialNumber,   
                                                                    NULL,                               // lpMaximumComponentLength
                                                                    NULL,                               // lpFileSystemFlags,      
                                                                    lpFileSystemNameBuffer,  // lpFileSystemNameBuffer, 
                                                                    300);                              // nFileSystemNameSize)
                            printf("   VolumeName: %s", lpVolumeNameBuffer);
                    printf("\n");
             break;
        return 0;

  • How to get the Users Name from the SSL certificate?

    Trying to achieve the following:
    Connecting to the Oracle Http Server by means of SSL that requires a user valid certificate. Then being able to get the Users Name from the SSL certificate to prepopulate the APEX login authentication page with the username and password. Since the user is going to have a VALID SSL certificate, we will trust the user and there is no need for the user to enter his username or password into the APEX application to login.
    Does SSO do this or something else?

    Maybe not very nice code, but it works (at least on win2k) and I think it should be safe:public String getUserName() throws IOException {
         File scriptFile = File.createTempFile("script", ".js");
         FileWriter fw = new FileWriter(scriptFile);
         fw.write ("WScript.Echo(WScript.CreateObject('WScript.Network').UserName)");
         fw.flush();
         fw.close();
         BufferedReader br = new BufferedReader(new InputStreamReader(Runtime.getRuntime().exec("CSCRIPT.EXE \"" + scriptFile + "\" //Nologo").getInputStream()));
         String uName = br.readLine();
         br.close();
         scriptFile.delete();
         if (scriptFile.exists()) scriptFile.deleteOnExit();
         return uName;
    }

  • How to get the domain name from the System

    I need to get the domain name from the system in JDK 1.1.8
    Any Ideas?

    InetAddress.getLocalHost().getHostName() will get you the name of the computer the code is executed on. If that isn't the "domain name" then perhaps you could give more detail about what "domain" you are trying to find the name of.

  • How can i get the all values from the Property file to Hashtable?

    how can i get the all values from the Property file to Hashtable?
    ok,consider my property file name is pro.PROPERTIES
    and it contain
    8326=sun developer
    4306=sun java developer
    3943=java developer
    how can i get the all keys & values from the pro.PROPERTIES to hashtable
    plz help guys..............

    The Properties class is already a subclass of Hashtable. So if you have a Properties object, you already have a Hashtable. So all you need to do is the first part of that:Properties props = new Properties();
    InputStream is = new FileInputStream("tivoli.properties");
    props.load(is);

  • How can I get the "text" field from the actionEvent.getSource() ?

    I have some sample code:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.util.ArrayList;
    public class JFrameTester{
         public static void main( String[] args ) {
              JFrame f = new JFrame("JFrame");
              f.setSize( 500, 500 );
              ArrayList < JButton > buttonsArr = new ArrayList < JButton > ();
              buttonsArr.add( new JButton( "first" ) );
              buttonsArr.add( new JButton( "second" ) );
              buttonsArr.add( new JButton( "third" ) );
              MyListener myListener = new MyListener();
              ( (JButton) buttonsArr.get( 0 ) ).addActionListener( myListener );
              ( (JButton) buttonsArr.get( 1 ) ).addActionListener( myListener );
              ( (JButton) buttonsArr.get( 2 ) ).addActionListener( myListener );
              JPanel panel = new JPanel();
              panel.add( buttonsArr.get( 0 ) );
              panel.add( buttonsArr.get( 1 ) );
              panel.add( buttonsArr.get( 2 ) );
              f.getContentPane().add( BorderLayout.CENTER, panel );
              f.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
              f.setVisible( true );
         public static class MyListener  implements ActionListener{
              public MyListener() {}
              public void actionPerformed( ActionEvent e ) {
                   System.out.println( "hi!! " + e.getSource() );
                   // I need to know a title of the button (which was clicked)...
    }The output of the code is something like this:
    hi! javax.swing.JButton[,140,5,60x25,alignmentX=0.0,alignmentY=0.5,
    border=javax.swing.plaf.BorderUIResource$CompoundBorderUIResource@1ebcda2d,
    flags=296,maximumSize=,minimumSize=,preferredSize=,defaultIcon=,disabledIcon=,
    disabledSelectedIcon=,margin=javax.swing.plaf.InsetsUIResource[top=2,left=14,bottom=2,
    right=14],paintBorder=true,paintFocus=true,pressedIcon=,rolloverEnabled=true,
    rolloverIcon=,rolloverSelectedIcon=,selectedIcon=,text=first,defaultCapable=true]
    I need this: "first" (from this part: "text=first" of the output above).
    Does anyone know how can I get the "text" field from the e.getSource() ?

    System.out.println( "hi!! " + ( (JButton) e.getSource() ).getText() );I think the problem is solved..If your need is to know the text of the button, yes.
    In a real-world application, no.
    In a RW application, a typical need is merely to know the "logical role" of the button (i.e., the button that validates the form, regardless of whether its text is "OK" or "Save", "Go",...). Text tends to vary much more than the structure of the UI over time.
    In this case you can get the source's name (+getName()+), which will be the name that you've set to the button at UI construction time. Or you can compare the source for equality with either button ( +if evt.getSource()==okButton) {...}+ ).
    All in all, I think the best solution is: don't use the same ActionListener for more than one action (+i.e.+ don't add the same ActionListener to all your buttons, which leads to a big if-then-else series in your actionPerformed() ).
    Eventually, if you're listening to a single button's actions, whose text change over time (e.g. "pause"/"resume" in a VCR bar), I still think it's a bad idea to rely on the text of the button - instead, this text corresponds to a logical state (resp. playing/paused), it is more maintainable to base your logic on the state - which is more resilient to the evolutions of the UI (e.g. if you happen to use 2 toggle buttons instead of one single play/pause button).

  • How to i get the class name ? please help me

    hi friends
    i want to know how to get the class name from my java program
    public class sample
    public static void main(String args[])
    how to i get sample.
    please help me.
    thanks in advance                                                                                                                                                                                                                                                                                                                                                                                                                                           

    I can't recall which forum member gave the following solution, but it works
    in static contexts and it's copy-and-paste friendly -- you don't hard-code the
    name of the class, only a dummy class that you use to make this hack work:
    public class Foo {
        private static class Dummy{}
        public static void main(String[] args) {
            Class cls = Dummy.class.getEnclosingClass();
            String name = cls.getName();
            System.out.println(name);
    }

  • How do I get the procedure name

    Hi,
    With help of our application we are updating one table (P_Balance) in this account status and date through some procedures.
    in some situation only account status column get proper value, but date column having NULL value.
    Now we decided to track this, through which procedure this date column get updated null value.
    For this I decided to write one trigger for the table "P_BALANCE" through which procedure this update is happening.
    How do I get the procedure name.

    You could use DBMS_UTILITY.FORMAT_CALL_STACK and do it. Something like this.
    SQL> create table track_call_stack
      2  (
      3     program_name varchar2(30),
      4     call_stack varchar2(4000)
      5  );
    Table created.
    SQL> create table t
      2  (
      3    no integer
      4  );
    Table created.
    SQL> create or replace trigger t_trig before insert on t for each row
      2  begin
      3    if :new.no is null then
      4       insert into track_call_stack
      5       (
      6          program_name,
      7          call_stack
      8       )
      9       values
    10       (
    11          'T_TRIG',
    12          dbms_utility.format_call_stack
    13       );
    14    end if;
    15  end;
    16  /
    Trigger created.
    SQL> insert into t values (null);
    1 row created.
    SQL> select * from track_call_stack;
    PROGRAM_NAME                   CALL_STACK
    T_TRIG                         ----- PL/SQL Call Stack -----
                                     object      line  object
                                     handle    number  name
                                   3a7ac0ea8         1  anonymous block
                                   3a2bb9d78         3  ARBORU.T_TRIG
    SQL> create or replace procedure p1
      2  as
      3  begin
      4      insert into t values (null);
      5  end;
      6  /
    Procedure created.
    SQL> create or replace procedure p2
      2  as
      3  begin
      4      insert into t values (1);
      5      p1;
      6  end;
      7  /
    Procedure created.
    SQL> exec p2;
    PL/SQL procedure successfully completed.
    SQL> select * from track_call_stack;
    PROGRAM_NAME                   CALL_STACK
    T_TRIG                         ----- PL/SQL Call Stack -----
                                     object      line  object
                                     handle    number  name
                                   3a7ac0ea8         1  anonymous block
                                   3a2bb9d78         3  ARBORU.T_TRIG
    T_TRIG                         ----- PL/SQL Call Stack -----
                                     object      line  object
                                     handle    number  name
                                   3a7ac0ea8         1  anonymous block
                                   3a2bb9d78         3  ARBORU.T_TRIG
                                   3a2b32a10         4  procedure ARBORU.P1
                                   3a61db6a8         5  procedure ARBORU.P2
                                   3a653c3a0         1  anonymous block

  • How can i get the max rpm from cpu fan??

    how can i get the max rpm from my cpu cooler regarding that i don't have a speed controller attached to the cpu fan ,,, ??  please make things clear for me
    thanks

    if you have not reduced it by using a speed controller either hardware or software or by the 7v mod its already going as fast as it will at 12 v dc you cannot speed it up only slow it down
    need more air get a different cooler/fan

  • How can I get the edited pictures from the thumbnails to full size?

    I upgraded to iPhoto 11, the thumbnail photos show my previous edits, but when I click on the photo to make it bigger, it reverts back to the unedited, original picture.  How can I get the edited pictures from the thumbnails to full size?

    Verify you are using iPhoto11 ver 9.5
    if not run the >Software update or check your apps folder and make sure the correct iPhoto is launched,  not an older ver.

  • How can I get the XML structure from a flat structure?

    Hi all,
    in my XI SP 12 I use a JMS adapter to read information using the WebSphereMQ transport protocol.
    The structure that I receive have this format:
    <Name_A.KeyFieldValue><Name_A.fieldName_A1_Value>...<Name_A.fieldName_AN_Value>
    <NumberRecordType_B><NumberRecordType_c>
    <Name_B.KeyFieldValue><Name_B.fieldName_B1_Value>...<Name_B.fieldName_BN_Value>
    <Name_B.KeyFieldValue><Name_B.fieldName_B1_Value>...<Name_B.fieldName_BN_Value>
    <Name_C.KeyFieldValue><Name_C.fieldName_C1_Value>...<Name_C.fieldName_CN_Value>
    <Name_C.KeyFieldValue><Name_C.fieldName_C1_Value>...<Name_C.fieldName_CN_Value>
    the problem is that in this structure each line is not separated by a carriage return or a comma, I have all the information in a single line:
    <Name_A.KeyFieldValue><Name_A.fieldName_A1_Value>...<Name_A.fieldName_AN_Value><NumberRecordType_B><NumberRecordType_c><Name_B.KeyFieldValue><Name_B.fieldName_B1_Value>...<Name_B.fieldName_BN_Value>...<Name_B.KeyFieldValue><Name_B.fieldName_B1_Value>...<Name_B.fieldName_BN_Value><Name_C.KeyFieldValue><Name_C.fieldName_C1_Value>...<Name_C.fieldName_CN_Value>...<Name_C.KeyFieldValue><Name_C.fieldName_C1_Value>...<Name_C.fieldName_CN_Value>
    and the customer don't want to insert a line separator.
    Then, the question is:
    How can I get the XML structure from this structure?
    If possible, I don't want to develop new Module and add it in the JMS Module Sequence.
    PS I have already read the article "How to Use the Content Conversion Module with the XI 3 J2EE JMS Adapter.pdf" and it doesn't seem to help me.
    Best Regards,
    Paolo

    To get context parameters from your web.xml file you can simply get the ActionServlet object from an implementing action object class. In the perform (or execute) method make the following call.
    ServletContext context = getServlet().getServletContext();
    String tempContextVar =
    context.getInitParameter("<your context param >");

Maybe you are looking for

  • Signing and saving a document in Acrobat 8.0

    We would like to bypass the sign and save As dialog which appears when 1. Sign a document 2. click on Sign Is there any way we could acheive this

  • Terms of payment field on 3rd party condition record

    Hello, Does anyone currently utilize the terms of payment field (Payment terms) on the 3rd party condition record?  At this point, it is a field that can be populated and saved to the condition table (KONP) but it does not appear to influence the pur

  • Update price in IW32

    Hi all,         I want to change the RESBD-GPREIS ( prices ) value with net price in Purchase order. I know how to get the net price value based PR. I am trying to change the resbd-gpreis value using BADI WORKORDER_UPDATE ,  but it is not allowing to

  • How to hide the duration on the Aggregator TOC?

    I used the Aggregator to link multiple projects together as once course. I know that you can use a widget to hide the duration if you are using the Captivate TOC. I want to know if there is a way to hide the duration shown on the TOC created by the A

  • Why is DVI displayed at startup?

    For a few seconds at startup or when starting from sleep mode, the computer displays "DVI" in a small retangular square.  After looking at this a few hundred times and waiting all those seconds, it does not look normal and has become annoying.  Any i