How get .class location?

Hi there!
One short question: What code should I write if
I want to find out the location (on my system)
where the .class-file is located?
/Andreas

You can't really, unless you load your classes via your own ClassLoader (and still, anything loaded prior to this such as JVM classes or the ClassLoader itself will be missed). You could try using the java.class.path property (see System.getProperties()) and searching this, but this isn't a 100% reliable method.

Similar Messages

  • How to get the location of a jarfile in the java 1.6 cache

    In 1.5 i am using getResource() to get the location of the jarfile i need, but in 1.6 this does not work anymore. I found a webpage with a workaround for this, but unfortunately i did not bookmark it and i can't find it again. Does anybody know how to get a file url instead of an http url to the jar file?
    I need the location to this jarfile. There is no other workaround and please DO NOT respond and tell me, that i don't need the location in the cache! I read all threads on the java forums to this issue and i didn't find a good answer.

    java.io.File class can be used.
    File f = new File("filename");
    S.O.P(f.canRead());
    S.O.P(f.canWrite());You can set the attribute using Runtime class.
    Runtime r = Runtime.getRuntime();
    Process p =r.exec("attrib -r file");If you are working with unix,
    r.exec("chmod -permissionoptions file");

  • How to get the location of the JMenuItem on the screen in actionPerformed

    How can I get the location of the JMenuItem on the screen in actionPerformed.
    When I use the function getLocationOnScreen() on JMenuItem or the object retruned by getComponent() I get IllegalComponentStateException.
    I have figured out that inside actionPerformed the parent of the JMenuItem which is JPopupMenu (that contains the JMenuItem) is not visible anymore (its isVisble() function returns false).
    Then how can I get the location on the screen of the JMenuItem or it�s popup menu such that I can use it in subsequent call to SwingUtilities.convertPoint(JMenuItem, int x, int y,frame), as I need to display a modal dialog box relative to the position of the popup menu in it�s frame.
    Regards,
    Janusz

    Thanks for reply.
    Unfortunately I have to figure out the location of the menu from within actionPerformed handler. At that point of time it is too late to overwrite JMenuItem. I probably could do some severe surgery in the code to implement my own JMenuItem derived class & overwrite processMouseEvent and pass the location attribute somehow to actionPerformed handler � but I am looking for some solution that would not require changes to the code outside actionPerformed handler.

  • How can we get the location from location area code?

    Hi All,
    i have an application which successfully runs on Motorola L6 and it gives me the cell-id, Location area code, and Mobile Network Code, and Mobile Country Code. Now I want to know how can I get the location ( I mean the name of the location) through location area code. And one more thing can we get current MNC and current MCC through j2me because I have written a code for getting this information for sony ericsson cells but dont have a handset to try out. Anyway if anyone has the information then please let me know
    Thanks in advance
    Sunil

    I donot think you have a direct blog..
    check this blog for java proxies ..
    /people/prasad.ulagappan2/blog/2005/06/27/asynchronous-inbound-java-proxy
    AND CONFIGURE A RFC..

  • I perform a search, get results, find the message I was after. How do I locate this message within my (relatively) complex folder and subfolder structure?

    Hi,
    I use structured subfolder system to keep my emails organized (hundreds and hundreds of folders).
    When I perform a search, get a list of results and within this list I find the email I was after, HOW do I locate the message? In other words, how can I open the folder which contains that particular email?
    Thank you in advance for your time and effort.

    Not a perfect solution but maybe a workaround.
    http://www.ehow.com/how_8222645_folder-thunderbird.html

  • How to get the location of a pageitem when there are pageitems with same UID?

    There are two text frames with same UID but on different pages( also defferent spreads ). What I want to know is how I can get the location of them both.
    The following code can only get the location of the first frame because the second frame has the same UIDRef with the first one(because they are in one document with same UID) .
        InterfacePtr<IGeometry> splineGeo(ItemRef, IID_IGEOMETRY);
        PMMatrix itemPMMatrix = ::InnerToPasteboardMatrix( splineGeo );
        PMRect  itemPMRect = itemGeo->GetStrokeBoundingBox( itemPMMatrix );
    Is there any way I can get the second frame location?
    Thanks a lot.

    No.
    Just copy the pageitems from master page to document page.

  • How to get the location of the browser?(pt_BR, en_US, es_ES...)

    How to get the location of the browser?
    example: pt_BR, en_US, es_ES...

    Hi Eduardo Cordeiro,
    Sorry in reaching you late...I was out on a trip...
    You need to put the javascript in your Flex application html wrapper file ...in which your  Flex application SWF is embedded.
    Write the Javascript function in your html file as below :
    function getBrowserLanguage()
      var browserLanguage = navigator.browserLanguage;
      return browserLanguage;
    //In your mxml File you can access the JavaScript function in your MXML as below:
    var browserLang:String  = ExternalInterface.call('getBrowserType');
    If this post answers your question or helps, please kindly mark it as such.
    Thanks,
    Bhasker Chari

  • I've lost my iPhone 4... How can I find it when the device is offline when using "find my iPhone app"????? Any way of getting a location from it????

    I've lost my iPhone 4... How can I find it when the device is off linesmen using "find my iPhone app"????? Any way of getting a location from it?????

    No. It must be online in order to locate it.
    What To Do If Your iDevice Is Lost Or Stolen
    iPhone, iPod Touch, and iPad
    If you activated Find My Phone before it was lost or stolen, you can track it only if it is connected to the Internet by Wi-Fi or cellular. What you cannot do is track your device using a serial number or other identifying number. You cannot expect Apple or anyone else to find your device for you. You cannot recover your loss unless you insure your device for such loss. It is not covered by your warranty.
    If your iPhone, iPod, iPod Touch, or iPad is lost or stolen what do you do? There are things you should have done in advance - before you lost it or it was stolen - and some things to do after the fact. Here are some suggestions:
    This link, Re: Help! I misplaced / lost my iPhone 5 today morning in delta Chelsea hotel downtown an I am not able to track it. Please help!, has some good advice regarding your options when your iDevice is lost or stolen.
      1. Reporting a lost or stolen Apple product
      2. Find my lost iPod Touch
      3. AT&T. Sprint, and Verizon can block stolen phones/tablets
      4. What-To-Do-When-Iphone-Is-Stolen
      5. iCloud- Use Lost Mode
      6. What to do if your iOS device is lost or stolen
      7. 6 Ways to Track and Recover Your Lost/Stolen iPhone
      8. Find My iPhone
      9. Report Stolen iPad | Stolen Lost Found Online
    It pays to be proactive by following the advice on using Find My Phone before you lose your device:
      1. Find My iPhone
      2. Setup your iDevice on iCloud
      3. OS X Lion/Mountain Lion- About Find My Mac
      4. How To Set Up Free Find Your iPhone (Even on Unsupported Devices)

  • How to get the location of the last click.

    What I can't seem to figure out how to do is get the location of the last click. I'm not setting anything by using the click im using the click to test boundaries. Basically if I click within this area this happens if i click within this other area something
    happens, etc. Thanks for your help! Also feel free to say an easier way to do this if you know one.

    Your description about your issue is very vague but you could for example handle the MouseLeftButtonDown event for the "area" and then use the MouseEventArgs.GetPosition method to determine the coordinates of the mouse click relative to some element,
    e.g.:
    private void Canvas_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
    Canvas canvas = sender as Canvas;
    Point p = e.GetPosition(canvas);
    double x = p.X;
    double y = p.Y;
    <Canvas Height="100" Width="100" Background="Red" MouseLeftButtonDown="Canvas_MouseLeftButtonDown">
    </Canvas>
    Please remember to close your threads by marking helpful posts as answer and please start a new thread if you have a new question.

  • How to get the location of the caret?

    Hello
    I want to get the location of the caret. Not the offset of the document.
    I have tried the Caret.getMagicCaretPosition(), but I think it gives me a point in viewport.
    How can I get the absoult location of the caret(the location on screen ,not in viewport)?
    Thank you very much.
    Best wishes

    Thankyou ,You reply seems to help me ,but I am still confused that this method returns void ,how can I get the result of the point on screen?
    When I want the caret location (the caret belongs to a JTextPane) on screen, I invoke :
    SwingUtilities.convertPointToScreen(textPane.getCaret().getMagicCaretPositon(),textPane);
    but how can I get the result of the convertion?
    Thank you!

  • HOW CAN I GET THE LOCATION OF MY CALLER

    HOW CAN I GET THE LOCATION OF MY CALLER pls its urgent

    HOW CAN I GET THE LOCATION OF MY CALLER pls its urgent

  • How to create object by getting class name as input

    hi
    i need to create object for the existing classes by getting class name as input from the user at run time.
    how can i do it.
    for exapmle ExpnEvaluation is a class, i will get this class name as input and store it in a string
    String classname = "ExpnEvaluation";
    now how can i create object for the class ExpnEvaluation by using the string classname in which the class name is storted
    Thanks in advance

    i think we have to cast it, can u help me how to cast
    the obj to the classname that i get as inputThat's exactly the point why you shouldn't be doing this. You can't have a dynamic cast at compile time already. It doesn't make sense. Which is also the reason why class.forName().newInstance() is a very nice but also often very useless tool, unless the classes loaded all share a mutual interface.

  • How do I locate non picture files and location? I'm getting low memory and can't find word,PDF etc

    how do I locate non picture files and location? I'm getting low memory and can't find word,PDF etc

    iPads don't have a filesystem like a computer, Files of that nature must be associated with an App and reside inside that particular App's file space.  So the way to find them is to open the App that opens that file type and look in its file or document list for them.

  • When I import my photos from my iPhone 4S into iPhoto the location does not appear.  I have to open the info button on the photo click "photo place" then "find on map" and then the location appears.  How to I get the location to appear automatically?

    When I import my photos from my iPhone 4S into iPhoto the location does not appear.  I have to open the info button on the photo click "photo place" then "find on map" and then the location appears. How to I get the location to appear automatically when I import my photos from my iPhone?

    in your iPhoto preferences is look up location set to "automaticaly"?
    LN

  • How do u get the location finder to work?

    How do u get the location finder to work? It hasnt worked since i bought it which was b4 i had wifi in my house now that i have it i thought it would work but still says your location cannot be determined

    The iPod Touch and iPhone uses SkyHook to triangulate your location. Since the Touch only has a Wi-Fi receiver it's not as accurate as the iPhone which uses Wi-Fi, GPS, and cell towers to find its location. You can submit your access point to Skyhook and it should then be discoverable.
    http://www.skyhookwireless.com/howitworks/submit_ap.php

Maybe you are looking for