Play! framework deployed as a JAR or Service?

We have developed a small application using play !, and it works autonomously on a user computer (Windows XP or Windows 7), since users do not have access to the network. It is currently running in the console / command window. I would like to make sure that the taskbar does not have a console window where the game is running - mainly because users tend to close the window. I came up with a couple of ideas, but I was hoping for some validations or other ideas.

First, I was thinking of running Java through javaw, which usually works for GUI applications running in Java, but what would I run? I guess I can run the Winnet Servlet container with the WAR of the game! (referred to as solving another stack thread issue below).

Secondly, I was thinking of trying to wrap it in a Windows service.

This question is similar, but slightly different (I am not opposed to installing the game !, which simply includes unpacking the frame): Expand the game! application as an executable jar

Has anyone used any of these methods, or is there a better way? Pros / Cons / Examples?

Thanks!


Update: Any comments on Winstone? It turns out that due to security restrictions, we will not be able to [easily] create services or scheduled tasks (like SYSTEM). Thanks again.

+4
source share
4 answers

I did something similar for several applications. I have completed the following steps:

  • Create a bat file that launches the application to play. It can be as simple as play run or play start
  • Create a scheduled task that runs at system startup, using SYSTEM as the user profile to run the command as.

This approach has been working on my internal systems for over a year now.

+2
source

Alternatively, you can use yajsw to wrap your application for playback as a Windows service. It works very well and is easy to configure.

The only problem I encountered is that in one of my mailboxes running Windows Server 8 R2, some jobs are duplicated when the scheduler starts. I'm not sure if it is directly related to yajws, and I could not reproduce the error in other environments with the same setup.

I managed to get around this by adding a synchronization block to my doJob method. Look here for information on setting up yajws with the game.

+2
source

I'm not sure if the game will work on winstone. The list of application servers that are known to work with the game can be found here .

You will need to fight your game application with play war myapp -o myapp.war and check it first.

0
source

I ended up creating a batch file that launches "play run", and a runnable JAR that calls "start / B runPlay.bat" as a system call. Thus, the console window does not start at all. So far, it works great. There seem to be a lot of solutions, but it was pretty simple.

0
source

Source: https://habr.com/ru/post/1401060/


All Articles