Getting filename of launching file

hi, I have a program that can be run using Program.exe (which simply launches Data/Program.jar) or by running Data/Program.jar. How can I get the filename of the program that launched it?
Basically I need to know this because it will modify the user.dir system property. I don't want to go the route (if last 4 char's equals "Data", remove them from user.dir string. Because what if someone decides to name the "Program Folder", "Data"
Structure:
Program Folder
-- Program.exe (APPLICATION)
-- Data (FOLDER)
����-- Program.jar (EXECUTABLE JAR FILE)
thanks.

ok I have a solution but I'm still intereted in the answer to this question. Thanks.
If you're interested, I'm just going to have the .exe program pass an argument to main in the jar file.

Similar Messages

  • Get filename from uploaded file then place in input tags

    i have an upload feature with the use of upBean and i can get the filname thru filename=file.getFileName
    when i place in the input tags it takes an error what i suppose to do
    <input type="hidden" name="getfilename" value="<%=filename%>">
    if (MultipartFormDataRequest.isMultipartFormData(request)) {
                            // Uses MultipartFormDataRequest to parse the HTTP request.
                            MultipartFormDataRequest mrequest = new MultipartFormDataRequest(request);
                            String todo = null;
                            String filename=null;
                            String description=request.getParameter("txtDesc");
                            String checkfilename=mrequest.getParameter("uploadfile");
                            if (mrequest != null) todo = mrequest.getParameter("todo");
                            if ( (todo != null) && (todo.equalsIgnoreCase("upload")) ) {
                                Hashtable files = mrequest.getFiles();
                                if ( (files != null) && (!files.isEmpty()) && (description!=null)) {
                                    UploadFile file = (UploadFile) files.get("uploadfile");
                                    if (file != null){
                                        filename=file.getFileName();                                    if(checkfilename==null){
                                            filename="";
                                  upBean.store(mrequest, "uploadfile");  // Uses the bean now to store specified by jsp:setProperty at the top.
                                             else out.println("<BR> todo="+todo);
                    %>
                    Message was edited by:
    BlingBling15

    Thanks for reply.
    I replaced messageFileUpload (binded to blob table column) with messageStyledText (binded to filename attribute). Above the table placed single messageFileUpload and submitButton nearby. After user select file on submit I do:
    *if (pageContext.getParameter("DoUploadButton") != null) {*
    .. DataObject fileUploadData = pageContext.getNamedDataObject("FileData");
    .. *if (fileUploadData != null) {*
    .... String fileName = (String)fileUploadData.selectValue(null, "UPLOAD_FILE_NAME");
    .... String contentType = (String)fileUploadData.selectValue(null, "UPLOAD_FILE_MIME_TYPE");
    .... BlobDomain fileContent = (BlobDomain)fileUploadData.selectValue(null, fileName);
    .... String seqNumber = pageContext.getParameter("seqNumber");
    .... am.insertInstanceAttachRowBlob(seqNumber, fileName, fileContent, contentType);
    .... pageContext.removeNamedDataObject("FileData");
    .. return;
    Edited by: user12086842 on 02.01.2013 2:41

  • Get filename for batch file update

    Hello. I'm not sure if this is the right forum, but I am making a batch sequence to convrt documents. AS part of the sequence, I'd like to cahnge the Title property to match the filename. I have added the Description command, and can see how to add standard text (such as 'Document Title') fro every file, but how can I make it dynamic so that it uses whatever the filename is?

    VERY close. I added an 'Execute Javascript' command to the batch sequence, and used the formula you provided (and thank you for that!). The problem seems to be that when the sequence saves the new pdf, it has a title (or filename at that point) of 'ADPFF1.tmp' and numerically increments for each file that it processes, even though the original filename gets assigned to the new pdf file. Any ideas?

  • How to get FILENAME from FILE PATH

    does anyone know how to get filename from a file path for example
    FILE PATH: C:\Project\uploadbean\web\uploads\Button.txt
    returns
    FILENAME: Button.txt

    @BalusC
    ust for a reference cause i'm new in JSP This has nothing to do with JSP, but with basic knowledge of an essential API. I have given you the link to the File API. Are you saying that you refused to read the API documentation, which clearly explains you how to use the File and shows which methods are all available to you undereach the straightforward getName() method, and expecting that the others may chew the answers for you? Loser.

  • How can I get a filename without the file extension?

    I using a JFileChooser to select and read a file. Now I want to get the filename without the file extension
    JFileChooser j = new JFileChooser;
    String file = j.getSelectedFile.getName();
    At the moment I get this result "file.dat". I need only the filename.....
    Thank you
    Thomas

    It's quite that.
    Here is the code to do that (and the method to get only the extension):
         public String getFileName(String text) {
              int ind = text.lastIndexOf(".");
              if(0<ind && ind<(text.length()-1)) {
                   return text.substring(0, ind);
              return(null);
         public String getFileExtension(String text) {
              int ind = text.lastIndexOf(".");
              if(0<ind && ind<(text.length()-1)) {
                   return text.substring(ind+1).toLowerCase();
              return(null);
         }(I used 0<ind instead of ind>0 because with the code formatting there is a bug with > )
    I hope this helps,
    Denis

  • How can I fix error code 131:4? Licensing for this product stopped working. I have windows vista home edition and CS4 Design Premium. I downloaded licensing zip file for windows but I can't seem to get it to launch. Look forward to help from anyone

    How can I fix error code 131:4? Licensing for this product stopped working. I have windows vista home edition and CS4 Design Premium. I downloaded licensing zip file for windows but I can't seem to get it to launch. Look forward to help from anyone

    Steve,
    I appreciate your answer.  While it might work, I'm a bit hesitant to remove the other programs as a possible solution since they are all currently working.
    With Acrobat 9 Pro failing with the OS 10.7 upgrade, I'm hoping that there is a less severe solution.
    Since the trigger appears to be 10.7 and may have something to do with the discontinued support of Rosetta, I could be spending a few hours working on a reinstall without a change.  Yes, it might work.  The "might" is the part that makes me hesitate.
    Is anyone else out there on OS 10.7 and running Acrobat 9 Pro?  Any issues with anyone else?
    Thanks Steve.  I do appreciate your offering a solution.  I may end up trying it if nothing else comes together.
    Mark

  • Error is not getting logged in error file while running dataload maxl

    Hello All,
    I am running a Maxl to load data in a database which is running fine but noted a weird issue that the errors are not getting logged in error file. Suppose i changed the name of data file then it should give error something like
    ERROR - {Error no.} - Unable to open file {filename} which should be logged in error file but my error file is still empty.
    I am using the Maxl -
    import database {dbname} data from data_file {filename} on error append to "D:/Error/errorfile.err";
    Any inputs please...
    Thanks

    Try to use single quotes and the backslash. It may depend on the operating system and /or the version of essbase used. This is an example from one of my maxls:
    on error append to 'D:\Hyperion\logfiles\myload.err';
    cheers, chris

  • Java web start - Launch File error

    This is my first attempt to use web start
    I get following error - under "general" tab I get
    Could not find main-class RCApp2 in http://manishdesai/rcapp/RCApp2.jar
    my .jnlp file looks like -
    <jnlp spec="1.0+" codebase="http://manishdesai/rcapp/" href="http://manishdesai/rcapp/RCApp2.jnlp">
      <information>
        <title>Application</title>
        <vendor>H</vendor>
        <homepage href="http://manishdesai/rcapp/help.html"/>
        <description>RC Application</description>
        <description kind="short">RC</description>
      </information>
      <security>
        <all-permissions/>
      </security>
      <resources>
        <j2se version="1.5"/>
        <jar href="http://manishdesai/rcapp/RCApp2.jar" download="eager" main="false"/>
      </resources>
      <application-desc main-class="RCApp2"/>
    </jnlp> ]Need some help here
    thanks

    I am having similar problems. This is the first time i am using webstart. I learning as i go along. I am using tomcat. When i use the jar file on its own, it works perfectly fine. It loads properly and functions as its supposed to. But when i try to launch it using webstart it gives me these error messages.
    =========
    launch tab
    =========
    <?xml version="1.0" encoding="UTF-8"?>
    <!-- JNLP File for Relay Traffic Generator -->
    <jnlp
    codebase="http://localhost:8001/ali/"
    href="relaynew.jnlp">
    <information>
    <title>relay traffic generator</title>
    <vendor>RIM</vendor>
    <homepage href="http://localhost:8001/ali/"/>
    <offline-allowed/>
    </information>
    <resources>
    <j2se version="1.4"/>
    <jar href="relay.jar" main="true" download="eager"/>
    </resources>
    <application-desc main-class="RelayTrafficGenerator"/>
    </jnlp>
    ============
    exception tab
    ============
    JNLPException[category: Launch File Error : Exception: null : LaunchDesc:
    <jnlp spec="1.0+" codebase="http://localhost:8001/ali/" href="http://localhost:8001/ali/relaynew.jnlp">
      <information>
        <title>relay traffic generator</title>
        <vendor>RIM</vendor>
        <homepage href="http://localhost:8001/ali/"/>
        <offline-allowed/>
      </information>
      <update check="timeout" policy="always"/>
      <resources>
        <java version="1.4"/>
        <jar href="http://localhost:8001/ali/relay.jar" download="eager" main="true"/>
      </resources>
      <application-desc main-class="RelayTrafficGenerator"/>
    </jnlp> ]
         at com.sun.javaws.LaunchDownload.getMainClassName(Unknown Source)
         at com.sun.javaws.Launcher.doLaunchApp(Unknown Source)
         at com.sun.javaws.Launcher.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    If some one has any idea how this can be fixed. Please advise.

  • POWER QUERY Get External Data From File From Folder (Excel 2013)

    Hi,
    Beginner's question :
    What could be the use of the query on a folder : we just get a list of files with their path. What can we do with that?
    Thanks

    Hi,
    Do you want to combine data from multiple Excel Files in the same folder path into one table? If I understand correct, we can add a custom column to import the data.
    After we getting a list of files with their path, the Query Editor window will activate to show you a table containing a record for each file in the chosen directory. These will provide our function with the needed FilePath and FileName parameters. 
    Function sample: File name([Folder path],[Field name]
    For more detailed steps, please see the article:
    http://datapigtechnologies.com/blog/index.php/using-power-query-to-combine-data-from-multiple-excel-files-into-one-table/
    Please Note: Since the web site is not hosted by Microsoft, the link may change without notice. Microsoft does not guarantee the accuracy of this information.
    George Zhao
    TechNet Community Support
    It's recommended to download and install
    Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
    programs.

  • I am getting this error while file uploading

    Hi!
    I am getting this error while file uploading,I can't find any solution.
    SRVE0026E: [Servlet Error]-[org.apache.commons.fileupload.FileUpload: method setSizeMax(I)V not found]: javax.servlet.ServletException: org.apache.commons.fileupload.FileUpload: method setSizeMax(I)V not found
    at com.honeywell.sdm.base.controller.SDMActionServlet.service(SDMActionServlet.java:75)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
    at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
    at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
    at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
    at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
    at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
    at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
    at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:983)
    at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:564)
    at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:200)
    at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:119)
    at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:276)
    at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
    at com.ibm.ws.webcontainer.cache.invocation.CacheableInvocationContext.invoke(CacheableInvocationContext.java:116)
    at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:186)
    at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
    at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
    at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:618)
    at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:439)
    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:672)
    Please help me.I have attached the bean,action ,jsp pages
    uploadInfo.jsp
    <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
    <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
    <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
    <html:html>
    <HEAD>
    <script>
    function submitting(){
    document.uploadForm.operation.value = "uploadOrgAdj";
    document.uploadForm.action = "/uploadRecAction.do";
    document.uploadForm.submit();
    </script>
    </HEAD>
    <body>
    <html:form action="/uploadRecAction" method="post" enctype="multipart/form-data">
    Select the .xls File to upload data
    <html:file property="fileName"></html:file>
    <html:hidden property="operation" value=""/>
    <html:button property="btn" value="Submit" onclick="submitting()"></html:button>
    </html:form>
    </body>
    </html:html>
    uploadAdjForm :
    import javax.servlet.http.HttpServletRequest;
    import org.apache.struts.action.ActionError;
    import org.apache.struts.action.ActionErrors;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionMapping;
    import org.apache.struts.upload.FormFile;
    public class uploadAdjForm extends ActionForm{
    private FormFile fileName;
    * @return
    public FormFile getFileName() {
    System.out.println("getFileName"+fileName);
    return fileName;
    * @param string
    public void setFileName(FormFile string) {
    System.out.println("setileNmame"+string);
    fileName = string;
    Action:
    public class uploadFinancialAdjAction extends DispatchAction{
    public org.apache.struts.action.ActionForward uploadOrgAdj(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws Exception {
    String sForward = "UploadInfo";
    HttpSession session = request.getSession();
    String sStartIndex = null;
    String sEndIndex = null;
    try
    uploadFinancialAdjForm UploadForm=(uploadFinancialAdjForm)form;
    System.out.println(UploadForm.getFileName().getContentType().toString());
    String file=UploadForm.getFileName().toString();
    uploadFinancialAdjManager businessManager = new uploadFinancialAdjManager();
    ArrayList fileName = new ArrayList(); fileName = businessManager.getOrgAdjDetails(file);
    boolean isMultipart = FileUpload.isMultipartContent(request);
    if(isMultipart){
    // Create a new file upload handler
    DiskFileUpload upload = new DiskFileUpload();
    // Parse the request
    List items = upload.parseRequest(request);
    //Process the uploaded items
    Iterator iter = items.iterator();
    while (iter.hasNext()) {
    FileItem item = (FileItem) iter.next();
    if (item.isFormField()) {
    //processFormField(item);
    if(item.getFieldName().equalsIgnoreCase("txtStartIndex")){
    sStartIndex = item.getString();
    else if(item.getFieldName().equalsIgnoreCase("txtEndIndex")){
    sEndIndex = item.getString();
    uploadFinancialAdjForm UploadForm=(uploadFinancialAdjForm)form;
    String file=UploadForm.getFileName().toString();
    uploadFinancialAdjManager businessManager = new uploadFinancialAdjManager();
    ArrayList fileName = new ArrayList();
    fileName = businessManager.getOrgAdjDetails(file);
    }else{
    if(item.getName()!=null && !item.getName().toUpperCase().endsWith(".XLS")){
    throw new Exception("Please browse an excel file and Upload");
    session.setAttribute("fileItem",item);
    }//end of while
    session.setAttribute("startIndex",sStartIndex);
    session.setAttribute("endIndex",sEndIndex);
    request.setAttribute("FileUploadStatus","true");
    else{
    throw new Exception("Error:Form is not multipart");
    catch(Exception e)
    System.out.println(e);
    return mapping.findForward(sForward);
    }

    Plz answer for my question

  • Getting Filename without Path in a CFC

    Hi All,
    I'm attempting to use a CFC/Event Gateway to get the filename of a file that has landed in a directory.
    What I'm getting instead is the full path with the filename.
    <cfcomponent>
    <cffunction name="onAdd" access="public" returntype="void" output="false">
    <cfargument name="CFEvent" type="struct" required="true">
    <cfset var data = arguments.CFEvent.data>
    <cfset var filename = arguments.CFEvent.data.filename>
    </cffunction>
    </cfcomponent>
    I know that the above code isn't complete, but I think it's what 'counts' here.
    The value that I'm getting back for the 'filename' variable is similar to this:
    C:\WebSite\Some_Directory\Another_Directory\filename.ext
    What I want is just the filename  (filename.ext) part of that line.
    It appears that arguments.CFEvent.data.filename doesnt do it, and I've tried all kinds of combinations like  'filename', 'serverfile.filename', 'data.filename' and so on, but I must just be missing it.
    I found a workaround for what I'm trying to do with the CFC,  but it would be a lot easier if I just knew what I need to use in the code to just pull the filename of the file that was dropped into the directory.  (Using the DirectoryWatcher)
    If anyone can help out with how to do this,  it would be appreciated
    I've been at this for ten hours and feel like Captain Noob right about now.
    Thanks!
    CFML_MANIAC

    CFML_MANIAC wrote:
    The value that I'm getting back for the 'filename' variable is similar to this:
    C:\WebSite\Some_Directory\Another_Directory\filename.ext
    What I want is just the filename  (filename.ext) part of that line.
    It appears that arguments.CFEvent.data.filename doesnt do it, and I've tried all kinds of combinations like  'filename', 'serverfile.filename', 'data.filename' and so on, but I must just be missing it.
    You're missing nothing. It is simply that ColdFusion stores the file in the CFEvent struct as an absolute path. It makes sense, of course. The functionality is directory-watcher, so one should be able to derive information about the directory structure of the added file.

  • Error Message: "A virus was detected in FILENAME. This file will not be uploaded"

    I have been synching files using Creative Cloud Connect for many months. During the past few weeks, I get the message "Some files failed to sync". When I click on "Learn more", it has 3 files there and all have the message "A virus was detected in filename . This file will not be uploaded". I scanned all three files with AVG and Malwarebytes (installed on my system) and both report that there is no virus in those files. I have tried to chat with support but I could not find any resolution with them. I believe that I never got to the right place. I was connected with 5 different people. At the end of the last discussion I spoke to Adobe Captivate support. It so happens that the files with that error are all Adobe Captivate files. But that support also concluded that they couldn't help. I could not find similar entries in the forums either. Did anyone else have this problem?
    I appreciate any help.
    Angela

    No unfortunately, I have not.  I spent over an hour on the phone with them already regarding this topic. In the end, the support in Adobe Captivate (that's the 5th support group they connected me to) told me that I wasn't allowed to upload Captivate files since Adobe Captivate 8 is not a CC application and that's why the problem was happening. I am absolutely sure that this is untrue since I have many Captivate files on CC. I think the key will be to get to the right support group. Good luck! I really hope you find a solution. Keep me informed. Thanks.

  • Getting filename from ahref

    Hi guys...
    <a href="<%=retrieveFileFromDatabase%> target="main">Hello!</a>
    I need to get the filename of the file retrieve from database (that is retrieveFileFromDatabase) at the time the user clicks the link but all i get is all the filename of the files retrieve... Not the filename the user click at that time... Any help here? Thanks in advance...

    <a href="<%=(((Recordset1_data =
    Recordset1.getObject(file_doc"))==null ||
    Recordset1.wasNull())?"":Recordset1_data)%>"
    target="main" ><%=(((Recordset1_data =
    Recordset1.getObject("topic"))==null ||
    Recordset1.wasNull())?"":Recordset1_data)%></a>
    This is the actual code in my program..Okay, got that. First step done.
    I need to get the value, "<%=(((Recordset1_data =
    Recordset1.getObject("file_doc"))==null ||
    Recordset1.wasNull())?"":Recordset1_data)%>, once the
    user clicks the link...Right, and that is what the code says, in JSP scriptlet. So you execute this on a page, and the HTML is sent to your browser, and ...
    What Happens? An error? Or it just doesn't give you what you want. For instance, Take a look at the source code, find that link, and see what is there. Compare this to what you think it should look like. For instance, I would guess, what you think should happen is the html should be:
    Topic Of Document
    But what you are actually getting is:
    Topic of Document
    Is this correct?

  • In a FM 11 book, how can I display filename w/o file location?

    In a FrameMaker book, how can I display filename without the file's  location on the hard drive?
    For example, The book would list:
    "MyFile.fm"
    instead of
    C:\windows\documents\Framefiles\XYZ Company\widgets\draft_2013_1111\MyFile.fm
    If this cannot be done, then how can I get the book to list a name for the added file other than the name of the first heading in the file contents?

    Check out the little toggle icon beside the magnifying glass in the book tab – you can swap back and forth between “Display Heading Text” and “Display File Names”

  • Photoshop CS 5.5 - "Could not save [filename] because the file is locked..........."

    Hi,
    We have a few iMacs here all running 10.8.4 - we have PhotoShop CS 5.5 and all the artwork etc is saved on a shared server ( Windows 2008 r2)   and we are forever getting these problems......
    Only in photoshop we get the following error message......
    "Could not save [filename] because the file is locked or you do not have the necessary access privilege. Use the 'Get info' command in the finder to unlock the file or change permissions on the file or enclosing folders"
    Can't see this been an access issue so really don't know whats causing this other than the fact it's just server based...
    Please please please somebody help.

    I have been hqving this issue on windows after I upgraded to internet explorer 10 and using outlook (hotmail.com) to attach images to an email.
    After a file saved via photoshop (i assum any programe not just photoshop will cause this problem) is attached in outlook to an email, IE10 will not let go of that file.  meaning if you update the image in Photoshop and try and save over the existing jpg you previously attached it will give this error, file locked or file permissions needed etc.
    Just posting this info incase you are using email to attach files and then getting these permisssion problems.
    I work around it by closing the outlook browser tab (the email), so it lets go of the file, I can then save ontop of the file no problem, I then open outlook as needed.

Maybe you are looking for

  • Unknown Group - Causes Finder Crash - How do I change group?

    Many directories and files on my system after installing Leopard have an "Unknown" group and when I open a "Get Info" window on them and click the "Add" button the beachball appears and Finder crashes. MacFixit stated "This problem appears to be due

  • How to make a copy of the IMAP Sent messages when the Sent folder file can not be found?

    My Thunderbird works fine. I can also see messages sent in the Sent folder but I wonder are the sent messages only saved in the IMAP server. For the backup purposes I would like to copy the file of the Sent folder but I can not find a local file for

  • Separate Dimension or Property?

    Dear Friends, One of the dimension that i'm building has 6 level of hierarchy, and client wants to display it from up to bottom, not left to right. In that case, if i set the hierarchy to 1 dimension and utilize the properties, can i set the evdre to

  • Nokia E70, trying to connect to WLAN, problem with...

    Hello, I just go a Nokia E70 and am trying to connect to my home wifi internet... I can detect it etc, but cannot configure the access point... could someone please help me ? The problem is that my WEP key is, from what I see from my internet provide

  • N or G wifi mode?

    Is there any way to tell if you are connected with N or G mode on the iphone/itouch 4?