6 Replies Latest reply on Apr 28, 2008 8:58 AM by bryan_costanich

    noob: possible to call jars from flex

    bryan_costanich
      Hi all,

      Is it possible to call java assemblies (jar) from within Flex client code? i'm completely new to flex and i've been reading up on it, and it appears that it uses java to some degree, so i was wondering if you could call jar assemblies natively. i'm guessing it's not, but i'd like to find out definitively. i'd certainly prefer to write in java rather than AS3 where possible.

      thanks in advance.
        • 1. Re: noob: possible to call jars from flex
          greenhippo
          I dont think you can run any other non flash files directly using flex. Its a bit of a shame as it makes adobe Air, which had the potential to be an awesome desktop application tool, and makes it merely a local webpage.

          However depending on exactly what your doing you can call java methods using blazeDS, this requiers a webserver as it makes use of some clever use of servlets. But if your want to call the jar locally then its not really that viable.
          • 2. Re: noob: possible to call jars from flex
            bryan_costanich Level 1
            hm. yeah, that is too bad. well, what about other as3 assemblies (or whatever the equivalent would be)? e.g., can i create a distributable assembly that did some stuff that people could use?
            • 3. Re: noob: possible to call jars from flex
              peterent Level 2
              Calling Java JARs from the Flash Player or AIR player would be a huge security violation. Just think what would happen if you visited a page by accident with a malicious SWF which could invoke code on your system. AIR is a little different and we're looking at ways to make that possible and safe at the same time. Our customers' security is top priority. We'd rather give you less functionality than permit someone to muck with your systems.
              • 4. Re: noob: possible to call jars from flex
                bryan_costanich Level 1
                That's kind of a cop-out, given that java has a sophisticated security model that prevents such issues unless signed and ok'd by the user.

                Regardless, what is the AS3 encapsulation/reuse model?
                • 5. noob: possible to call jars from flex
                  levancho Level 3
                  I am not sure if its even that efficient, calling java from swf client, since it requires cranking up of client jvm, and some clients might not even have jvm, so I don't see how can that be feasible, flex is using some java on compilation/development level not at the runtime level ...
                  ... on the other hand, calling server side java code from client is different story and this is exactly what blazeDS does :) (one of the many other things)
                  • 6. Re: noob: possible to call jars from flex
                    bryan_costanich Level 1
                    again, i don't buy that:
                    1) i imagine the cross domain/out of process inefficiency is made up for by the efficiency of java's processing vs. AS3
                    2) if they don't have the VM, they get a prompt, just like running java stuff. it would then be up to the dev to decide whether or not to use it. and specifically for the enterprise, or when building apps where you control the deployment (where this would be the most useful) it wouldn't even be an issue.

                    regardless, i'm happy to move on from the java thing, i really just want to know what the AS3 encapsulation story is. can you reference other AS3 assemblies from a flex project?