5 Replies Latest reply on Sep 5, 2008 2:22 PM by greg h_

    Flex and Java

    sri harsha namala Level 2
      Hi EveryOne,

      I want to know one thing about flex and java, Is there any way to communicate with java without using server?? If There is any way please let me know.

      Thanks in advance.
        • 1. Re: Flex and Java
          greg h_ Level 1
          Hi namala,

          Flex apps can be built to target either the Flash Player (generally run inside a browser), or the Adobe AIR runtime (installs as a native app on Windows, Mac and Linux today).

          There is an open source AIR-to-Java Bridge project called Merapi. Details here:
          http://www.merapiproject.net/

          If Merapi does not address your requirement, can you provide us more details about what you requirement is? For instance what is it that you need to do when you write "Is there any way to communicate with java without using server??"

          Please post back regarding whether the above answers your question, and if you find it helpful :-)

          Best regards,

          g
          • 2. Re: Flex and Java
            sri harsha namala Level 2
            Hi

            Thanks for the reply, My requirement is so simple ,i will generate some values inside the java (Servlet ) and i will return that values to the flex application and i will plot them using charts.

            Do u have any idea??
            • 3. Re: Flex and Java
              SujitG Level 2
              Hi,

              If you are using a servlet to perform the logic, then you need a servlet container to invoke the servlet and pass on the arguments required. If you definitely need a servlet for your computation logic to work, you might have to use the server servlet based web server.

              If you can manage to get your logic to work with out a servlet you can user a normal POJO and consider Merapi as Greg suggested.

              Hope this helps.
              • 4. Re: Flex and Java
                wyattbiker Level 1
                Have you thought of using sockets?
                • 5. Re: Flex and Java
                  greg h_ Level 1
                  Great thought wyattbiker!

                  Link here to a related post (with code) from Thomas of lessrain.com:

                  AS3 + Java: Socket connections to ports below 1024
                  http://www.blog.lessrain.com/as3-java-socket-connections-to-ports-below-1024/

                  And a follow-on regarding Merapi w/ AIR ... here is a quick demo video:
                  http://www.merapiproject.net/index.php?option=com_content&view=article&id=51&Itemid=84
                  and you can go full screen with the same version of this video here:
                  http://www.youtube.com/watch?v=EGqMAGCH5Hc

                  So, in cases where a Java app is running local with an AIR app, the demo video above highlights that it should be straightforward for the java app to pass generated values to a flex charting application running in AIR.

                  But namala, SujitG is right. If your Java app is a servlet, then you should be able to use standard RPCs to communicate with Flex apps in either Flash Player or AIR. shrugs.

                  Note: The AIR runtime is a wrapper on Flash Player. Flash Player in a browser is sandboxed. Flash Player in AIR is not sandboxed.

                  Please post back regarding whether the above answers your question, and if you find it helpful :-)

                  Best regards,

                  g