Standalone Application Shortcut Issue (File Does Not Exist, Matlab Compiler 2013b)

I have compiled an application that works perfectly when executed in Matlab.
After the installation, an error occur if I try to execute my application with the shortcuts automatically created : "File "icon.png" doest not exist. Error in main_file.m at line 42."
However, "icon.png" is existing in my installation folder.
To fix this problem, I tried executing the application directly from the installation folder without using a shortcut and it worked normally. Moreover, if I create manually a shortcut from there it works too.
The only difference in the shortcuts properties is the "Start In" property that is empty with the automatically generated shortcut and filled with my installation folder in the manual shortcut.
Is there a way to fix my application setup for further deployment on other computers ?

4 Comments

hi, right now i am facing the same problem. Did you figure it out? how to solve this problem? thanks very much ~~
Hi, me too, i am facing the same problem when i compiled my GUI project. The error is:
File "C:\Users\User\Desktop\myproject\image.png" does not exist. Error in => mainmenu.m at line 42
It works just fine when i use the same computer which has this folder on my desktop => myproject\image.png
The problem is this error exist when i try to use other computer using the final deployed files..
Hello,
This should come from the fact that you added a shortcut on the desktp during the installation. Then, the app search for your image in the same place that is your shortcut (so on your desktop). I did not figure out how to solve it while creating the shortcut on the desktop during the installation. However, if you do not create it and that you just create a shortcut while using your installation folder --> application --> and then send your app to the desktop, it should work.
If anyone has the solution to make it work directly with the shortcut from the installation, I'll take it.
I am also having this issue. In addition for me when the program saves files it sticks them next to the shortcut instead of where the program is installed.
This causes the program to error if I use the start menu shortcut since that is in a resticted location on Windows.

Sign in to comment.

Answers (3)

Did you select it as a file to be installed with your application?

3 Comments

Perhaps you need to use the full file path to the file
filepath = fullfile(ctfroot,'icon.png')
Or similar.
I am having the same problem. I put the full path to the file in my program. I also added it to "files installed for your end user" and "files required for your application to run" in the Application Compiler. I continue to get the error 'File "c:\<username>\Matlab_programs\someFile.tif' does not exist. The directory c:\<username>\Matlab_programs\ is never mentioned in my code, so I am unclear why Matlab expects it to be there.

Sign in to comment.

hello
I am facing the same issue. did anyone arrived to solve this please ?
many thanks
Looks like an old thread but I had the same issue and have a work around only so far.
The problem comes from the automatically generated shortcuts. The shortcuts have two paths included, one for "Target" (the application), another for "Start In". For the auto-generated shortcuts on the desktop the "Start In" is set to the desktop rather than the application location... this causes my app to crash. When you launch the application by double-clicking the app itself you start the application in the folder with the executable.
Note: The line that crashes is located in the main function call into GUI app where teh code is labeled as "DO NOT EDIT" above and below; the specific line calls gui_mainfcn().
As a temporary workaround you can deselect (or delete) the auto-generated shortcuts, then manually create them after the application is installed. To create these navigate to the application folder, right click the app, and create shortcut. The shortcut can then be moved to the desktop and will work as intended.
BTW - The same error message is raised when launching the app via the Windows 10 Start Menu. Still looking into whether there is a work around for this as well (other than not using/referring to the desktop shortcut only).

2 Comments

We are getting the same error when running on a VM, even if we directly double-click on the executable. Works fine from laptop. Following with great interest.
is there a way to get rid of the option to creat a shortcut on the desktop wheninstalling the exe to prevent this?

Sign in to comment.

Categories

Asked:

on 11 Aug 2014

Commented:

on 30 Jun 2022

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!