How to ensure that paths for executables are added to path for Adobe AIR application? - actionscript-3

I wok on desktop Adobe AIR application. It creates .DMG for mac os builds. It is actually command line application. What I want is the ability to call it from command line - add it .../*.app/Content/MacOS to $PATH. Is there any standard way to do it with AIR ? I need it to work on Windows as well.
Thanks!

No standard way, that's for sure. It's out of scope of AIR. You probably should do that with the shell - something like SET %PATH% = %PATH% + ... Assuming your AIR application has access to shell interpreter, it can do it on first run right after install.

Related

how to make executable for mac and ubuntu in libgdx

I've never made a program into an executable for mac or ubuntu , and I've been looking into how to do this for some time now but didn`t got any results. I have been able to build my game for android, ios, windows(.exe) but dont have any idea about mac osx(.app file) or ubuntu (.deb file ).
If you're using eclipse, you could just export as a cross-platform jar (which would then work for mac, linux and windows)
Eclipse makes that really easy: File -> Export ... -> Java -> Runnable Jar File. There may be additional steps required to include assets like your app's images and sounds into this .jar file.
Btw, how did you turn it into a windows exe anyway?

How to bundle jre with .exe file created from .jar

I created .exe file from .jar file .Now my client demands to run the application without installing jre in the sytem.I have heard that with bundled jre it is possible ...but i dont know how to bundle jre with .exe file..
The JavaFX is working on this. Here are the up-coming features in Java SE 7 u10:
https://blogs.oracle.com/talkingjavadeployment/entry/packaging_improvements_in_jdk_7#3
https://blogs.oracle.com/talkingjavadeployment/entry/packaging_improvements_in_jdk_7
I have used VMware ThinApp to do exactly what you are trying to do. It does cost money, but works extremely well. It allows you to roll up all the dependencies your application uses into a single executable that can then run on vanilla installations of Windows. It can be used for a lot more than just Java, and it does so by recording the changes you make to a system after installing your application + the JRE for example, and then wraps up all of those changes. It certainly simplifies application deployment, since the applications are now portable. I've even used it to roll up Visual C++ redistributables, and .NET as well. This certainly increases the size of the executable, but it's also convenient knowing the application will run successfully. See more info at http://www.vmware.com/products/thinapp/overview.html.
The open source Launch4j allows you to produce an exe with an embedded JRE. This SO article also discusses this topic. Caveat: I've had very good success with Launch4j, but never used the embedded JRE feature.

Package Adobe Air to Exe

Using Flash Builder 4.6, I exported an Adobe Air file from my mobile project.
I'm trying to get it packaged into an EXE (that would include the Adobe Air Runtime)
The project was compiled with Air 3.1. I looked online and there are some ADT commands that people recommend using but the problem is that the command throws errors in Air 3.1
If i use air 3.0 ADT:
AIR file at [app path]/app.air could not be converted.
The error was ""
If I use air 3.1 or air 3.2 sdk
SDK is missing file [my path to air]\lib\nai\bin\naip.exe
I'm running
java -jar [path to air]\lib\adt.jar" -package -target native app.dmg app.air
I've also tried
java -jar [path to air]\lib\adt.jar" -package -target native app.exe app.air
I've also looked into projects like this one: http://bishoponvsto.wordpress.com/2010/02/23/adobe-air-2beta-2-to-exe-packaging-air-app-in-windows-executable/ , but it is for Air 2.0.
Any ideas? Apparently there is an integrated Flash Builder 4.6 tool, but for some reason the option under export release doesn't exist for mobile projects - strange...
Why do you want to do this? Air files -- when exported for a specific platform -- are executables.
If you are looking for an "installer" that will create directories, run the Air installation, and move auxiliary files to specific locations (docs, icons, etc.), then try Inno Setup.
EDIT:
The code you provided works for me to create a Windows EXE. But it seems a bit unecessary . . . why not just export the EXE file from Flash Builder ("Export Release Build" button in the top toolbar)? If you can't or won't, then here are some suggestions:
I am using Java version 1.6.0_29. Make sure your Java is not only up to date, but that you are actually calling the correct version (java -version).
Check the JAR directory text carefully .
Check that you are actually calling to the right Air version.
Make sure that the quotation marks are on both sides of the JAR path.
You should be able to do a "Export Release Build" (though I am using FB 4.5). Instead of selecting "Export as: Signed packages for each target platform", select "Export as: Signed AIR packages for installation on the desktop". (You may have to create a certificate, but you can create one through this export feature, too.)
(If you happen to be able to use the Flash IDE, the exported Air file has to support both "Desktop" and "Extended Desktop".)
Hopefully, this will allow you to both produce an Air program that can be converted to EXE, and actually convert it using the command line.
I know this question is a little old, but a co-worker just ran into the same error message using the command line tools and FlashDevelop. It turns out that he was accidentally packaging some source files into the .air package, an extra copy of the app descriptor and one of the swc's was getting packaged in the .air file. I removed those and repackaged the .air file, then used this command:
adt.bat -package -target bundle kiosk kiosk.air
This successfully created a captive runtime exe. Of course there's no need to create a .air file first, you can package right to native or captive runtime, but since my co-worker was creating .air files I did it that way too just to be sure it would work.

How to create updater for AIR application bundled with captive runtime?

What would be the logic of updating mechanism for AIR application with captive runtime?
Application should be distributed for Windows and Mac.
I got stuck here:
Note that this does not necessarily mean that you need to implement your own auto-update mechanism. If you use a commercial tool to create your installer, it may include auto-update mechanisms that you can leverage. On the other hand, if you do need to write your own update mechanism, you should find the URLStream, File, and NativeProcess APIs handy in implementation.
after reading it at: http://www.adobe.com/devnet/air/articles/air3-install-and-deployment-options.html
Is it something like (for Windows, after app is installed with some .exe or .msi installer):
upon starting app, check for new version
if there is new version, download it
overwrite existing app files and AIR runtime files
It should be forced update, before starting app.
How to overwrite running app? Or to make another app (updater) for replacing files, and after that start main app with NativeProcess?
For Windows I use the Native Application Updater
http://code.google.com/p/nativeapplicationupdater/
and WinRAR SFX archive (.exe) to auto update my captive runtime apps.
Native Application Updater will check the version, download your new exe, close your app and run that new exe.
In the SFX options:
I use absolute path, something like: %USERPROFILE%\AppData\Local\com\thenewkid\appname\
Under "Modes" you can select "Hide All" in Silent Mode. Under "Setup" you get it to run your application.exe after extraction.
You can keep the update size low by removing the Adobe AIR folder until a new version of the SDK becomes available (i.e. just had to push a larger update out recently for 3.3)
For MAC I use Installer. It isn't as silent as the Windows Updater as the user will have to click through a couple installer prompts but it allows you to put it in their home directory so administrative privileged aren't required which is what I find the most useful aspect of captive runtime.
Basically, you should have your app point to some XML file on your server which will contain things like newest version number, path to new files on server etc.
You can use a separate app to do the restart but keep in mind that since you are using Captive Runtime this will mean another 40-60MB just for the updater (unless you use some non-recommended hacks).
It would probably be better to just prompt the user to restart after you download the update.
The trick is not to overwrite the EXE but instead to overwrite the SWF (and any other files that need updating). From what I can tell, the EXE is simply a pointer to the XML manifest and the SWF.
You should not be updating AIR runtimes file every time - only for critical updates (since they are large files).
For the restarting of AIR in captive runtime this works for me on Mac (have not checked for Windows yet) (Note: UpdateAutoTest was the name of my app):
var appLauncher:File;
appLauncher = new File(File.applicationDirectory.nativePath).parent.parent.resolvePath("Contents").resolvePath("MacOS").resolvePath("AutoUpdateTest");
var npInfo:NativeProcessStartupInfo = new NativeProcessStartupInfo;
npInfo.executable = appLauncher;
var _args:Vector.<String> = new Vector.<String>;
//_args.push("-a");
//_args.push();
npInfo.arguments = _args;
var np:NativeProcess = new NativeProcess;
np.addEventListener(NativeProcessExitEvent.EXIT, npExitHandler);
np.start(npInfo);
exit();
There is no need to overwrite. Have the user download your new package and launch it. AIR will know that package is already installed as a previous version and will prompt the user if he wants to update.
So the workflow is : check if there is a newer package, alert the user there is one, have him download and launch it. Air will manage the updating.

Run AIR app without AIR runtime files

I've made an AIR app with Flash Builder 4. Works great but I want to run the app without installing it. So..... when I install the app, I copy the files from program files and paste it on a CD and give it to somebody. He runs it on another computer without AIR runtime with as result that it doesn't work.
How can I bypass this? Like some launcher/setup that installs AIR runtime for the client if it aint installed. If it is installed, run the AIR app.
Thanks.
Creating an AIR Badge would be a good option.
The idea is you pass a link to the client, the AIR Badge check if
AIR is installed. If it is, installs your app, otherwise installs AIR
first.
There's a pretty good AIR Badger tutorial on the Adobe Developer Connection site. AIR Badger is an AIR App Grant Skinner wrote to make the setup easier.
Also check out the new AIR Launchpad, which is another AIR app that helps you get started with all sort of AIR related functions, including install badge.
Unfortunately the AIR Badger works online.
You cannot bypass AIR install. Maybe have a third party utility(batch script/etc.) that looks for air related files/.air filetype associations and based on that launches an AIR installer you supply on CD or the app itself.
On osx you have the mdls command that displays information about a file. You could check for kMDItemKind:
mdls -name kMDItemKind /path/to/yourApp.air
If it prints "com.adobe.air.InstallerPackage", then air should be installed, otherwise it will just print "Document".
There should be something similar for windows command prompt that checks registry file type associations.
After you've done that check, install AIR first or just the app, depending on the result.
HTH