Home  >  

Java to ActionScript Converter, Take 3

Author photo
| | Comments (4)
AddThis Social Bookmark Button

I needed to estimate the effort required to port a Spring Rich Client application to AIR. Spring RCP applications are actually Java Swing applications. The project had 93 Java files, consisting of 118 Java classes and 16,950 total lines of Java code.

I thought it would be helpful to begin by converting Java syntax to ActionScript syntax, then change the parts that don't make sense in ActionScript. The Java Swing application I needed to port had many similarities to the structure of a Flex application.

I looked around and found two Java to ActionScript converters:

  1. J2AS was written as an Eclipse plug-in, but has not been maintained.
  2. J2AS3 was first written as a Flex program, then moved to AIR. It seemed like a better way to go for my needs.

You can download J2AS3 from http://code.google.com/p/j2as3. Although I improved the program, it is still fairly raw. Interested in improving the converter? Go for it!

j2as3.png

_______________________________

Mike Slinn
Independent full-service software contractor and author
http://slinnbooks.com
http://mslinn.com

Read more from Mike Slinn. Mike Slinn's Atom feed mslinn on Twitter

Comments

4 Comments

David said:

You did not tell us what was your effort estimation. Did you successfully convert all that Java code to ActionScript? Does it really work, Mike?

I have a Swing app written 2.5 years ago which actually does what an AIR app should do - a file browser & files modifications + local DB + uploads to multiple web sites. I wold love to know if it can be a real deal porting it to AIR.
From the other hand, I definitely do not want to lose the richness and openness of the Java source code world. So many things exist as free open source libraries!

Does all that Alchemy magic really works now? Can I right away communicate with a C library from AIR app or it is still under development? Can I communicate with a Java code, e.g. call some functions from a jar? What is XML and/or XML PRC support in AIR?
Is there any good repository of open source AIR projects?

Mike Slinn said:

Yes, this really works. Remember, this is a syntactic conversion only. There is no magic. Here is some additional information: http://www.mslinn.com/blog/?tag=flex-air

ActionScript clients can do everything you describe. XML support in particular is excellent, because of E4X. Many open source Flex projects exist; I am involved with several.

Flex applications run inside a sandbox, and Adobe in their wisdom has chosen not to allow Flex to be linkable with other languages. This is perhaps the single most requested feature for Flex, but decision makers at Adobe do not seem to understand how many potential use cases are negatively impacted by this decision.

Sounds like you are just getting started with Flex. Porting code from one programming environment to another is an advanced topic, and should only be done by someone who is expert with both Java and ActionScript. I was brought into this project because the client did not have in-house capability.

Peter said:

Interesting post.
Why did you move away from Spring Rich Client?

Regards,
Peter.

Manoj said:

Hi mike,

You said J2AS3 converts java to ActionScript3 only the syntax, how to convert methods which are not there in Action Script. Is there any way to convert an applet into Actionscript3.

Leave a comment


Tag Cloud

Poll: Mobile Features

What feature do you use most on your mobile phone?

Vote | View Poll Results | Read Related Blog Entry

Latest Features

Recommended for You

@InsideRIA on Twitter

Archives

  • Or, visit our complete archive.  

About This Site

Welcome to the premiere community site for all things RIA sponsored by O'Reilly Media and Adobe Systems Incorporated.