Error: Error #3219: The NativeProcess could not be started. ‘launch path not accessible’

Error #3219: The NativeProcess could not be started. ‘not supported in current profile.’
Error #3219: The NativeProcess could not be started. ‘launch path not accessible.’

1. Cause
You are calling a native process but haven’t specified that your AIR application has support to do so.

1. Solution
In the AIR descriptor file you need to specify an extendedDesktop profile like so:

<supportedProfiles>extendedDesktop desktop</supportedProfiles>

Note that the extendedDesktop must be ordered first.

2. Cause
When ‘launch path not accessible.’ the file may not be executable source.

Files have read, write and execute permissions that are used by the host operating system. In general and basically, if you were to double click on the file and the file did not have permission to execute then the operating system would attempt to open the file with the default application for that file type (we’ve all seen that). If the file does have the permission to run and if is an executable file (like exe, bat, sh, etc) then it will run with the program designated to handle running files with that file type. Source

2. Solution
Check the permissions on the file. The file should have execute permissions. Usually you can right click on the file and change these options. Use with caution.

3. Cause
When you get the launch path is not accessible error it may be that the file you are executing does not have a required argument so the executable doesn’t find the path to that file and the error bubbles up.

3. Solution
Verify the location of the file (example below) and pass in the correct path to the file making sure the other conditions are met.

The following shows how to launch a script located in the root of the AIR application directory:

var nativeProcessStartupInfo:NativeProcessStartupInfo = new NativeProcessStartupInfo();
var file:File = File.applicationDirectory.resolvePath("/usr/bin/osascript");
// "usr/bin/osascript" 
// ArgumentError: Error #3214: NativeProcessStartupInfo.executable does not specify a valid executable file.
// verify file location:
// var scriptFile:File = File.applicationDirectory.resolvePath("closeAllWindows.scpt");
var processArgs:Vector.<String>;

nativeProcessStartupInfo.executable = file;
nativeProcessStartupInfo.workingDirectory = File.applicationDirectory;

processArgs = new Vector.<String>();
processArgs[0] = "myscript.scpt";

nativeProcessStartupInfo.arguments = processArgs;

process = new NativeProcess();
process.start(nativeProcessStartupInfo);

About Judah

Please note in the comments if this has helped you or not.
This entry was posted in AIR, Runtime. Bookmark the permalink.

