Get application filepath

Hello,
Is it possible and how to get the full filepath of a currently running Java application?
something analogous to $0 in a UNIX script?
I have searched hard for this one and haven't found anything.
Thanks, Allasso

Allasso wrote:
pbrockway2 wrote:
A single executable jar is good. If you put the things you are copying within the jar archive you can access them as getResource("/dir/whatever.dat"). The leading slash means the name will be resolved from the top of the jar archive. Basically this means you don't have to dick around with the URL returned for your class to figure out the paths to the resources. Moreover since the classpath is being used to resolve whatever.dat's name the mechanism is location agnostic the way Andrew described.assuming then, that the URL returned would be the absolute path in relation to the user's machine, then it sounds like that would work good. If I am understanding you correctly then, I could just put the location of the parent folder of the files I am copying as the arg to getResource() and get right to it.
ThanksI was referring to the case of a "single executable jar" - if you put the installer and the resources it uses all inside the same jar then getResource() can be used in a straight forward fashion with the argument being the path (within the jar) to the executable.

Similar Messages

  • How to get application's state on weblogic server using jmx.

    I want to get application state using JMX, I am able to get application list, name but not able to find its state. Some code snippet mentioned below. Please let me know if I can use some other MBean
    Thanks in advance..
    static {
    try {
    service = new ObjectName("com.bea:Name=DomainRuntimeService,Type=weblogic.management.mbeanservers.domainruntime.DomainRuntimeServiceMBean");
    }catch (MalformedObjectNameException e) {
    throw new AssertionError(e.getMessage());
    * Initialize connection to the Domain Runtime MBean Server
    public static void initConnection(String hostname, String portString, String username, String password) throws IOException, MalformedURLException
    String protocol = "t3";
    int port = Integer.parseInt(portString);
    String jndiroot = "/jndi/";
    String mserver = "weblogic.management.mbeanservers.domainruntime";
    JMXServiceURL serviceURL= new JMXServiceURL(protocol,hostname, port, jndiroot+mserver);
    // JMXServiceURL serviceURL = new JMXServiceURL(protocol, hostname, portString, jndiroot , mserver);
    Hashtable h = new Hashtable();
    h.put(Context.SECURITY_PRINCIPAL, username);
    h.put(Context.SECURITY_CREDENTIALS, password);
    h.put(JMXConnectorFactory.PROTOCOL_PROVIDER_PACKAGES,
    "weblogic.management.remote");
    connector = JMXConnectorFactory.connect(serviceURL, h);
    connection = connector.getMBeanServerConnection();
    * Get an array of ServerRuntimeMBeans
    public static ObjectName[] getServerRuntimes() throws Exception {
    return (ObjectName[]) connection.getAttribute(service,
    "ServerRuntimes");
    * Get an array of WebAppComponentRuntimeMBeans
    public void getApplicationData() throws Exception {
    ObjectName[] serverRT = getServerRuntimes();
    int length = (int) serverRT.length;
    for (int i = 0; i < length; i++) {
    ObjectName[] appRT =
    (ObjectName[]) connection.getAttribute(serverRT,
    "ApplicationRuntimes");
    int appLength = (int) appRT.length;
    for (int x = 0; x < appLength; x++) {
    System.out.println("Application name: " +
    (String)connection.getAttribute(appRT[x], "Name")+"Application Status"+(String)connection.getAttribute(appRT[x], "State"));
    public static void main(String[] args) throws Exception {
    String hostname = "*****.us.oracle.com";
    String portString = "*****";
    String username = "***";
    String password = "****";
    JMXUtil s = new JMXUtil();
    initConnection(hostname, portString, username, password);
    s.getApplicationData();
    connector.close();

    register at elicense.bea.com and ask there.
    but, a license is a license, as long as the ipaddr is not restricted.
    Wayne
    Bora wrote:
    I downloaded an Evaluation copy from BEA but it expires in 30 days. The place I
    work has licenses for HPUX but I need to have a copy on my laptop for development
    & test.
    Thanks for help!
    Sincerely
    Bora

  • TS1717 On Windows Vista and tried several times to start up my iTunes, but keep getting 'application failed MSVCR80.dll error-7 (windows 126) is this an easy fix ...?

    On Windows Vista and tried several times to start up my iTunes, but keep getting 'application failed MSVCR80.dll error-7 (windows 126) is this an easy fix ...?

    Click here and follow the instructions. You may need to completely remove and reinstall iTunes and all related components, or run the process multiple times; this won't normally affect its library, but that should be backed up anyway.
    (99442)

  • Possible to get application parameter in value help

    Hello colleagues,
    we developed a value help for business partner to use it in an wda-component . in this value help only those business partner should get supplied where the user has a relationship to . to make it really difficult we can not use the backend user (crm) but the portal user . in the component which uses the value help we achieve to get the user via application parameter from the containing iview but as soon as the user calls the value help this context is lost and we can no longer use the application parameter (which is in fact "out" of the iview) to retrieve the user of the application and therefore get a dump.
    Is there a possibility who to get application parameter of a component in a value help called by this component ?
    Thanks in advance
    Michael

    Hi,
    PLease refer to this link
    http://help.sap.com/saphelp_nw70/helpdata/en/88/266a3e54a2e946e10000000a114084/frameset.htm
    You can enter parameter values for certain screen fields for displaying a SAP transaction here.
    This field is optional.
    The parameter values are specified with the following syntax:
    <Screen_field1>=<Parameter1>
    &<Screen_field2>=<Parameter2>
    Thanks
    Pankaj

  • I get "application not found" when clicking on a http link in a mail, even after having set firefox as the default program for http links.

    After installing firefox 15.0, I can not open links form email or other office 2010 applications. I get "application not found" error. I tried setting firefox as the default program both manually (in the Windows default program panel) and automatically (having Firefox to do it automatically on startup (tools->options->advanced->General). I still have the error.

    That sounds odd. Is this error coming from a particular e-mail program you're using? It could be that that program has its own settings for which web browser to launch, ignoring the "default browser" setting in Windows.
    Does the same thing happen if you click on a web link from any other external (non-browser) application on your computer? If it happens with other apps too, I would suggest to re-download and install Firefox (www.mozilla.org) and see if that takes care of it.

  • How to get Application Error descriptions

    Hi, all:
    Our interface has ECC system involved.
    The Message Monitoring in local integration engine shows that there are many messages with application errors.
    I would like to export all messages with application error:
    include message ID and error text.
    Right now, I can export the data from Message monitoring window, but I can not get application error from exported spreadsheet. anyone has idea how to do it ?
    Thanks in advance !
    Liang Ji

    Hi, venkata:
    Thanks for you reply.
    Our scenario is
      ThirdPartySystem ---> SOAP ---> XI ---> ECC (ABAP Proxy)
      Technically, the scenario is running perfect.
    After go-alive, there are many application errors because of the data problem,  e.g.:
    Cannot create order. Service order number already exist
    We know these problem are caused by conversion, now I would like to track each message, so I exported to spreadsheet from Message monitoring.
    But the exported spreadsheet does not include Application Error text, this is the reason I post the question here, do you have idea about it ?
    Thanks
    Liang

  • How do I get Application Manager to recognize that Photoshop is not installed?

    Application Manager says that Photoshop CS6 is installed. It isn't. I've rebooted the Mac and it still says it's installed.  What installed was a partial or corrupt file which I have trashed. How do I get Application Manager to recognize that Photoshop is not installed so I can download and install it again?  Thanks.

    Do you have an uninstaller available to you in the Applications/Utilities/Adobe Installers folder?  If so then please run the uninstaller.
    If you don't then please utilize the uninstallers available in this folder to remove all currently installed Adobe Creative Software.  You will then want to follow this by running the CS Cleaner tool.  You can find details on the use of the CS Cleaner tool at CS Cleaner Tool for installation problems | CCM, CS6, CS5.5, CS5, CS4, CS3 - http://helpx.adobe.com/creative-suite/kb/cs5-cleaner-tool-installation-problems.html.

  • Can't get application id "com.apple.ScreenSaver.Engine".

    I'm trying to compile the following in AppleScript Editor in OS X 10.6.4 and keep getting the following error message: Can't get application id "com.apple.ScreenSaver.Engine". Any suggestions?
    try
    tell application id "com.apple.ScreenSaver.Engine" to launch
    end try

    I tried
    try
    *tell application id "com.apple.ScreenSaver.Engine" to launch*
    *end try*
    on my MacBook Pro, and it worked flawlessly. It should work also on yours.
    Well… I fear this post isn't very helpful.

  • How to get application module instance from java bundle?

    Hi!
    I would like to build an application that would get all translations from a database table.
    So I created application module for translations that contains a view object which is selecting translations for specific language from a database table. I exposed a method in application module as client interface which returns HashMap<String, String> for all translations for specific language. When I test my view and client interface method call they work fine.
    Then I created java bundle classes to get translations for specific language. Then I tried to override public Object[][] getContents() method.
    I tried to get my translations application module like this:
    SharedTranslationsAppModuleImpl am = new SharedTranslationsAppModuleImpl();
    Map<String, String> translationsMap = am.getTranslations(this.getLocaleCode); // Client interface method call
    In getTranslations(String LocaleCode) I try to get that view (which would select translations from database) but it returns NULL and I get NPE error message.
    So what is the right way to get application module from java bundle file? Now everytime application wants to get translations, application stops and displays NPE message.
    Regards, Marko
    I use JDeveloper 11.1.2.1.0

    Marko,
    you can't just instantiate an application module. An application module has to be set up, db connections and memory pools have to be initialized and ....
    Can you describe why and when you try to read the resource bundle from the db and where the resource bundle is used?
    This blog may be what you are looking for http://technology.amis.nl/2012/08/10/implement-resource-bundles-for-adf-applications-in-a-database-table/
    Timo

  • How to get Application Component in RSA1

    Hi Experts,
    I am not find any Application Components (RSA1) all my Data Sources are under the tree of Unsigned Nodes.
    How to get Application Component for my application, I am developing HCM application under that E-Recruiting.
    Can anyone help me regarding this.
    Regards
    Vijay

    Hi
    Whatever you have on infosource,will have same components.
    Goto RSA1 then source systems. double click on source system then right click on ypur R/3 source system then say display datasource tree.
    Chandu.

  • Getting application Name

    Hi Experts,
    I have PCD path of portal page. Can I get application path(the full path with project path and application name) of the application that portal page is holding?
    Regards,
    Gopal

    Hi  Gopal,
    Check this [thread|how do i retrieve the url for external window;
    It may be useful to you.
    regards,
    Siva

  • Keep getting Application Error

    Keep getting "Application Error 523 Reset" on home screen. Need help please!

    Try resetting the device by removing the battery for 1 minute then replacing it. See if it reboots.
    Usually with a 523 error you'll need to reload the OS on your device.
    First download and install the Desktop Manager from here (4.6 without Media Manager is recommended): https://www.blackberry.com/Downloads/entry.do?code=A8BAA56554F96369AB93E4F3BB068C22
    Next download and install the handheld software from here: http://na.blackberry.com/eng/support/downloads/download_sites.jsp
    Afterwards try reloading the OS by connecting the device to your computer, open the Desktop Manager, then go into the Application Loader. This will open a wizard that steps you through reloading the OS onto your device. More detailed steps can be found here:
    http://www.blackberry.com/btsc/KB03485
    If someone has been helpful please consider giving them kudos by clicking the star to the left of their post.
    Remember to resolve your thread by clicking Accepted Solution.

  • Can not get application bc4j for adding context root file

    Hi all,
    Can someone help me on this,
    i got this this error while trying to run my web based reporting:
    06/08/21 18:01:04 [SEVERE]: Error instantiating application at file:/C:/Documents and Settings/Bryan1/Desktop/Pattern Maching JSP 2006Feb/jdevstudio1013/jdev/system/oracle.j2ee.10.1.3.34.12/embedded-oc4j/applications/bc4j.ear: Unable to get ApplicationConfig for bc4j : Error creating deployment directory: IO Error: The system cannot find the path specified.
    06/08/21 18:01:04 [SEVERE]: Error instantiating application at file:/C:/Documents and Settings/Bryan1/Desktop/Pattern Maching JSP May2006/jdevstudio1013/jdev/system/oracle.j2ee.10.1.3.34.12/embedded-oc4j/applications/ITS.ear: Unable to get ApplicationConfig for ITS : Error creating deployment directory: IO Error: The system cannot find the path specified.
    2006-08-21 18:01:07.265 WARNING J2EE_OJR0007 Can not get application bc4j for adding context root file:/C:/Pattern Maching JSP May2006/jdevstudio1013/jdev/system/oracle.j2ee.10.1.3.34.12/embedded-oc4j/config/default-web-site.xml
    Ready message received from Oc4jNotifier.
    Embedded OC4J startup time: 5282 ms.
    Target URL -- http://192.168.2.55:8988/Trans-Reporting-context-root/login.jsp
    06/08/21 18:01:07 Oracle Containers for J2EE 10g (10.1.3.0.0) - Developer Preview initializedIF i run http://192.168.2.55:8080/Reporting/login.jsp from web browser then is ok, but cannot straight run from JDeveloper? How to set the path?
    rgds,
    bryan

    Dear Frank,
    Thanks for ur reply but i still failed to access to my login.jsp
    I already select RUN from menu then clean <XXXX.jpr>, then rebuild the project and Run the project but still have the same problem.
    rgds,
    bryan

  • Can't open Lightroom.  Keep getting application error - unable to start correctly (0xc000007b).

    Keep getting application error - unable to start correctly (0xc000007b).  Have uninstalled and reinstalled twice with no change.

    ...07b Problems http://forums.adobe.com/thread/1355374?tstart=0

  • Failed  to get application IPropertyContentProvider

    I have an app that works in our dev environment, but when I put it in our TST environment I get the following error.  I used to work, I just basically made a spelling change in the gui so I am not sure why it doesn't work now.  Anyone have an idea of what this error is?
    001438BD95B1004C0000001200001A3000044D580200B802#1210940292929#com.sap.portal.ivs.semantic.iViewService#sap.com/irj#com.sap.portal.ivs.semantic.iViewService#HFARR042#16191##DCPORTPRD07_NWT_227503550#HFARR042#1cc32e30234211dd966a001438bd95b1#SAPEngine_Application_Thread[impl:3]_24##0#0#Error#1#/System/Server#Java###Failed to get application IPropertyContentProvider: #1#<name of app>

    Amit,
    This is may be for the problem of missing jar files in your project.
    Please follow this,
    1. Store the par file into your local computer
    2. Unzip the par and store it into ur local computer
    3. Navigate to PORTAL-INF-> Lib folder and copy the file which are available in the lib folder and paste them into your lib of your project.
    4. Deploy the appln
    also add the jars, if you have missed any.
    Ramganesan Karuppaiyah

Maybe you are looking for

  • Deletion of Leave which is in Status 'SENT' by employee in SAP HR

    Hi All, We are using BADI  (BAdI Definition PT_ABS_REQ) for leave validation. In this validation we are checking Current Leaves with the Leaves already applied (Approved / Non-approved). In this process, We are trying to DELETE a leave which is in st

  • How to avoid Unicode errors in SAP custom code queries.

    Currently we are going for a non Unicode technical upgrade from 4.6C to ECC 6.0. We have many query infosets with custom ABAP code. Unable to execute these queries (infosets) as ECC 6.0 system is throwing short dump and query infoset editor throwing

  • Formula that adds all cells of the same color?

    I am trying to add all the cells that are of the same text color (or fill color if that is easier) so I can tabulate separate categories of information that are organized by color located throughout the spreadsheet. Is there a formula for this or a w

  • Pix don't show in document that I made in Pages, copied and pasted onto an email

    I've got a six month old Mac Air with OS X 10.9.2. I made a short document in Pages, version 5.2 (1860). I used the images link to put some photos into the document. I want to send this document to many people, using who knows what operating systems.

  • It won't let me update!

    When I check on my macbook air if there is any software update it says there is one. When I click on 'update' its starts checking files and stuff but then it says, ' An unexpected problem has occurred' or something - what can I do, It won't let me up