2 Replies Latest reply on Aug 11, 2010 2:53 AM by Balakrishnan V

    Invoking java methods

    athiroy Level 1

      hi

       

      i have used flash builder 4.

       

      i can't plugin eclipse ide.

       

      can i invoke java methods in flash builder 4 .

       

      is it possible.

       

      if it's possible pls give some ideas.

       

      thanks in advance

       

       

      regards

      athi

        • 1. Re: Invoking java methods
          Chris Brind Level 1

          You may need to install the Java Development Tools manually.

           

          Add this update site (if it doesn't exist already):

          http://download.eclipse.org/releases/galileo

           

          Then look for Programming Languages -> Eclipse Java Development Tools.  Check the box, click Next and follow the instructions.  Eventually you'll be asked to restart Eclipse.  Do so and then when it loads again you'll have the Java perspective, Plugin-perspective, etc.

           

          Cheers,

          Chris

          1 person found this helpful
          • 2. Re: Invoking java methods
            Balakrishnan V Level 3

            If you want to invoke java methods that are remote though, you might want to use a Java Remoting technology like BlazeDS.

             

            Using a <s:RemoteObject> tag, you could connect to the server and invoke java methods.

             

            Here is a small sample app code that helps me execute a remote java method.

             

            <?xml version="1.0" encoding="utf-8"?>

            <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"

               xmlns:s="library://ns.adobe.com/flex/spark"

               xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"

               creationComplete="ro.getProducts()">

            <fx:Script>

            <![CDATA[

            import mx.controls.Alert;

            import mx.messaging.channels.AMFChannel;

            import mx.rpc.events.FaultEvent;

            import mx.rpc.events.ResultEvent;

            protected function ro_resultHandler(event:ResultEvent):void

            {

            Alert.show(event.result.toString())

            }

             

            protected function ro_faultHandler(event:FaultEvent):void

            {

            Alert.show(event.fault.faultString);

            }

             

            ]]>

            </fx:Script>

            <fx:Declarations>

            <!-- Place non-visual elements (e.g., services, value objects) here -->

            <s:RemoteObject id="ro"

            destination="productService"

            endpoint="http://localhost:8400/samples"

            fault="ro_faultHandler(event)"

            result="ro_resultHandler(event)"/>

            </fx:Declarations>

            </s:Application>

             

            Hope this helps,

             

            Balakrishnan V