4 Responses to Error: Error #3219: The NativeProcess could not be started. ‘launch path not accessible’

  1. SourceSkyBoxer says:

    Hello, Judah,

    i have tried workingDirectory from nativeprocessStartInfo because i am using Windows 8 but. it can noz work. If i use example C:\Windows\System32\reg.exe than Application Air would like to get output with Application Air into Run-as-Admin right-used Application Air.

    Why does it not work like your File.applicationDirectory.resolvePath(“/usr/bin/osascript”); for Mac OS X.

    But Windows 8 can’t get back directory like ” C:\” not C:\Program Files (x86)\MyAppAir\.
    File.applicationDirectory.reslovePath(“C:\\Windows\\System32\\reg.exe”);

    But i would like to leave for process by Application Air. App Air would like put and save reg value and reg key by Application Air’s Root Directory Example: C:\Program Files (x86)\TestAdminAir\TestAdminAir.exe was changed into administrativ by Process like this reg add ….

    I can’t understand because my Application Air won’t work?

    <?xml version="1.0" encoding="utf-8"?>
    <s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009" 
    					   xmlns:s="library://ns.adobe.com/flex/spark" 
    					   xmlns:mx="library://ns.adobe.com/flex/mx" creationComplete="appInit(event)">
    	<fx:Script>
    		<![CDATA[
    			import adobe.utils.ProductManager;
    			
    			import flash.desktop.NativeApplication;
    			
    			import mx.controls.Alert;
    			import mx.core.FlexGlobals;
    			import mx.events.FlexEvent;
    			
    			import spark.components.WindowedApplication;
    			
    			private var appDir:File = File.applicationDirectory.resolvePath(File.applicationDirectory.name);
    			private var appType:String = ".exe";
    			
    			private static var _isAdmin:Boolean;
    			
    			protected function skipAdmin():void
    			{
    				show_text.text = "Yeah, Air Application run as admin.";
    					
    				var file:File = new File(appDir+"\\testfile.txt");
    				
    				var stream:FileStream = new FileStream();
    				stream.open(file, FileMode.WRITE);
    				stream.writeUTFBytes("my string to save");
    				stream.close();
    				
    				Alert.show(file.nativePath);
    			}
    			
    			protected function restart():void
    			{
    				var npStartInfo_restart:NativeProcessStartupInfo = new NativeProcessStartupInfo();
    				npStartInfo_restart.executable = appDir;
    				npStartInfo_restart.workingDirectory = File.applicationDirectory;
    				
    				var process_restart:NativeProcess = new NativeProcess();
    				process_restart.start(npStartInfo_restart);
    				
    				var app:WindowedApplication = WindowedApplication(FlexGlobals.topLevelApplication)
    				app.close();
    				/*
    				var app:WindowedApplication = WindowedApplication(FlexGlobals.topLevelApplication);
    				var mgr:ProductManager = new ProductManager("airappinstaller");
    				mgr.launch("-launch "+app.nativeApplication.applicationID+" "+app.nativeApplication.publisherID);
    				app.close();*/
    			}
    			
    			
    			protected function appInit(event:FlexEvent):void
    			{
    				// 
    				appType = appDir.extension;
    			}
    			
    			protected function AccessClick(event:MouseEvent):void
    			{
    				if(NativeProcess.isSupported){
    					show_text.text = "Yeah Native Process started...";
    				}
    				var npStartInfo:NativeProcessStartupInfo = new NativeProcessStartupInfo();
    				var regCommand:File = File.applicationDirectory.resolvePath("C:\\Windows\\System32\\reg.exe");
    				npStartInfo.executable = regCommand;
    				npStartInfo.workingDirectory = File.applicationDirectory;
    				
    				var regKeyDir:String = "\""+"HKCU\\Software\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers"+"\"";
    				var args:Vector.<String> = new Vector.<String>();
    				args[0] = " ADD"+ regKeyDir + " /v "+"\"" + appDir + "\"" + " /t REG_SZ /d RUNASADMIN";
    				npStartInfo.arguments = args;
    				
    				var np:NativeProcess = new NativeProcess();
    				np.start(npStartInfo);
    				
    				restart();
    			}
    			
    		]]>
    	</fx:Script>
    	<s:Label id="show_text" left="10" top="10" text="Beschriftung"/>
    	<s:Button id="accessBtn" left="10" top="30" label="Run as Admin" click="AccessClick(event)"/>
    </s:WindowedApplication>
    
  2. Judah says:

    Hi SourceSkyBoxer,

    It sounds like you are trying to add an entry into the Windows Registry, correct? And it sounds like you may also be having an issue running your app as admin, correct? And it also sounds like you may be having an issue running reg.exe or passing arguments to reg.exe, correct?

    I’ll try and answer each as I can. Are you able to find and run reg.exe (with or without errors)? If you can’t find it then you must find the path to that file first. Otherwise, nothing else will work. If you are able to find reg.exe then what is the error that happens when you run it? What is the argument “REG_SV” in this line:

    ” ADD”+ regKeyDir + ” /v “+”\”” + appDir + “\”” + ” /t REG_SZ /d RUNASADMIN”;

    Check to make sure the command runs correctly on the command line and if you’d like paste that full command here. Trace the arguments after you set them to see how it looks. Compare that to the working command line code.

    Next I see the usage of the File.applicationDirectory. This is a very limited directory. In almost all cases you cannot read or write files in this directory. For example, in mobile AIR has these restrictions. Windows 8 may have added security measures on this directory as well. If that is the case the only way to access content from it is to copy that content out of it into another directory. You can typically copy your files to the applicationStorageDirectory and read and write there.

    BTW Thank you for providing the code. Unfortunately, I don’t have Windows 8 so I’m not able to test it. Let me know how it goes. If none of the above solves the issue you may post this to Stack Overflow and others who have Windows 8 can test it for you.

  3. SourceSkyBoxer says:

    Hey @Judah ,

    Thank you for answer!
    But i have seen because Adobe Air 3.5 can’t work under access right. I am trying. But Adobe AIr 3.5 won’t to work yet. :( That is very bad.

    I know nativeprocess and nativeprocessstartinfo for Mac OS X and Linux because they are very simple root-right like administrative mode.

    Example for Linux: like Ubuntu 12.04:
    File.applicationDirectory.resloveePath(“/usr/bin/gksudo”); for Gnome Desktop
    File.applicationDirectory.reslovePath(“/usr/bin/kdesudo”); for KDE Desktop.

    And for Mac OS X:
    File.applicationDirectory.reslovePath(“/System/Library/CoreApplications/loginWindow.app/Contents/MacOS/LoginWindow”); <- Is it not sure.. But i don't know because i have few experience for Mac OS X. Sorry. Because i have got Mac OS X DVD and have installed into VirtualBox :o I am sorry because i don't like install for Hackintoch. No But my Mac OS X DVD was original from Apple Inc.

    And i have won about access right under MDM Zinc Application. It is very simpler than Adobe Air 3.5:

    Look at simple Zinc Application Forum. It has support under Mac OS X too
    http://www.mdmforum.com/forum/index.php?showtopic=29525&view=findpost&p=125865

    And i have tested MDM Zinc Application under Windows 7 / 8. That is very nice like adding reg-key and reg-value.

    Youtube Video: http://www.youtube.com/watch?feature=player_detailpage&v=ayu6YorwgwE&list=LLKcl_HFFoTLKMbFmZLCujPw

    Thank you for help. I am sorry because i have bit of grammar problem or worng spelling :o. Because i am deaf. :( and i come from Germany ( Europe Union ).

    Thanks for answer :)

Leave a Reply

Your email address will not be published. Required fields are marked *

Highlight your code before posting code:

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="">