On Monday, February 05, 2007, at 11:27AM, <[EMAIL PROTECTED]> wrote:
>> I have an interesting problem this morning. I have a little
>> development tool written in REALbasic that needs to extract some
>> information from the sources of a Java application. Because of this,
>> parsing the Java stuff is much more easily done using Java.
>
>Why is that? Does Java have some facilities for parsing Java code?
>(Forgive me if that's a dumb question -- it's been a long time since I
>last used Java.)
The data I'm harvesting is the strings in .properties files, for which Java has
built-in functionality to read and decode. I would rather not write my own Java
property file parser in RB.
>> So I set
>> up a ServerSocket in my RB app and wrote a little Java command line
>> app that connects to the socket and passes the info to the RB app.
>
>Note that a ServerSocket is overkill here; you're not going to have
>more than one client, right? So just a regular TCPSocket, listening on
>a particular port, will work fine and be simpler.
Good point. Of course if I could get standard output to work then I wouldn't
need a socket at all.
>> This works just fine when I launch the Java app manually from the
>> command line or from Xcode. However when I launch the Java app from
>> my RB app, which is the intended use case, the RB app freezes and I
>> have to force quit it.
>
>How did you launch the Java app? My guess: you're using a Shell, and
>forgot to set it to Asynchronous mode. So the Run command doesn't
>return (nor does your RB app process any events) until the Java app
>finishes, and the Java app doesn't return until it's gotten an answer
>from your RB app.
dim sh as new LoaderShell(ostr)
sh.Mode = 1
sh.Execute("java -jar " + jar.ShellPath + " " + dir1.ShellPath + " " +
dir2.ShellPath)
I know the parameters are right because if I run it synchronously (mode = 0)
the Result property has the Java output. But the output can be sizeable so I
would rather not buffer all of it into this property before I can do some work
with it.
>P.S. Isn't it nice that you're using a mailing list where you can get
>such a quick answer? ;)
Cheers!
Steve
_______________________________________________
Unsubscribe:
<[EMAIL PROTECTED]>
REAL Software has decided to consolidate this mailing list with the online
Forums. On Monday, February 12, 2007, this mailing list will no longer be
active. We encourage you to continue your REALbasic and REAL SQL Server
discussions on the Forums. If you are not presently a member of the forum,
please sign up today at <http://forums.realsoftware.com>.