To package an .air file into a native installer you have to use a batch program called adt.
The command on Windows will look something like this:
C:\Users\jisaacks>"C:\Program Files
(x86)\Adobe\Adobe Flash Builder
4\sdks\4.1.0\bin\adt" -package -target
native "D:\DEV\Flex4\Workspaces\AIR
Native Packager\AIRNIP\AIRNIP.exe"
"D:\DEV\Flex4\Workspaces\AIR Native
Packager\AIRNIP\AIRNIP.air"
I am trying to author a program in AIR that does this for you. Basically you drag/drop an .air file into it and it packages it into a native installer.
Well It gave me an Error #3219 error, which I looked up and found this:
AIR on Windows does not allow you to
run .bat files directly. Windows .bat
files are executed by the command
interpreter application (cmd.exe).
When you invoke a .bat file, this
command application can interpret
arguments passed to the command as
additional applications to launch. A
malicious injection of extra
characters in the argument string
could cause cmd.exe to execute a
harmful or insecure application. For
example, without proper data
validation, your AIR application may
call myBat.bat myArguments
c:/evil.exe. The command application
would launch the evil.exe application
in addition to running your batch
file.
If you call the start() method with a
.bat file, the NativeProcess object
throws an exception. The message
property of the Error object contains
the string "Error #3219: The
NativeProcess could not be started."
I am wondering if there is a possible work around or if I have hit a brick wall?
I believe you have hit a brick wall, at least with trying to do this in Adobe Air. Executing batch files can be a huge security hole, as your post claimed.
Are you trying to do this in Air for portability, or would you be able to use some other language?
I suggest trying to code this in python. Using the subprocesslibrary can help a lot.
http://docs.python.org/release/2.5.2/lib/module-subprocess.html
Serge Jespers (Adobe Evangelist) (http://www.webkitchen.be/) has done exactly this,
I think you should try to contact him for the details.
I helped him build a first solution by creating a windows executable which executed any bat file you specified, later he changed it by calling the java application (adt) directly which works fine as well.
He'll be very happy to help you.
UPDATE:
You can download the Package Assitant Pro right here: http://www.webkitchen.be/package-assistant-pro/
Related
I am just started exploring codelite. I have written a sample program hello.c to create a window and it will display "Hello World". Executable hello.exe is available under Debug directory. When i execute that from my system its working fine.
I have copied the hello.exe to my other system and tried to execute from there and i got error message "The Application was unable to start correctly. Clock OK to close the application".
Is it not possible to run the executable created in one PC to other PC? Do i need to any specific option during compilation?
Also i have installed MingW 64 bit and GTK 3.6.4 in the PC.
You are missing some information in your report, for example: when the error dialog was shown, did it say which error code or why it failed to launch?
Did you try using dependency walker to check whether you are missing some DLLs that exist on your computer but not on the other PC?
If you are building using a MinGW-64, then try to use dependency walker for 64 bit applications to see which DLLs are missing
I understood that anything to standard out (System.out) would appear in the Java Console window (when it's enabled). I spotted somewhere though that there might be situations where this isn't try, for example, from Swing apps. Is that the case?
Basically, what situations or setups wouldn't I expect to see standard output in the console? Is there a difference in behavior running on the JDK rather than explicitly on the JRE for example? javaw.exe?
ps, I understand how to display the Console in the Java settings but I'm curious as I've managed to create an application, run as an executable jar, that doesn't start the console despite some calls to System.out) on Windows 7.
The only way you wouldn't see System.out output in the console is if the method System.setOut has been invoked. This method is invoked to redirect output to the graphical Java Console, but I don't know of any other realistic circumstance in which it would be redirected away from the Java Console unless you do so voluntarily.
Depending on terminal settings it can happen that the output is not written until a newline character is sent as well. So if you do System.out.print("test") it might not appear immediately.
On Windows this is usually not the case, but on Unix terminals this is quite common.
Perhaps you use javaw to start virtual machine, this version will not show console messages. You can use java to start the virtual machine, which will show the console message.
javaw is intended for apps with windows, java is intended for console apps.
Same thing happened to me. I could not get System.out.println or Logger.debug either on console.
If you are on a huge project in Eclipse or whatever, you can read below.
Solution: I realized that I had not committed jars and some java files to SubVersioN on network. thats all. Project had not been compiled.
One situation I can think of is to invoke System.setOut(null) (orSystem.setOut(any OutputStream other than System.out or System.err)) then the console, if exists, would show nothing.
I would like to know the LOCATION of the .exe in the JDK that opens .jar files. What I mean is this: Which .exe in C:\Program Files\Java\jdk*version number*\jre\ opens the .jar files, so that they can be opened using a double click? I used to be able to do that, when I newly installed the JDK+JRE. Unfortunately, Nokia PC Suite has made itself the default program for opening .jar files, so that it can install them on my Symbian. Which program do I 'Open With' to get back the old functionality? I already know how to do it from the command line, but this is easier.
There is no specific program to run jar files.
It is java.exe only with the -jar option
For eg.--> java -jar "foo.jar"
Right Click on a jar file and go to its properties. Change the default opening program to java.exe.
I hope that should work.
use javaw.exe if you don't want the command window.
This convention is widely followed by others like perl/python/ruby as well.
I know how frustrating this issue is. I looked all over the internet forums before I finally found the problem...Here is the answer below :
"The root cause for the problem above is, that a program has stolen the .jar association. If you have installed the Java Runtime Environment the first time, the file type called "jar" is assigned to javaw.exe correctly. "jar" is an abbreviation for "java archive" and javaw.exe is the correct program to execute a .jar. However, on Windows any program can steal a file type at any time even if it is already associated with a program. Many zip/unzip programs prefer to do this, because a jar is stored in the .zip format. If you doubleclick on a .jar, your pack program opens the file, rather than javaw runs the program, because your pack program ignores the meta information which are also stored in a .jar."
I am not able to run the application the Qt creator. It complains the following error:
Cannot execute '': The requested operation requires elevation
My .exe file has a Windows administrator shield symbol on it. Do I need to make a project settings changes? I am extensively using Qt File library for doing some file operations.
What's your executable's file name? Without an embedded manifest, windows tries to be smart and wants to run executables with "install", "update", "setup", "patch", etc. in the file name as administrator. It even checks for those names within words such as "autoupdate".
The problem is that qmake/mingw doesn't embed those manifests, while MSVC does. If someone has a clean solution to that problem, I'd be interested to learn about it.
If application you develop require administrator privileges, you cannot simply run it from Qt creator, started under non privileged account.
You can run your Qt creator as Administrtor.
Or you can start your application from QtCreator using runas utility.
But in this case you would not be able to see debug output in QtCreator console window and debug application.
If the name of the exe file has some words (update, patch, ...), the Windows UAC ask for admin privilegies. The only solution is that the project generates an exe without these words.
See this: Qt Creator create exes with admin privilegies
I need any tool or IDE environment to debug and test the vb scripts code. Please suggest any free ones. My vb scripts are standalone (vbs extenstion).
VBSEdit
Not free, but has an unlimited trial period with a nag screen.
Sadly not free....How to debug Windows Script Host, VBScript, and JScript files
I think you'll have a hard time finding a free tool that supports real VBS debugging. But I've used this "poor man's technique" in the past. Create a variable at the beginning of your script
blnDebug=False
Then throughout your script add lines to echo what the script is doing or the value of different variables:
if blnDebug Then wscript.echo "Now starting script strFoo=" & strFoo
When you set blnDebug=True then all your debug messages will be written to the console (I always use CScript when running this). By adding these debug messages as you write your script, you can have debugging available simply by changing the bldDebug value.
Certainly commercial editors like PrimalScript include a debugger. SAPIEN also has a standalone debugger, http://www.primalscope.com/, that while not free is a relatively inexpensive option. You can download an eval copy to try it out.
There is a really old tool called Script Debugger for Windows NT 4.0 and Later. It is designed for VBScripts running in web pages but you can attach it to a vbs script easy enough.
You can download it from here:
http://www.microsoft.com/downloads/details.aspx?FamilyID=2f465be0-94fd-4569-b3c4-dffdf19ccd99&displaylang=en
The name says NT 4.0 I know but I am currently running it on Windows 7 x64 and hod no problems opening the debugger.
Simply install the above tool then run your script from the commandline like:
wscript.exe myscript.vbs //d //x
Once the debugger opens you can step through code and even open a command window where you can check variable values by typeing ? Varname.