Get URL for class

Is there any Java API that will allow me to get the URL of the JAR file or directory that contains a particular class? I'm looking for somrthing similar to getResource(String) in the Class class that will tell me which JAR file or directory the class loader is pulling stuff from.

The URLClassLoader has a method called getURLs(). I hope this snippet of code could help!
import java.net.URLClassLoader;
import java.net.URL;
import java.net.MalformedURLException;
public class Main {
    public static void main(String[] args) {
        try {
            URL[] urls = new URL[3];
            urls[0] = new URL("file:p/");
            urls[1] = new URL("http://java.sun.com/");
            urls[2] = new URL("file:/tmp/c.jar");
            // Create URLClassLoader
            URLClassLoader cl = URLClassLoader.newInstance(urls);
            URL[] retUrls = cl.getURLs();
            for (int i = 0; i < retUrls.length; i++) {
                System.out.println(retUrls[ i ]);
        } catch (MalformedURLException e) {
            e.printStackTrace();

Similar Messages

  • Get URL for List and ListItem

    Hi,
    I have a SharePoint List (SPList) and need to provide the URL for the list. It should be possible to copy this URL to the browsers address field and navigate to the corresponding Details or Overview View (or default view) of the list.
    Additionally, I have a List Item object (SPListItem) and need the URL to directly navigate to the DispForm.aspx of this item.
    I tried it like this:
    string listURL = ... + "/Lists/" + myList.Title;
    string itemURL = listURL + "/DispForm.aspx?ID=/" + id;
    The URLs are correct as long as the "Internal Name" of the list is the same as the displayed name of the list. But in SharePoint it is possible to add a List-Template with no blanks in the name (e.g. 'MyList'), but later rename it and include a blank (e.g. 'My List'). In this case the listURL I retrieve with the above code snippet does not work anymore! For SharePoint only a URL with the list name without blanks is existent. In short: the URL does not include the blank for the list in the url but myList.Title does!!
    So my question is, how can I get a URL that directly leads to my list's Details view (or default view) and the URL that leads directly to the list items "DispForm.aspx"??

    Hi,
            It seems you need to get correct ListItem URL from ListItem’s property, and thanks for all helpful suggestions.
            In this situation, would you please try using List’s Form property instead of “SubString”, code like this:
            string itemURL = yourweb.Url+"/"+yourlist.Forms[PAGETYPE.PAGE_DISPLAYFORM].Url + "?ID=" + item.ID;
           Then  you will actual retrieve the correct path to the DispForm.aspx page.
           Hope this sample can help.
    Best Regards,
    -Aaron

  • Trying to get URL for my photos for Mac 10.9.3

    Have never been able to get a URL for one of my photos. How do I do that? Do I need to download a program to do so?  (I am a participant at FSM Film Score Monthly, and wanted to post some of my photos there.) Thanks.

    Looking now
    The site here is making answering this very difficult
    OK made an account and looked at the instructions for posting. As andy surmised the image you want to have in your post at that site must already be on the web somewhere.
    You could try one of the links andy posted, photobucket might be the easiest for a new user to use\
    Once you have an account there and you upload your images you can post them to the FSM site
    by using the code
    [iimg]URL from photo bucket[/img]
    OK finally got that all posted, good luck
    regards

  • Get information for classes from call stack in abap (like java reflection)

    Hi,
    is there any possibilty to get following information:
    I want to program a logging tool. You can create a logging object and use some methods like
    xxxxx->add_msg(msg) to put logging information to the logging object.
    but i also want to find out, from which class/object/runtime environment this msg comes.
    example:
    class CL_ABC uses the logging tool and does following call:
    lo_logger = CL_logger->get_logger().
    lo_logger->add_msg( 'test the code' ).
    now the method ->add_msg() in logger object is called. inside this method, i want to have the information, from which class/object the ->add_msg() method is called. after the call, the logging object must have this information like:
    CALL_CLASS: CL_ABC
    CALL_LINE: 83
    MSG: test the code
    any ideas?

    You can use the SYSTEM_CALLSTACK function module.
    Read this thread, Uwe has given details on both getting the calling class and method: Re: How to determine current method / interface method that is running?
    Most probably this solves your needs.
    Regards

  • Get URL for WDJ application

    Hi guys!
    Deployed an application (ear file) on server.
    URL is: http://<server ip>:50000/webdynpro/dispatcher/sap.com/jaswd/JCaptcha?SAPtestId=2&answer=init&guid=4C19CB2279C6019DE10080000A0FF2AC
    Is there any class (like CL_WD_UTILITIES=>CONSTRUCT_WD_URL) to get this link from abap?
    Thanks!

    Hi,
         Is this a static link ? You can directly copy & paste the link and hardcode it.
    Thanks & Regards
    Umang

  • Get URL for J2EE client application

    Please forgive me if this question has an obvious answer, but I can't see it.
    Once Web Start has downloaded and started my J2EE Swing application client, how can my client get the name of the host (or entire URL) from which the client was downloaded?
    I would rather not have to hard code this into my client, so that the WAR file I deploy to the server is platform independent.
    bobj5000

    Use the JNLP BasicSevice API getCodeBase() to get the URL of the server.
    BasicService bs = (BasicService)ServiceManager.lookup("javax.jnlp.BasicService");
    URL url = bs.getCodeBase();
    Hope this helps
    Jeff

  • Not getting URL for WSDL to integrate with Xcelsius

    Hi all,
    I want to integrate Xcelsius with SAP data (Xcelsius should use data source as SAP data). First I had created a Function Module and using that FM I created Web Service. But when I tried to open SOAMANAGER transaction for that Web Service , the URL needed for integrating SAP data with Xcelsius is not coming (showing blank). So I could not able to connect that Web service with Xcelsius.
    Can anyone please help me in this regard.. Any suggestion will be wellcomed..
    Thanks,
    Simadri

    HI,
    which looks to me like an issue on the SAP Server side already so I would suggest you post the question into SOA area.
    Ingo

  • How to get the object class field value in CDHDR table for vendor

    hi
    how to get the object class field value in CDHDR table for vendor

    Try KRED/KRED_N as object class in CDHDR for Vendor.

  • Incorrect url getting generated for content server download

    Hi,
    In the MIC(Management for Internal Controls) system, the standard functionality of downloading attachments after they have been uploaded into content server (FOPC_DB) is not working. When this download link is clicked, it opens another webpage and its URL is pointing to wrong  port number.
    Detailed analysis:
    On further analysis, we arrived at the following observations:
    The URL for Start page of MIC is as follows:
    http://hostname.com:8050/sap/bc/bsp/sap/fopc_start/start.htm?s
    Whereas the incorrect url getting generated during down load is
    http://hostname.com:8097/...........
    The sap webdispatcher is running on the system using port 8050. Whereas the ICM engine is running on port 8097. The download url picks up the port number of default ICM which the sap webdispacher does not allow to display.
    We require help in changing the port number so that correct url gets generated. This url should carry the port number of  sap webdispatcher.
    Thanks for the help.

    DEVELOPMENT (WORKING)
    QUALITY (NOT WORKING)

  • Multiple HTTP GET requests for individual classes

    Hello,
    I have a Java plug-in deployed under tomcat 6. JRE version is 1.6.0_16. All the required jars are deployed packed (pack.gz) and the applet tag has 'java_arguments' parameter defined as:
    <param name='java_arguments' value='-Xms256m -Xmx512m -Djnlp.packEnabled=true -Djnlp.versionEnabled=true' />
    All the jars get loaded nicely as I see in the Tomcat access log:
    127.0.0.1 - - [03/Mar/2010:17:24:04 +0000] "GET /testapplet/lib/log4j-1.2.13.jar.pack.gz?version-id=1.2.13 HTTP/1.1" 200 0
    but immediately I see a bunch of GET requests for the individual classes in the same log4j jar:
    127.0.0.1 - - [03/Mar/2010:17:24:06 +0000] "GET /testapplet/lib/org/apache/log4j/Logger.class HTTP/1.1" 404 0
    127.0.0.1 - - [03/Mar/2010:17:24:06 +0000] "GET /testapplet/lib/org/apache/log4j/Category.class HTTP/1.1" 404 0
    127.0.0.1 - - [03/Mar/2010:17:24:06 +0000] "GET /testapplet/lib/org/apache/log4j/spi/AppenderAttachable.class HTTP/1.1" 404 0
    As you can see each of these GET requests are returned a Http error code 404. While testing locally, this isn't adding any delays, but over a real deployment it's bound to be slow down the applet loading while the server is responding to each of these class requests.
    Subsequently, the application itself runs without any issues and these bogus class requests failures have no effect (thankfully) on the functionality.
    Any one seen this behavior? Appreciate any thoughts or help.
    Regards,
    Parag

    http://forums.java.net/jive/thread.jspa?threadID=75990&tstart=0

  • How to get SDKODBC Wrapper class for indesign cs3

    Hi,
         I have to implement the mysql database with my indesign plugin. I didn't have a SDKODBC Wrapper class. Can any one say how to get SDKODBC Wrapper class from adobe.
    Regards,
    saravanan.

    I doubt if change documents are generated for SE78 transaction.
    For list of change documents defined, please check table: TCDOB.
    Hope this helps.
    Kind Regards
    Eswar

  • How to get OIDs of indexes for class-map ?

    I have policy-map configured on cisco router with some class-maps inside. I need to draw a graph traffic passing through these classes. To make a graphs I use Cacti  which use SNMP query to draw the graphs (object name cbQosObjectsIndex).
    How to get OIDs of class-map indexes ?
    I tried to do this by following query:
    #snmpwalk -c community_string -v 2c 192.168.0.252 1.3.6.1.4.1.9.9.166.1.5.1.1.1
    but the answer was:
    iso.3.6.1.4.1.9.9.166.1.5.1.1.1 = No Such Object available on this agent at this OID
    The information i need is contained at the OID 1.3.6.1.4.1.9.9.166.1.15.1.1.7:
    # snmpwalk -c community_string -v 2c 192.168.0.252 1.3.6.1.4.1.9.9.166.1.15.1.1.7
    iso.3.6.1.4.1.9.9.166.1.15.1.1.7.1251.1277 = Gauge32: 0
    iso.3.6.1.4.1.9.9.166.1.15.1.1.7.1251.13363 = Gauge32: 0
    iso.3.6.1.4.1.9.9.166.1.15.1.1.7.1251.13383 = Gauge32: 0
    iso.3.6.1.4.1.9.9.166.1.15.1.1.7.1251.13435 = Gauge32: 734000
    iso.3.6.1.4.1.9.9.166.1.15.1.1.7.1251.13481 = Gauge32: 233000

    Because 192.168.0.252 1.3.6.1.4.1.9.9.166.1.5.1.1.1 is marked "non-accessible" according to http://tools.cisco.com/Support/SNMP/do/BrowseOID.do?local=en&translate=Translate&objectInput=cbQosObjectsIndex
    You'll need to obtain the indices as explained in this blog post:
    http://pierky.wordpress.com/2009/04/09/cisco-class-based-qos-snmp-mib-and-statistics-monitor-for-nms/
    Joe wrote a very illustrative post on the subject of snmptables: https://supportforums.cisco.com/message/3051004#3051004
    And if your IOS supports it, you would want to configure the following to keep the indices from changing after every reboot or OIR:
    "snmp mib persist cbqos"

  • Why am I getting the flag Invalid URL for web content overlay when making scrolling panel in Indesig

    Why am I getting the flag 'Invalid URL for web content overlay" when making scrolling panel in Indesign? Iam making additions to existing articles but the problem is new. The articles were originally made using CS and now I am on CC, which I have just uninstalled and re installed, no difference, can anyone help please? Steve

    Hi Bob, thankyou very much for coming back on this. The flag is coming up towards the end of the preview process on desk top. I have made dozens if not hundreds on my two published apps on the app store, but have not done an update for nearly a year, in which time I have needed a refresher, and as usual went to Lynda. In this case I have followed to the letter your DPS course, which is great, and I found the process of making the scrolling panels somewhat easier than when I started 2-3years ago. Initially I was mystified that the flag talked about url and web content, but just put it down to something I had missed in recent improvements in CC.
    I tried over and over, but always got the same result. I thought at one point it might be because the content of my slide was copy and photo, so for a test I deleted the photo. Same result, and many of my existing slides are copy and picture.
    I also uninstalled Indesign CC and reinstalled in case of corrupted content, I also copied to IDML and relaunch, same problem. I am sure I have made the scrolling content as instructed, The one thing I havn't done is trash my preferences, if you think that would be a good Idea could you please direct me to some content at Lynda on how to do it in CC. Many thanks, Steve

  • How can we get a url for a "Meet Now" conference call from within the Windows Store App?

    Hi,
    Is it possible to get the url for the current meeting / new "Meet Now" call from within the Windows Store app?
    You have the option of inviting your current Lync contacts, but I don't see a way of giving a URL to clients that would launch Lync on their device, or take them to the web app.
    I can see how to get the link using the Outlook plugin, for pre-scheduled meetings. Is this link always the same and the one that should be used for an impromptu "Meet Now" meeting? It would still be good to know how to get this URL from within
    the store app so I can tell clients where to get it.
    Some people may be on Windows RT devices and not have access to the plugin in Outlook, and want to start a meeting at short notice and then invite others via email or pasting a link to them elsewhere.
    Any help appreciated.
    If I have answered your question, please mark it as the correct answer. If I have provided helpful information, please mark it as so.

    Hi,
    Agree with Holger, I check on my Lync Windows Store app and can't find the meeting URL as well.
    Best Regards,
    Eason Huang
    Eason Huang
    TechNet Community Support

  • I get this error msg - Permission denied for to webpage get property XPCComponents.classes

    A couple of days ago I started geting the error msg -Permission denied for to <webpage> get property XPCComponents.classes. It happens with every webpage I visit. If I hit the x in the upper righthand corner I can then access the page. This doesn't have in IE. Any ideas how I could fix this and why it started happening?

    Try the Firefox SafeMode to see how it works there. <br />
    ''A troubleshooting mode, which disables most Add-ons.'' <br />
    ''(If you're not using it, switch to the Default Theme.)''
    * You can open the Firefox 4.0+ SafeMode by holding the '''Shft''' key when you use the Firefox desktop or Start menu shortcut.
    * Or use the Help menu item, click on '''Restart with Add-ons Disabled...''' while Firefox is running. <br />
    ''Don't select anything right now, just use "Continue in SafeMode."''
    ''To exit the Firefox Safe Mode, just close Firefox and wait a few seconds before using the Firefox shortcut (without the Shft key) to open it again.''
    '''''If it is good in the Firefox SafeMode''''', your problem is probably caused by an extension, and you need to figure out which one. <br />
    http://support.mozilla.com/en-US/kb/troubleshooting+extensions+and+themes
    ''When you figure out what is causing that, please let us know. It might help other user's who have that problem.''
    If you look in the Error Console for that '''XPCComponents.classes''' error, there should be a '''Source file: chrome://''' address which might give us information related to which extension is causing that message.
    Firefox button > Web Developer -> Error Console or just use {Ctrl + Shft + J} from the keyboard

Maybe you are looking for