views:

291

answers:

3

How do you use this great new API in connection with Java? Do you use just pure native process API like nativeProcess.standardInput.write() and nativeProcess.standardOutput.read() with which you cannot debug Java side neither invoke remote java method. Or you are using some library that leverages remote method invocation such as flerry lib but that also cannot debug Java side? Or maybe you are using Merapi with which you can debug but cannot remotely invoke Java method? I'm asking this because this is maybe the most important question regarding this API and its ease of use.

A: 

It sounds like your reservations have to do with being able to debug the Java process. This is not really an issue. You can use the NativeProcess API to kick off a Java process with arguments that will cause it to be externally debuggable. For example:

var processArgs:Vector.<String> = new Vector.<String>();   
processArgs.push("-Xdebug");  
processArgs.push("-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n");  

This will allow your Java process to be remote debuggable. You can then connect to it from Eclipse or Netbeans once the process has started. If the code in the Java process is linked to an active Eclipse/Netbeans project, you can do linewise debugging like you would of any other Java application.

-Raj

A: 

You can use NativeProcess to execute java.exe and pass it the right parameters to execute a java application.

You cannot use NativeProcess to run random java code from a jar file.

Sam
A: 

Having used both of them, you can debug the JVM with MerAPI or NativeProcess API. Prior to AIR2.0, I used merapi to communicate over the network to a java process.

I would much prefer to use the NativeProcess launcher now, with MerAPI we were hacking ugly marshalling code. Debugging the network payloads was a pin via merapi.

Using NativeProcess API is easy -

var myForkedExe:NativeProcessStartupInfo = new NativeProcessStartupInfo(); myForkedExe.executable = ; ...

I am not sure I understand what you mean by can not invoke remote Java methods with merapi. That's exactly what I have been doing. Debugging is easy, just set the JPDA args and attach any JAVA debugger.

Rachel Burns