February 22, 200916 yr Newbies Hi, I'm a newbie to Java and Groovy... I'm trying to setup FM to interact with a Java application through its API which is supplied with the app. I have made some functions/classes in the Eclipse IDE which work well, I get back the expected return in its console. What I don't understand is, when I run the code in FM, I expected to get a return just like in the Eclipse console, but the result_text in FM stays empty (no errors). Is there a difference in type of output? Most of the code, gives a 'System.out.println' which gives no result in FM. All help is welcome, thanks, Ruben
February 23, 200916 yr Ruben, The output from System.out.println goes to the output stream for the java app. On OS X, you can view this in the /Applications/Utilities/Console.app application. If you're running some command and truly need to capture the output of all calls to System.out.println you can replace the static "out" field in the System class with your own PrintStream, and get the contents of the stream when you're done: ByteArrayOutputStream baos = new ByteArrayOutputStream(); System.out = new PrintStream(baos); System.out.println("Hi there"); System.out.println("End of line"); System.out.flush(); return baos.toString(); This is a pretty bad hack, however, and should be avoided if possible. The utility you're using should return the result as a string or accept an OutputStream to write to, instead of sending important information to System.out. What kind of app are you interfacing with?
February 24, 200916 yr Author Newbies Thanks shmert, I'm trying to connect to the TWS application of Interactive Brokers with its API(9.62). Connecting to TWS from ScriptMaster works. From within FM I wan't to retreive data and send orders automaticly based on some calculations in FM. I'm not sure if I'm in the right direction, I tried to get some return, but the api's voids methods won't let me. It looks like I have to change the API itself (which I don't wan't to if not neccessery). Is there some workaround ? If interested here is some more info about IB's TWS: IB website: http://www.interactivebrokers.com TWS application (individual demo): http://individuals.interactivebrokers.com/en/p.php?f=tws&p=d&ib_entity=llc TWS API: http://www.interactivebrokers.com/en/p.php?f=programInterface&ib_entity=llc thanks, Ruben
Create an account or sign in to comment