Tuesday, November 27, 2007

Java To AS3 on AIR


Found this great project that enables me to convert Java code to ActionScript3 code, or at least get me close enough that I can do minor manual tweaks to get code to compile (granted that compiled code does not mean that it runs :-). However, in its current format, it was a laborious process as I can only process one file at the time, and had to copy and paste the generated code from the text area into a file. There must be a better way ! And yes there is a better way using Adobe AIR. AIR enables me to read from and write to the local file system. So, I took the core Converter class and wrapped it with the AIR File api.
A user can now select the output folder and upon the selection of the input folder, all the java files will be read, converted and written to the output folder. In addition, you can drag and drop onto the output or input button the output or input folder.
Download the AIR file from here. BTW - this is using the latest beta3 version :-)

14 comments:

Unknown said...

After selecting an output folder the input folder is still grayed out and I cannot select an input folder.

thunderhead said...

Updates the code to use the latest beta3 and you can drag and drop the input and output folder.

Paul Bohnenkamp said...

After adding a top level input dir, it doesn't look like it handles recusing through the package heirarchy (all the dirs) looking for java files & building the dir strcuture in the output dir.

So, could I get the source from you so I could mod it to do above?

Timothy Huertas said...

Thanks for the hook up. The AIR app saved me some time.

thunderhead said...

You can download the source code from http://thunderhead.esri.com/readonlyurl/J2AS3.zip

Unknown said...

hi,

i found a bug in the J2AS3-Code ...
i posted a comment describing a workaround at http://www.physicsdev.com/blog/?p=14#comments ...

thunderhead said...

Ah...the joy of open source - 10,000 eyes on your code :-) Thanks, code is patched and updated.

Unknown said...

Hi, i just downloaded/installed Adobe Air installer and clicked your app file but gave me the error below:
"This application requires a version of Adobe AIR which is no longer supported. Please contact the application author for an updated version."
it said, so i am contacting :)

mijael said...

I have the same error than kadir...

I installed AIR and when I try to run the application it appears a pop saying to contact the creator because a problem occurs.

thunderhead said...

Ok gang - sorry for the delay - I've updated the air application to the latest air version.

Mike Sickler said...

Beautiful! This is really just what I was looking for. Cheers!

Mike Sickler said...
This comment has been removed by the author.
David said...

This is cool, but I'm having trouble getting it to work. I've selected an input directory, and an output directory, but all of the output files are 0kb. Does this mean that it silently failed?

David said...

Nevermind, my bad, I'm not a Java programmer, so I mistakenly thought I could use this on *.class files, which are of course already compiled. Oops. Need to decompile first.