Matlab compiled jar cannot run with task scheduler but can run manually
1 view (last 30 days)
I have some matlab-code, which included as jar-File (created with matlab compiler sdk) in a java-application. If I start my java-application manually using a bat-file everything works. But if I start the same bat-file using the windows task scheduler the matlab-code cannot be executed. (The other parts of the java-application work in both cases)
... Matlab M-code Stack Trace ...
com.mathworks.toolbox.javabuilder.MWException: An error occurred while initializing the component.
Could not access the MATLAB Runtime component cache. Details: Some error has occurred in the file: b:\matlab\standalone\mclmcr\mcr_cache\mclcomponentcache.cpp, at line: 250.
The error message is:
Failed to completely extract component!
at com.mathworks.toolbox.javabuilder.internal.MWMCR.mclInitializeComponentInstance(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at com.sun.proxy.$Proxy79.mclInitializeComponentInstance(Unknown Source)
I also don't understand why it's accessing drive B. The file and the matlab runtime installation is located on drive C.
Things I already checked:
- Path variable of the matlab runtine installation
- Check the cache files (https://de.mathworks.com/matlabcentral/answers/33638-could-not-access-the-mcr-component-cache-error)
- Setting an env-variable MCR_ROOT_CACHE to a temp-folder (didn't found the link again)
- I tried to compile with -C but it fails:Packaging...Creating the bundle...Failed to create the install bundle[...]\for_testing\de.ctf (The system cannot find the file specified)
- Matlab 2016b
- Java 8
- win server 2012 (64bit)
Would be great, if someone give me a hint. Thanks, Thomas
Prannay Jain on 6 Apr 2017
I am not sure what might be the issue, but there are few things you might try:
1) It may be a permission issue. Make sure that you have the right permissions to access MCR cache folder. Can you try changing MCR_CACHE_ROOT to some other folder and see if it makes any difference.
2) Is your application accessed/shared by multiple users? (Again look for the permissions for all the users even within your system.)
3) Did you correctly provide 'start-in' directory while creating the task? This discussion might be helpful: http://stackoverflow.com/questions/1020023/specifying-start-in-directory-in-schtasks-command-in-windows