In Java I'm writing a System Tray application which runs in the background on a user's desktop.
How does one interact/interop with this system tray app from another Java program? I want to be able to send notifications to the service arbitrarily, eg causing it to then show a balloon message.
Any solution needs to work on Windows and Mac, and it would be nice if it worked on Linux too - but hey, Java is inherently cross-platform so this shouldn't be an issue.. right?!
Many thanks
If the other (non-tray) programs are Java, RMI is probably the easiest approach. If the other programs aren't Java, but have good support for SOAP, create a WSDL (including XML schema) to represent the notification message(s), and have the tray app call Endpoint.create to listen for SOAP messages from other programs.
Related
several years I used to come on the bible of coding and I have (maybe) a question rarely asked. First of all thanks to all people which takes time to answer us.
I have a network with a Linux server and some Windows clients. On the server I have to use a Java application (I don't have source code) but it's hard to use it on the server : graphic card drivers are not update then the resolution of the screen is "small" and not expandable. It's a problem because layouts of the app are not dynamics then some important buttons are not displayed (is it so hard to use a JScrollPane ???). And I don't really want to learn how many times I have to use Tab for each hidden button.
Then one solution is to launch the app on a Windows client through MobaXterm. It works well but at one moment a process need a library.
I tried to launch the app by adding the library path of the library, a *.so file, but didn't work.
The question is : a java application installed on Linux and launched through a windows client need *.so or *.dll library ?
Thanks.
Florent
I developed a java desktop application where the user can manually load a file and press a button to start a simulation process. I want to automate the above two steps so that an external program can iteratively call this desktop application multiple times and run the simulation process without any human intervention every time. Any thoughts on how I can go about doing this?
It depends on which OS you do it.
If OS X, use automator, for Windows you can use winautomation and for Linux use google and search (for example) kde automation.
I know this is an old question. But there is a new solution now,
JAuto: a JVMTI agent that runs in Java VM and expose UI widget attributes such as class names, screen coordinates. You talk to JAuto by sending a command to a named pipe. It responds by writing a file. It lets you control a Java program via bash scripts.
Using an input simulator such as xdotool, you can achieve automation under the Linux X11 settings.
Disclaimer: I'm the author of JAuto.
I recently played around with the SWT browser widget (which is great). I am wondering if I could write a full desktop application with it (with java services behind - e.g. persistence) and what drawbacks I would have to consider. The advantage would be that people without java knowledge could work on the gui. Of course it depends on the requirements and I know that this is not a very specific question. But mabye someone already tried to build a bigger app this way and is willing to share insights.
Thanks
Marcel
I'm not sure I share your opinion of the SWT browser widget. AFAIK it's merely a shell into the default browser on your machine, merely with a few API access points. I've used it for minor things when I needed to show a web page from within the application. But writing a whole application? That doesn't make sense.
If you want to build a web-based application that runs in the browser against a Java based server framework, there are many AJAXian frameworks to do it. You'd still be doing JavaScript for your client code. And you'd still be dealing with all the complexities of different browsers. I'm not sure why you would want to host it inside an SWT application instead of just directly in the browser window.
This is my first post on Stack Overflow and I'm just wondering on the options of making a system tray application. The application would run primary from the system tray while still operating, and could be brought up into a window when clicked on. It is also needed to have some support for global keystroke tracking, to bring up a window.
I'm curious on what options I have available to me, as I'm sure that there are many ways to do this. I'm most familiar with with Java though I have some experience with C++. I'm willing to explore other languages if they have some definite perks to them, though it would be nice to work with what I know in a way.
Thank you
Java 6 has new functionality which allows for the creation of applications which use the system tray.
The New System Tray Functionality in Java SE 6 article goes into the details, and provides some sample code as well.
The newly added SystemTray and TrayIcon classes of the java.awt package can be used to add icons to the system tray. The icons can respond to mouse clicks and use pop up menus as well. However, this new functionality is a part of AWT, so it doesn't do a very good job integrating with Swing components.
Here's an example of a little clock that shows up in the system tray which was made using the SystemTray and TrayIcon classes in Java 6:
(source: coobird.net)
Plain old Winforms would get my vote.
If you are familiar with Java you should have little difficulty using one of the managed languages to create a simple tray app with .NET.
Here is some advice on the correct way to create a tray app.
Be carefully with manged applications and Java here. Tray applications run all the time. So, if they are poorly written then they can use enough system resources to interfere with other things.
There is nothing wrong with manged code or Java in general, but it can be more difficult to keep managed or java apps frugal with memory, I/O and CPU time.
I'm saying this as a dev manger on the Windows perf team - we've seen lots and lots of very piggy tray applications. Yes, some are even windows or MSFT applications.
It may be a better approach to write a very small light weight tray app that launches a richer process when the user needs it. You can write your try app in simple C++ right on top of the low level Win32 APIs. If you don't want to use the Win32 APIs directly, you can use the Windows Template Library.
Is it feasible to launch an application via a browser / URL? What are the options for doing this?
I know the way to do it with IE and Windows (which usually doesn't work). Ideally, I would like this to be browser independent.
Our application is RCP, so in theory Java Web Start could work, we would just have to do some significant changes to how we deliver our application to users, which I would like to avoid. Our web server code is currently all Java if that makes a difference.
I pretty much gave up on this until I clicked a url on Apple's site, which in turn launched iTunes.
How does Apple do that?
iTunes registers itself as a protocol handler for custom itms:// and itmss:// protocols. When you hit a URL with that protocol - after a step of indirection on Apple's web servers, in this case - iTunes launches to handle it, much like your browser launches to handle http:// URLs or your email program launches to handle mailto: URLs.
This isn't "cross-platform", per se, but it does work on every platform out there, as URL handlers exist and do the same thing everywhere.
It has the disadvantage of only working if the application is already installed, which is why you may want to have a splash page that instructs people to install the application if necessary.
Silverlight 3 and Adobe Air will let you launch applications outside the browser.
If this is OS independent, then you can't rely on any specific program being available. What kind of program would you want to launch anyway?