Getting class directory path

If given a class name is it possible to find out where the class is located on the computer? Like for instance I have a class whatever.class In my java program is it possible to find out that say whatever.class resides in c:\java\classes ?

Yeah, if it's in your classpath then there's a way. But if you are like the several hundred other people who already asked that question, then that isn't your real question. You probably want to put a configuration file in the same directory, and you want to be able to find that file, or something like that. I don't see any use for knowing what directory a class is in... unless you would like to expand on the question.

Similar Messages

  • Get Domain directory path in weblogic server 10gR3

    Hi all,
    Does anyone know how to get the directory path of to a domin in WLS 10gR3 using JMX?
    Basically, I am trying to create a timer in WLI manually using Java code but for that to work, I
    need to know the domain directory path as below.
    BTW, I know it can be created in WLST with ease... but I want to try using Java code
    import com.bea.wli.mbconnector.timer.TimerConnGenerator;
    public class WLITimerTest {
    public static void main(String args[]) {
    String domainDir = <path of domain>; // e.g. C:\bea103\user_projects\domains\mydomain
    String domainDir = "C:/bea103/user_projects/domains/esis_domain";
    try {
    TimerConnGenerator.main(new String[] {"-inName", "timerName", "-outfile",
    domainDir +"/WLITimerEG_" + "timerName" + ".jar"});
              } catch (Exception e) {
                   e.printStackTrace();
    Thanks
    Sam

    Just to answer my own question. It's System.getenv('DOMAIN_HOME') where DOMAIN_HOME is set in setDomainEnv.cmd of your domain.

  • How to get folder(directory path only not file path) from local file system

    Hi Firends,
    How to get folder(directory path only not file path) from local file system , whenevr i will click on browse button.
    Please give reply for this one , if anybody knows.
    Thanks,
    Anderson.

    Hi Anderson,
    if you're using flash.filesystem.FileReference - then it is run in black box - except of filename, size and creation data (and few other properties available after some operation succeeded). This is part of security features in Flash runtime (described in header section):
    http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/FileReference .html
    This for example implies that user can download a content to local machine - but that content cannot be loaded back into Flash runtime. For this you would need either Air runtime flash.filesystem.File:
    http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/filesystem/File.h tml
    (so you would created Air runtime based application: desktop or mobile but not web, even as standalone project) or you would need one of 3rd party tools that add file access/file information features to standard Flash runtime applications converted to standalone native applications.
    hth,
    kind regards,
    Peter

  • How to get absolute directory path of a resource?

    Hi,
      I wished to retrieve the absolute directory path of a resource, for example, "demo.test" in the folder of "/document/personal". How to I get the value "/document/personal", is there any IPropertyName i could use?
    Thanks for any suggestions.

    Hi,
    first, the accessRID is the RID which was used at creation time, maybe containing links; these are resolved, so you will get the "physical" place where the file is stored by <i>getRID</i>.
    Second, to determine the path without the name of the file, there are at least three possibilities without looping (resource, the file, is an instance of IResource):
    1.) String path = resource.getParentCollection().getRID().toString();
    2.) String path = resource.getRID().toString().substring(0, resource.getRID()().toString().lastIndexOf('/'));
    3.) String path = resource.getRID()().toString().substring(0, resource.getRID()().toString().length() - resource.getName().length());
    Solution 1 seems to be very intuitive (you ask for the folder path, where the file is in), 2 & 3 are shorter than a loop, but not intuitive and in general dangerous (when using substring, you have to take care of exceptions caused by strange parameters).
    Hope it helps
    Detlev

  • How to get *.class file path....

    how could find the executable file path at execution time..
    if there is one *.class file, then i will paste it to another location . next i will execute that .class file. how to find that path from execution program ....

    Try the following
    URL path = getClass().getProtectionDomain().getCodeSource().getLocation();

  • Get directory path. Just the directory path, without the file name.

    Hi,
    I need to export a file from a table in SAP to a directory in the PC. So i need to get a directory path.
    I've been reading the threads but all the answers refer to functions F4_FILENAME, WS_FILENAME_GET, KD_GET_FILENAME_ON_F4 or to the method CL_GUI_FRONTEND_SERVICES=>FILE_SAVE_DIALOG.
    But all of them require to select a file to close the window.
    What I need is to get the path to the directory, not to a file.
    For example:
    I just need to get:
    C:\TEMP
    and not:
    C:\TEMP\file.doc
    Please help.
    Thanks.

    Pablo, use cl_gui_frontend_services=>directory_browse.
    Refer this code:
    PARAMETERS:
      p_path         TYPE rlgrap-filename OBLIGATORY.
    DATA:
      gv_path_ini    TYPE string,
      gv_path_sel    TYPE string.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_path.
      CALL METHOD cl_gui_frontend_services=>directory_browse
        EXPORTING
          initial_folder  = gv_path_ini
        CHANGING
          selected_folder = gv_path_sel
        EXCEPTIONS
          cntl_error      = 1
          error_no_gui    = 2
          OTHERS          = 3
      IF sy-subrc = 0.
        CALL METHOD cl_gui_cfw=>flush( ).
        IF NOT gv_path_sel IS INITIAL.
          gv_path_ini = p_path = gv_path_sel.
        ENDIF.
      ENDIF.
    As a side note, always avoid any WS_* function modules as they're not Unicode compliant.
    Regards

  • Getting directory path of a file

    Is there an easy way to get a directory path to a selected file? I am having problems at work where I need to tell someone where a file is but it is nested deep in a directory structure. I'd love to be able to navigate to the file and somehow be able to copy the path. Any ideas? This can be easily done in the Windows (yuck!!!) Explorer.

    A third option is to do a spotlight search for the file, then hover your mouse over it and you will get a yellow tool tip with the file path. However, as in W.J. Lope's first option you cannot copy and paste. Or you may want to take a look at an application like PathFinder.
    -mj
    [email protected]

  • How to assign directory path of File/FTP adapter into a variable insideBPEL

    Hi,
    i need to get the directory path given to file/Ftp adapter (write/PUT) into a variable while invoking, which will be later used in some other BPEL service for processing.
    i am able to get the directory path easily using "jca.file.filename/jca.ftp.filename" in case of invokin Read\GET adapter but am struggling to get these details while invoking a file/Ftp adapter (write/PUT).
    kindly tell me is it possible to get these properties in case of file/Ftp adapter (write/PUT) !!!!
    Thanks
    Siva

    These documents may be helpful in discovering the functionality/use of variables to capture some of the file adapter properties.
    How to Manipulate SOA 11g Adapter Headers Using Oracle Mediator (Doc ID 1352248.1)
    How to Create an Outbound File with the Same Name as the Inbound File with FTP/FILE Adapter (Doc ID 745587.1)
    Hope it helps!
    Amy

  • Want to output only the directory path in the jTextField

    Currently, I am getting the directory path, but need to select a file inside it, then only the directory path gets selected in the jTextField1. Please tell me how do I get the directory path in jTextField1 by selecting only the directories in jButton1.
    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt)
         JFileChooser dirchoose=new JFileChooser();
         dirchoose.setCurrentDirectory(curfile);
         String directory=dirchoose.getCurrentDirectory().toString();
         int stat=dirchoose.showOpenDialog(this);
         if(stat==JFileChooser.APPROVE_OPTION)
              curfile=dirchoose.getCurrentDirectory();
              jTextField1.setText(dirchoose.getCurrentDirectory().toString());
              String jTextField1Text=jTextField1.getText();
    File curfile=new File("C:\\");

    Please ignore this topic. I am new here and was bit confused with the forum.

  • Get the directory information of Weblogic installation

    We have a scenario , wherein we have placed an xml in a specific directory in weblogic. For eg : $WLS_HOME/DefaultDomain/config/fmwconfig/mbeans/xyz.xml
    Would like to know
    a) whether we can get the value of $WLS_HOME
    b) whether we can get the directory path for a domain (domain directory)
    through WLST.
    Thanks
    Joseph George

    The ServerRuntime MBean has a getCurrentDirectory() method. You can call this from WLST.
    serverRuntime()
    print cmo.getCurrentDirectory()

  • Get Installed directory

    Is it possible to get install directory path info?
    Windows(registry?) & Macintosh

    Hi accellea,
    OfCourse you can get the install directory path info?
    Use this:
    var dir:File = File.applicationDirectory;
    trace(dir.url);
    It will display you the install directory path

  • 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 to get the directory name where the class resides

    I have following directory structure.
    c:\one\two\three\four\five\Test.java
    package name for Test.java is four.five
    When I run, four.five.Test, I want to get the compelte path name where currently the Test.class is running i.e. "c:\one\two\three\four\five\"
    so that if I move four.five.Test.java into some different directory structure, I should always get the complete path name.
    Thanks In Advance
    Sachin

    package x.y;
    import java.io.File;
    public class Test {
        public static void main(String[] args) {
            System.out.println(new File(Test.class.getResource("").getFile()).getAbsolutePath());
    }

  • "Failed to load main class manifest attribute from " directory path

    i get this error when trying to run a jar file i made with eclipse. does anyone know how to fix it? thanks derek
    "Failed to load main class manifest attribute from "<directory path>

    A JAR file is simply a collection of class files, in order to make it an "executable" JAR file you must specify which class file is the "main" class file. In other words, which class should the runtime start executing first. You do this using what is called a manifest file, this is meta information included into the JAR file that the runtime extracts and uses. One attribute is the Main-Class key, which specifies the application's entry point.
    The Java tutorial goes into further detail on how to do this
    http://java.sun.com/docs/books/tutorial/deployment/jar/appman.html
    You may also do this using Eclipse by going File -> Export -> Java -> JAR and follow the wizard.
    Using Netbeans this almost comes for free.

  • How can I get rid of directory path in front of my folder names in Folder listing in Library mode???

    Im using the most recent version of Lightroom 5.3 (updated through CC - even though this has shown up on previous version) on Windows 7 and all the folders in my library are showing up with the directory path in front of my folder names. How can I get rid of this? I do not see any options in preferences to turn this off. I have also turned off preferences in Windows > Folder Options Control Panel "Display full Path in Title bar" option.
    I have Lightroom on several computers and have set up preferences the same on each workstation, and this only shows up on one workstation.
    Any help would be appreciated.
    You can see from the image  below how this is showing up.
    Thanks
    Thanks!

    Click the little down arrow/+ symbol  next the + - in the folders bar.

Maybe you are looking for

  • How to link a document in Framework

    In CWB Home Page there is ability to link to various URL. I know how to link to a Portal. But I need to link to a Document (Word or PPT) which is located in Shared Servers. If this is possible , How do I write the full Path which includes the documen

  • Key figure not exist in infoprovider

    Hi, in what situation can a keyfigure exist in a query designer but not belonging to an infoprovider? When i tried to launch a BEx query, i got system message about the above. There is aggregation level under which there is multiprovider under which

  • Types of discs to use when backing up music

    am i only allowed to use a certain type of disc (+ or -) when i backup my music to discs? I would really like to backup my music as data on DVD's, but I have discs, and itunes keeps telling my to install a disc. I don't know why....please help

  • Use a variable to define the row number in a Range ("???").select

    Dim r as integer r=5 Range("G r").select This stalls with 'Range' _Global fail I want to manipulate r (the row that logic produces) and use to select a cell Help...fix

  • How can i set this comparison in formula node

    a=[0,100] a<=5          => x=1 5<a<=10    => x=2 10<a<=95  => x=3 95<a<=98  => x=4 a>98          => x=5 Thank you. Solved! Go to Solution.