Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / January 2008

Tip: Looking for answers? Try searching our database.

Transfer data between java programs

Thread view: 
Yao Qi - 04 Jan 2008 11:47 GMT
We write a java tool which could record runtime information, such as
thread call stacks, of java applications, and these runtime information
is printed to stdout.

Now, we write an Eclipse plugin as an UI for this java tool, launch our
java tool in our Eclipse plugin, and show these runtime information by
TreeItem or TreeColum in Eclipse plugin.  It seems that we have to
transfer runtime information from user's java application to our Eclipse
plugin.  Here are some choices in my mind,

1) Parse the output in stdout.  Since our runtime information is printed
in stdout, we could extract them from stdout.
2) Socket.  We could set up a socket to communicate between our java
tool and Eclipse plugin UI.  It is complicated to package runtime
information, send, and build runtime information in Eclipse plugin.

 +-----+          +--------+         +-------+
 |     |          |        |         |       |
 | App |--------> |  Tool  |----+--->|Eclipse|
 |     |          |        |    |    |       |
 +-----+          +--------+    |    +-------+
                                |
                                |    +-------+
                                |    |       |
                                +--->|stdout |
                                     |       |
                                     +-------+

At the same time, I don't want to remove the ability to print to stdout,
because sometimes, we want to show runtime information in console, while
runtime information could be shown in Eclipse plugin if our tool is
launched from our Eclipse.

How do I get runtime information in Eclipse plugin?
How do I achieve "output switch between Eclipse and stdout" easily?
Comments are welcome!

Best Regards

Signature

Yao Qi <qiyaoltc AT gmail DOT com>    GNU/Linux Developer
http://duewayqi.googlepages.com/

linux: No such file or directory

Nigel Wade - 04 Jan 2008 14:36 GMT
> We write a java tool which could record runtime information, such as
> thread call stacks, of java applications, and these runtime information
[quoted text clipped - 28 lines]
> runtime information could be shown in Eclipse plugin if our tool is
> launched from our Eclipse.

I would look into using log4j. You can easily get the application to log using
log4j. This can be to a file, to stdout, or any other location which log4j
provides - and if it doesn't provide what you want you create your own
logger/appender. You can log to multiple places at the same time, so stdout and
file if you want both.

> How do I get runtime information in Eclipse plugin?

You could parse the output from a log4j log file. You could do as I have done
and implement a log4j RMI client/server logger/appender pair, where the RMI
client is a log4j appender which sends its log messages to a RMI server/logger.
The RMI server could be within your Eclipse plugin. This method also allows
multiple clients to send messages to the same [remote] logger.

> How do I achieve "output switch between Eclipse and stdout" easily?

log4j.configuration. This file controls which log4j loggers/appenders log4j uses
to actually log the messages.

Signature

Nigel Wade, System Administrator, Space Plasma Physics Group,
           University of Leicester, Leicester, LE1 7RH, UK
E-mail :    nmw@ion.le.ac.uk
Phone :     +44 (0)116 2523548, Fax : +44 (0)116 2523555

Yao Qi - 07 Jan 2008 01:26 GMT
> I would look into using log4j. You can easily get the application to log
> using
[quoted text clipped - 4 lines]
> stdout and
> file if you want both.

Seems that log4j is a good choice.  I will look at it.

>> How do I get runtime information in Eclipse plugin?
>
[quoted text clipped - 7 lines]
> allows
> multiple clients to send messages to the same [remote] logger.

RMI is what I want.  As you said, RMI server is within my Eclipse
plugin, and clients send messages to this server.

>> How do I achieve "output switch between Eclipse and stdout" easily?
>
> log4j.configuration. This file controls which log4j loggers/appenders
> log4j uses
> to actually log the messages.

Best Regards

Signature

Yao Qi <qiyaoltc AT gmail DOT com>    GNU/Linux Developer
http://duewayqi.googlepages.com/

linux: No such file or directory



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.