Page 1 of 2 12 LastLast
Results 1 to 5 of 7

Thread: Problem while launching the application from a different directory than where exe is

  1. #1
    satya007 Guest

    Problem while launching the application from a different directory than where exe is

    Hi All,
    I am quite new to the installshield and I need help. I have Created an installer for our java application using installshield X universal. It installs the application correctly and also works fine when launched the application from start menu shortcut. Our application analyzes websites for some rules and at any time a website's info can be stored to a file with a specific extension (say <siteName>.ramp) using our application. At later stage if some one clicks on this .ramp file it should openup with our application. But what is happening now is when we click on this .ramp file I guess it is looking at the windows registry for path where the application executable is located and launches application but failing to locate some required property files existing in the same folder as application executable.
    These property files are installed using File Action in installshield and specified the installation location being the same as the installation location of the product. So what is happening here is say product executable and these property files are in C:\Program Files\company\product and Registry entry for executable path is also pointing to the above directory and .ramp file is in another directory say C:\xyz\abc.ramp. Now if we click on abc.ramp file it launches the application by looking at the registry path value and look for the property files in C:\xyz directory instead of looking at C:\Program Files\company\product. This is because C:\xyz is the working directory or current directory for it ralative to which it searches for any files. On the other hand if the .ramp file is there in the same directory as of application executable then every thing works fine as working directory is same as where these proprty files are existing.
    Is there any way in installsheild that I can tell it to search for the files relative to the directory where the executable is created or located rather than from where the executable is called? Any help regarding this is much appreciated.

    Note: This works fine if we create installer using installAnywhere.

    Thanks in advance.
    -Satya

  2. #2
    Join Date
    Dec 2001
    Posts
    713
    I'd need to know more about this .ramp file. I assume that you create a file association in the windows registry for the .ramp extension? What executable does the .ramp file association target? I assume that it targets a launcher created by InstallShield?

    I believe that the shortcut works because you are able to set the working directory.
    Charles - Flexera Software

  3. #3
    satya007 Guest
    Hi Charles,
    Thanks for your response. Yes, you are right. I am associating .ramp extension with launcher created by installshield in windows registry and I am not setting any working directory to the shortcut specially. I think by default it takes the directory where the launcher is created and hence it works fine. It will be of great help if you have any input on this issue.

    Thanks again.
    -Satya

  4. #4
    Join Date
    Dec 2001
    Posts
    713
    Originally, launchers would always set the working directory to the directory where the launcher resided. This was changed in ISMP 4.5 as the launcher was ignoring the "start in" property of shortcuts.

    To work around this issue, you will need to set the system property "user.dir". This will allow you to set the working directory for the java app which you are launching. The easiest way to do this would be to use an ascii file update bean to create a file named "LauncherName.sp", where "launcherName is the name of your launcher. In this file, add the line "user.dir=$P(BeanId.absoluteInstallLocation)", where "beanID" is the bean ID of the parent component of the launcher. This will resolve to the install directory where the launcher resides on the target machine.

    As a quick test to verify that this works, manually create <launcher name>.sp in the same location as the launcher, and add the line user.dir=<Launcher home>, where launcher home is the directory where the launcher resides.
    Charles - Flexera Software

  5. #5
    satya007 Guest
    Hi Charles,
    Thank you. I have tried your suggestion. Now it fails even while locating the main class itself. It does not even go that far to locate the property files. It gives the following error.

    java.long.NoClassDefFoundError:= File/Deque/Ramp Exception in thread " main

    It looks like it is scruing up of classpath for some reason. Path it is looking at 'Files/Deque/Ramp' is part of
    "Program Files/Deque/Ramp Ascend" .

    I think $D(install)/$P(vendor)/$P(displayName) resolves to above directory path and it is truncating till white space in front (i.e program got truncated) and Ascend at the end which is the string after second white space in the above directory path. Even I select a different installation destination directory in Destination dialog still it complains the same error. What I am not understanding is why the classpath is getting resolved to this string? The only place $D(install)/$P(vendor)/$P(displayName) is been used is as install location for the root product. And in classpath all jars start with
    "$P(component1.absoluteInstallLocation)"

    e.g "$P(component1.absoluteInstallLocation)/ramp.jar"

    where component1 is the bean id for the parent component of launcher. So it resolves to installation directory and in which we have these jars. Looks like this is not getting resolved correctly as expected. Everything works fine if execute the launcher from shortcut and without launcherName.sp file in the installation directory. Can you please help me understand what is going on here?
    Thanks for all your help.
    -Satya

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •