Launch application in background - java

I have a common question, how it is possible to launch a Third-Party application in Java, without to open it in the desktop (start the application as process?). I stuck at this point, so is there a way to open an application in an "hidden" mode.
OS: Windows Server 2008

As Ronald said, you can create a batch file to start the third party application in the background. Add the batch file to the windows services startup in automatic mode. This is the easiest way you can make it run at startup in the background

Related

User is able to open the JavaFx desktop application more than once in a Windows machine

I am working on a JavaFX desktop application where the User is able to open the JavaFx desktop application more than once in a Windows machine. From Mac it cant be opened more than once.
The following code is used to launch the application:
Application.launch(ExampleApplication.class, (java.lang.String[])null);
Apart from JUnique library, is there any way to fix this issue ?
Any inputs will be helpful.
Application.launch() should only succeed once per a single application as per documentation. In addition it solely manages the current application and doesn't return until the application exits. If you want to be able to run the application more than once I'd recommend creating a standalone launcher for your application which runs a java process, which in turn runs your application. This way each time the launcher is executed a unique process is started and invokes the application.

How to deploy my play web App onto my server

I have created a Web Application with the latest version of the play framework and am ready to deploy it. Since this is the first time I will deploy a web application onto a server I am not 100% sure how to to that.
I need to run a lot of cronjobs on the databases, which is why I have ordered a Vserver which came with Debian 7.8 LAMP installed.
What I am asking now is what is the simplest way to deploy my App onto my server?
What I would try if I wouldn't ask this question now, is to install play on my debian server (well actually I probably would have to install the activator thing nowadays instead right?) than upload my app to the server, change the deployment port of the app to 80, put the application in production mode and than start the app on the server or use the stage task command.
Is this the right way to do it? I do not want to make mistakes.
There is no right way to do it.
You have 4 choices (more if you include Maven distributions, etc.) but for the case 'I want to run my app on my server' there you go:
use start but it needs human intervention (interaction) so you might not want to do this in an actual production settings.
use stage to prepare your app for deployment. stage prepares some scripts which you can then call from /etc/init
The above methods NEED Play to be present on the server machine. So if you do not want to have Play! on your server... here you go:
use dist to create a zip file with everything in it... then just unzip the file somewhere in the server and run the scripts in the bin directory
Create a native package that will install your app as a (in your case) a Debian package.
Check this out (official docs):
https://www.playframework.com/documentation/2.3.x/Production

Install and uninstall a java application in ms-windows

I have created a java application.
I also created another java application which install the first application.
The program runs perfectly.
However the program isn't displayed in control panel->programs.
I also want to create an uninstaller (let's say unintaller.bat). But i want to works like any other uninstaller. When someone goes to Control Panel->serach program->uninstall this program it will run the uninstaller.bat
In other words, the concept is how to declare the java application in windows...
Any idea???
Installing an application doesn't necessarily mean registering it with the operating system. For example, for a Mac, I can open an App without having it added to the Applications folder.
Same with Windows. Just because a new file can be added to the Start menu, it doesn't mean it was registered.
Use a Windows installer. There are tons that are open source, and even MS provides a free one: http://support.microsoft.com/kb/942288.
This will allow you to install an uninstall an application using standard tools. Yes. It can be called from a bat file.
Java open source installers: http://java-source.net/open-source/installer-generators

Java service wrapper to create service for Java UI application

I have created a Java application which needs to run as a service. For service wrapper I tried using tanuki and other wrapper softwares.
Now, my application does run as a service - however, it runs as a service under SYSTEM and not under currently logged in user.
My application has a UI, which does not show when the application is running as a service. I doubt that this has happened because the service is running under SYSTEM and not under currently logged in user.
When I run the application (without installing it as a service), the UI does show up and I could see the java process running under the current user's id, whereas it runs under SYSTEM when installed as a service.
Now, there is nothing to my application if there is no UI. I need to application to run as a service when the system boots up and the UI needs to show up as well.
Has anyone tried to do what I am doing here and has faced a similar issue. If so, how did you go about resolving it?
Is there a different wrapper service that I could use and not have this issue.
Tanuki's documentation does explain setting a java application as a service, but does not talk about a java applicaiton with a UI and running it under the currently logged in user.
Update
Just so that folks here could get a bit more idea as to what is it that I am trying to accomplish - the behavior that I am trying to have with my app is similar to how Dropbox or Yahoo Messenger or any other software has which starts with Windows boot and continues to run in the background, allowing the users to interact with it using the system tray icon. So basically all of this has been built in Java/Swing. Now when it has come to deployment of the app - I can run it standalone but running the jar file or by creating and running an executable wrapper for it. However, I want the software to start with Windows boot and continue to run as a service in the background, while allowing the user to make changes and interact with it via lets say bringing up the UI from a system tray icon that it sets.
As of now, it does run as a service successfully. It performs all the actions that it ideally should - there just is no system tray icon to bring up the UI and make changes to its configuration.
Update - 2
Ok.. I tried advanced installer and it does wrap up everything for me to generate an exe installer for windows. Now all I need is to auto-start the software. Can anyone help me with this? I don't see an option in Advanced installer to automatically have the program add itself up in the auto-start.
Link to tanuki's doc http://wrapper.tanukisoftware.com/doc/english/faq.html
Rohan,
Please take a look at the following page:
http://wrapper.tanukisoftware.com/doc/english/prop-ntservice-interactive.html
You will need to mark the Service as interactive and then run as the SYSTEM user in order to get your GUI to show up on the first logged in desktop.
The problem is that Microsoft changed what services are allowed to do starting with Windows 2008 and Vista. This means that starting with these versions, the GUI will always show up on a sandboxed desktop which the user will need to switch over to.
If you want to show a GUI on all desktops, in all versions of Windows, you will need to run the JVM within the desktop.
Cheers,
Leif
I wanted to comment on your question, but I don't have enough reputation to do it. So I'm misusing the answer function now.
I have a similar problem. I used the tanuki wrapper for a while now on a Windows XP machine and the Swing GUI was shown to all users who logged in.
Now I migrated to Windows 2008 Server and configured the current version of the tanuki wrapper like this:
wrapper.ntservice.interactive=true
wrapper.ntservice.hide_console=true
(see documentation here and here)
The Windows service runs under the LOCAL SYSTEM account.
But the GUI is still not shown. Did you find any solution to the problem?
Don't think you should have a UI with a service. Put it in the startup group instead ?
What's does the UI and application do?

java 1.6 SystemTray icon does not appear on windows startup

I have a Java 1.6 desktop application, started with javaw from a batch file on Windows XP. There is a .lnk link to this batch file, which is placed to windows Startup folder in order to start this application on every system boot.
The application uses SystemTray class to display an icon on the system tray in case it is running. Starting this application manually there is no problem. If it is started by windows startup process, there is no icon displayed (not even a blank icon), however the application is running. The startup process is also slowed down.
How can I overcome this?
Thank you!
Are you starting the Java application on system boot or on user login? If you start the application before a user is logged in, there will probably be no system tray to attach to, since the system tray is associated with the user session.
If you don't need the Java application to be running before a user is logged in, it might help to move the shortcut to the user's (or all users') autostart folder.

Categories

Resources