The Security Sandbox on Flex won't allow you to use Java without a server. In fact you can't access any code on your computer with Flex unless it is via a service. AIR 2.0 will allow native operating system applications. This is a new feature coming out because AIR 1.5 can't either.
You'll need a server or you'll need to port over the code to work in ActionScript, assuming the functionality you are using in Java is even achievable in ActionScript.
JavaApplet JS communication
Flex JS communication
I hope this helps!
J. Phillip Camp
Thanks a lot for your valuable reply..Actually I have a basic knowledge about flex.So please answer to my following doubts..
1)Actually what does "AIR" mean (I have heard about this whenever I searched for Desktop application using flex) ?
2)You mean current version of AIR doesnt support this feature like Swing ?
3)"AIR 2.0 will allow native operating system applications." means AIR 2(future release) will make flex possible to connect Java without application servers ?
1) AIR is the Adobe Integrated Runtime. when you create a new project in Flex you can select a Flex application or an AIR desktop application. The Adobe integrated runtime is a separate runtime environment for Flex that provides desktop and file system integration like the JVM. Flex applications run in the browser, air applications run in the AIR environment. AIR provides hooks into the file system so you can read and write files, but not execute. and you only have a small file system area to write to. You cannot write to any directory you want.
2) The current version of AIR does not support native file system integration so you would not be able to make AIR communicate with anything outside of the application unless you used services. AIR 2.0 supports this and is coming out soon (beta is already out)
3)Yes. AIR 2.0 will allow you to execute applications such as java, exe, dmg, etc.
Thank you..valuable info...So using AIR 2.0,we can invoke the methods in a java class without any application servers.Can I conclude this discussion with this knowledge..?
You could also use sockets. Write a Java app that is executed on the background and make the Flex/AIR app connect to it and exchange data. For this you would need to think of your own protocol for the data exchange.
P.S. It would be really nice to if it would be possible to make Java RMI calls directly from Flex/AIR. Anyone got any ideas whether this even could be achieved? I don't mean now, but whether it is even technically possible to implement such a feature to AIR.