Get current directory(without user.dir)!!!!

Dudes,
need help badly... i need to get the current directory of the jar file where it gets launched from. Since the launching takes place from an html file, the system property "user.dir" does not get set to the current directory. Both the html as well as the jar file is in the same location.
so in short, i need to get the current dir without using the user.dir that i can later set it explicitly thru my program(to the current dir)

"Search the CLASSPATH for the first occurence of your jar file... but FFS only do it once, and save the result"
Cud ya elaborate that statement.
Also, the reason i wanna know is this : my jar file references all the images that it uses, thru a relative path(./a/b/c.....). So wen i simply double click the jar file, the relative path("./") gets replaced with the current workin directory(from user.dir) and fetching of images works perfectly. But if it is launched via html, the user.dir does not get set to the current working dirctory and as a result the jar file looks for its images in the default location which is the desktop. so it doesnt work
Now that the context is clear, is there a way out???? or is there any way in which i can set the user.dir from the html itself(maybe by using javascript or somethin??)

Similar Messages

  • Cd_links: could not get current directory

    I am installing Oracle8 in Linux and that's the error that I am
    getting: cd_links: could not get current directory
    Does anyone know where is cd_links?
    null

    Claudia (guest) wrote:
    : I am installing Oracle8 in Linux and that's the error that I am
    : getting: cd_links: could not get current directory
    : Does anyone know where is cd_links?
    Which Oracle version are you installing? It's the Enterprise
    Edition or the Standard Edition, did you download it from the
    web? or you got the cd?
    null

  • Getting current directory from an applet

    Hi. How can I get the current directory of my applet running on web without having to worry about permissin. I used the one below:
    curDir = System.getProperty("user.dir");
    but I get this error:
    ava.security.AccessControlException: access denied (java.util.PropertyPermission user.dir read)
         at java.security.AccessControlContext.checkPermission(Unknown Source)
    any substiture for this? Thanks.

    You should be using URLs or similar approaches, and avoiding File, which will
    never work with an ordinary applet.
    InputStream in = this.getClass().getResourceAsStream("file.txt");That assumes the txt file is in the same place as the current classes .class file.
    For example, the same folder or that they are jarred in the same "folder" in the jar.
    You can also use a URL directly:
    URL url = ...
    InputStream in = url.openStream();and you can construct that URL with the help of Applet methods getDocumentBase or getCodeBase:
    URL url = new URL(this.getDocumentBase(), "file.txt");That assumes the txt file is in the same folder as the html file in which the applet is embedded.

  • Getting current directory

    Is there some way to get the current directory path in java?
    -Kevin

    Use
    System.getProperty("user.dir")
    you can get the directory in which you start your java application.

  • Getting current date without using client's clock

    Is there a way to get the current date without using client's clock?
    The java application we developed has many windows on which the Current Date is an important display field. As it's used 24x7, we need to make sure the date is current.
    Right now, we make a CORBA service call to get the date from the server everytime the user Resets any of these windows. This is causing a peformance issue due to the slow service call.
    Is it possible to get the Date once from the server and then start a timer to derive the date thereafter. Will a change in the client's clock affect this logic ? Can we implement this without using client's system time.
    Or is there another better way ?
    Thanks for your help.

    If I can summarize your current requirements:
    1. You need to know the time.
    2. You don't trust the client's clock so you want to get the time from another computer.
    3. You want this access to be "not too slow".
    I find requirement number 2 to be peculiar, I've never seen an application that doesn't accept the time on the client system as valid. However, there it is. Maybe it's a system for checking employees in and out, and the smarter ones have been faking out the system by changing the clock. If your CORBA connection is too slow, and NTP is too slow (it takes the little program I got from USNO about 3 seconds to synchronize my clock), why not write your own time server? A simple web server that returns only the time to any request would work. If that's not fast enough then I'd suggest you're out of luck.

  • Get current directory?

    Hello
    How do I get the directory a java program is running in?

    System.getProperty("user.dir")

  • How to get current logged in user's star rating in SharePoint 2013

    Hi,
    Currently,  I am developing a custom web part to show star rating for documents, everything is done.
    However,when user hover on the star I want a tooltip message("Your current rating is 1..."), similar to what we have 
    in libraries(or what the sharepoint by default provides in libraries) . So can I get the user specific rating depending upon 
    the logged in user using code(.net or CSOM anything will work)

    using the below code you can get the rated by user along with the rating , it's easier to just notify the user that her already rated the document 
    var acontext = new SP.ClientContext.get_current();
    var lists=acontext.get_web().get_lists();
    var l =lists.getByTitle("Documents"); //your document libraty
    var aitem=l.getItemById(27);//Item id
    acontext.load(aitem, "RatedBy", "ID", "Ratings");
    acontext.executeQueryAsync(function(){
    var RatedBy= aitem.get_item('RatedBy');
    if (!SP.ScriptHelpers.isNullOrUndefined(ratings)) {
    for (var i = 0; i < RatedBy.length; i++) {
    var user = RatedBy[i];
    if (user.get_lookupId() == _spPageContextInfo.userId) {
    //show that you already rate it
    break;
    },function(s,e){alert(e.get_message());});
    another way is to use CAML query to check if the current user id is within the RatedBy multi user field
    Hope that helps|Amr Fouad|MCTS,MCPD sharePoint 2010

  • How to get current logged-in user name in data access driver or in universe

    In universe, to get the current log in user is via @Variable('BOUSER').
    Right now, I need to be able to get the user name in the data access driver. I am writing a customized data access driver because we need to patch some where clause on the the query generated by the universe based on the logged-in user info. I only think of using end_sql parameter or adding an universe level filter to patch the @Variable('BOUSER') to the query, which would not work if user want to use customized query.
    Can anyone tell me how to get currentBO user name from connection server ? or how @Variable('BOUSER') is translated into the logged-in user name in the universe?

    I do not know your EJB Service. But you should pass the credentials of the current logged on portal user to your service. That's not by default I think.
    I had a similar problem with CAF developed webservices. I had to turn on permission checks in my web service and passed the credentials via logon ticket.
    Regards, Bernd

  • OIM11gr2 - How to get currently logged in user details using oim api

    Hi All,
    I have a requirement to retrieve currently logged in users profile in the process adapter.
    I have tried with getSelfProfile in tcUserOperation and also ContextManager.getOIMUser API's however, in both the cases i am getting xelsysadm details only.
    Also as know request details in Process task mapping doesnot work for OIM11g onwards (its returning column not found exception )
    DOes any one has idea how to achieve this.
    PS. - i am using platform to retrieve API's.
    Thanks & Regards
    Swati Pandey

    You can get the logged in user name using the below java code:
    ADFContext adfCtx = ADFContext.getCurrent();
    SecurityContext secCntx = adfCtx.getSecurityContext();
    String user = secCntx.getUserPrincipal().getName();
    HTH

  • How to get Current Logged in user in Java

    Hi All ,
    I have written a code in to get the current logged in user in the portal in an EJB service.  I have used the code
    *IUser user= UMFactory.getAuthenticator().getLoggedInUser();*. But surprisingly the userId which it returns is always is Guest. Can you please help on this issue.
    Thanks & Regards,
    Rohit

    I do not know your EJB Service. But you should pass the credentials of the current logged on portal user to your service. That's not by default I think.
    I had a similar problem with CAF developed webservices. I had to turn on permission checks in my web service and passed the credentials via logon ticket.
    Regards, Bernd

  • Getting current directory for JFileChooser

    I'm trying to construct a JFileChooser that uses the current directory as its view (and not the default Windows "My Documents" directory path). How can I get the current directory path? File definately doesn't have anything, Toolkit neither.

    I had the same exact question a while ago. The solution is quite simple.
    JFileChooser j = new JFileChooser(".");

  • How to get current directory and enviroment variables

    Hello, 
       1.- Is there a global variable to get the actual (project, where is DSB and DSQ files) directory? 
       2.- Is there a way to get User directory like reading enviroment variables from Operative System? 
    Thanks in advance.
    PD: I'm using Dasylab12
    Solved!
    Go to Solution.

    Yes, use System Strings
    For example, ${DATA_FOLDER}.
    The easiest way to get the list is to right click and select Global Strings. The bottom half of the dialog box lists system strings, including date, time, the name of the worksheet, with or without path, the DEFAULT folders for worksheet, data, other, black box, etc. 
    - cj
    Measurement Computing (MCC) has free technical support. Visit www.mccdaq.com and click on the "Support" tab for all support options, including DASYLab.

  • How to get currently logged in user on 'Bill of Material' Form in Add-Mode

    Dear All,
                    I am using a UDF on 'Bill of Material' Form in SAP. This UDF is named as Current_User. I want in this UDF the user name that is currently logged in to SAP. I am able to get user name at form load event. But when 'Bill of Material' Form comes in ADD Mode, the user name doesn't display. What can I do for this problem.? Here is my code:
    public override void Handle_SBO_ItemEvent(string FormUID, ref SAPbouiCOM.ItemEvent pVal, out bool BubbleEvent)
                BubbleEvent = true;                 
                try
                    if ((mst_FormUIDModal != null))
                        if (FormUID != mst_FormUIDModal)
                            bool dbo_FormFound = false;
                            foreach (SAPbouiCOM.Form dsa_Form in this.SBO_Application.Forms)
                                if (dsa_Form.UniqueID == mst_FormUIDModal)
                                    if (FormUID != mst_FormUIDModal)
                                        if (this.SBO_Application.Forms.Item(mst_FormUIDModal).Selected == false)
                                            this.SBO_Application.Forms.Item(mst_FormUIDModal).Select();
                                        BubbleEvent = false;
                                        return;
                                    dbo_FormFound = true;
                            if (!dbo_FormFound)
                                this.mst_FormUIDModal = null;
                    if (pVal.BeforeAction == false)
                        switch (pVal.EventType)
                            case BoEventTypes.et_FORM_LOAD:
                                    if (pVal.FormType == -672)
                                        Program.Curr_User = SBO_Company.UserName;
                                        doc_form = this.SBO_Application.Forms.GetForm(pVal.FormType.ToString(), pVal.FormTypeCount);
                                        ((SAPbouiCOM.EditText)doc_form.Items.Item("U_User").Specific).Value = Program.Curr_User;
                                } break;

    Hi,
    You need not to write any sdk code for this task. You just create a user query as mentioned above and save it with some name.
    Then Open the Bill Of Material Screen, just click in the required field, then click alt + shift + f2 to assign a Formatted Serach.
    Then Select 3 rd Option       "Search in Existing User-Defined Values According to Saved Query"
    Then Click on the button "Open Saved Query"
    It will open the Query Manager. Select the Saved Query.
    Enable the Option "Auto Refresh When Field Changes"
    In the Drop Down list, select the Value "Parent Item"
    Then Select the Option Refresh Regularly or Display Saved Values.
    This will automatically put the user code if the parent item is selected.
    You an achieve this by without SDK Code.
    PS:
    There is a change in the Above Query:
    Select USER_CODE from ousr where userid = $[USER]
    Edited by: Manikandan K on Dec 22, 2011 2:00 PM

  • Get current logged in user's Apple ID

    Hi,
    I'm trying to implement a rating feature on an app I'm developing, but it's giving me a problem wich is that every user of the app can rate something one and only one time, wich means I can't use his/her IP nor MAC Address, I need something global like the user's e-mail associoated with apple's account, Apple ID or wathever it is that distinguishes users in the App Store. So, is there a way of getting this information in AIR or native language (so I can create an ANE)? Just a simple method that returns the user's ID is what I need.
    Thanks in advance.

    Ok, after some ersearch I found an extension by MilkmanGames called RateBox, here are some links:
    http://www.milkmangames.com/blog/tools/#ratebox (for the extension)
    http://www.adobe.com/devnet/air/articles/ratebox-ane-ios-android.html (for a tutorial)
    Can anyone confirm if this works for rating in-app purchases? I don't wanna buy this without knowing if it'll really work for what I want.

  • Get current logged in user in sharepoint 2013 hover display template

    Hi,
    Can somebody tell me how the current logged in username can be retreived in hover display template to be used in search result.
    i tried using rest api but that is very difficult to get as it is to be done using ajax call and if we do getting a return value asynchronous is difficult.
    Please help

    Hello,
    You might use the function used in the Visual Studio SharePoint App template:
    var context = SP.ClientContext.get_current();
    var user = context.get_web().get_currentUser();
    $(document).ready(function () {
    getUserName();
    function getUserName() {
    context.load(user);
    context.executeQueryAsync(onGetUserNameSuccess, onGetUserNameFail);
    function onGetUserNameSuccess() {
    $('#message').text('Hello ' + user.get_title());
    function onGetUserNameFail(sender, args) {
    alert('Failed to get user name. Error:' + args.get_message());

Maybe you are looking for

  • How to declare a variable in Custom column formula?

    I'm adding a new column and I have a formula like it: if Text.Length(Text.Replace(Text.Replace([Text], "-", ""), " ", "") ) = 4 then "CB0" & Text.Range(Text.Replace(Text.Replace([Text], "-", ""), " ", "") , 2) else Text.Replace(Text.Replace([Text], "

  • How to create an init method with executeEmptyRowSet() in task flow

    hi i try this <method-call id="Empty"> <method>executeEmptyRowSet()</method> </method-call> in my task flow but am geting error am in jdeveloper 11.1.1.6.0

  • Qty sales & month

    Dear Forums, If i want to get this report for This month so far ; item code, item description, DocDate,stock on hand, Qty sales, Turn over, Turn over days eg . April 20, 542514 / MILK/ 11-05-09 / 40 / 10 / 2.66666 / 80 / 20 / 30 542518/ SOAP/ 11-05-0

  • Acrobat copy crash

      Lately Adobe has been crashing all the time when copying from a report window or within Acrobat with the error "There was an error while copying to the Clipboard. An internal error occurred." and the only option shown is OK. But it causes IE to cra

  • Purchase order 4500003445 has no item error is comin

    hi all, created one PO, then created Invoice with refrence to PO, After doing MIRO, I am trying to do GR with refrence to PObut system is showing error purchase order 4500007834 has no item. Gr based invoice is uncheck. vendor aknowledgement is unche