I have a Swing Java application; assume it is just like calculator. What I want to do is
Start this automatically in start up
Run as a Windows service
Show an icon in the system tray when it closes.
Using Java service wrapper, I have made it to Windows service; but it is still not starting on reboot, nor does an icon display in the tray.
You can use winrun4j or Java Service Wrapper
For java service wrapper tutorial, have a look to this article
Take a look on http://commons.apache.org/daemon/jsvc.html
I believe that this is exactly what you need.
Related
I need to implement a SplashScreen in java, and i'm currently learning from How to Create a Splash Screen but there is paragraph that says
Fortunately, Java™ SE 6 provides a solution that allows the application to
display the splash screen much earlier, even before the virtual machine starts.
A Java application launcher is able to decode an image and display it in a
simple non-decorated window.
How is possible that java run the SplashScreen even if virtual machine starts if SplashScreen is a java class?
If you define the splash screen in your jar MANIFEST-file, it is loaded and displayed with native code before the Java VM is started. No need to load a class in that case. Later, you can get the SplashScreen instance to edit and/or close it.
Manifest entry:
SplashScreen-Image: images/splash.gif
Or command line option:
-splash:images/nnn.gif
Java Platform, Standard Edition (Java SE, formerly known as J2SE)
version 6, provides a solution that allows the application to show the
splash screen much earlier, even before the virtual machine starts.
Now, a Java application launcher is able to decode an image and
display it in a simple nondecorated window.
Source:
http://www.oracle.com/technetwork/articles/javase/splashscreen-135938.html
I'm actually working on an screenshot saver on Windows, and i'd like to call to a method on the java application when I press a combination of keys to save the screen.
How can I call a method when the java application is not the "active" window? whether the main window is minimized or is running on background.
You're looking for a Hook in your keyboard for Windows. Note that hooking is highly relevant to the OS and your application may not be portable between different versions/editions of the OS. Still, you can do this using JNA as shown here: JNA Keyboard Hook in Windows or using a third party library like jnativehook.
I have developed a vaadin application for a friend of me. Now I want to "install" this application on his pc so that when he clicks on an icon (like when you open, let's say spotify) the application starts and he can start using it... What is the easiest way to do this?
The application would be an runnable jar (using JSmooth or whatever you want). You would need to use an embeddable web server like Jetty. Here is a tutorial on setting up Vaadin with Weld and embedded Jetty. Here is an example Vaadin application that shows you how to set up the launcher to automatically start your application.
Hope that helps!
You can use Jsmooth to create an installer for the application.
I have some java code that I use on a windows machine that runs as a service and has a tray icon that I want to port to Mac OS X. From what I can tell there is no good way to make a menu bar icon using java, so I want to basically wrap my java code with objective-c so I can have a nice menu bar icon and still interact with the java code as I am able to when running the code on my windows box. Is there a good way to do this?
My java code makes web requests every so often so the main functionality I'm looking for is to start/stop the web client, as well as receive updates from the java code on the status of the web requests (more or less push notifications).
Thanks for your help everyone!
If all you're trying to do is get your application's icon displayed in the Dock & the Finder, you don't need to write an objective-C wrapper; all you need to do is bundle the Java code up in with the icons in an OS X "application bundle". See Apple's Java Deployment Guide
You might also want to look into the com.apple.eawt package (see questions/1319805/java-os-x-dock-menu), which provides some features to allow a Java app to appear more like a native OS X application to the user (for example, supporting drag-and-dropping a file to the application icon).
I need to write a program that, when minimized, lives in the System Tray, and I'll use Java 6's SystemTray API to do that.
How can I make that application comes to the foreground when the user presses some hotkey?
For example, the app is running but minimized. When the user presses CTRL-SHIFT-Y or something (or, like Google Desktop's search, CTRL twice) and the application is maximized.
EDIT: I know about how to bring a Java window to the foreground. I'm asking more specifically about how to make a running Java app listen for a hotkey.
You're going to need to resort to JNI, check out an example.
Here's another nice example from Sun's forums.
You can use the following SWT extension library to create a keyboard hook that can listen for your hot key - http://feeling.sourceforge.net/
note, that this is windows only (but that may not be a problem for you).