•  
  •  

Create a Windows Service for Flex Server

There are many reasons why you may want to add a JRun server instance to the Windows Services panel. I”ve found that its very handy on production machines in a cluster. If one fails, it recovers nicely without me having to help. Here is how I do it.

JRun provides an executable for managing its server instances called jrunsvc.exe. You can find it in the jrun_install_root\bin directory. Open a command line window to this directory and execute jrunsvc along with some of these options:

Option
Description
-install jrun_server [service-name [service-display [service-description]]]
Installs the JRun server as a Windows service. The Windows service name, Windows service display name, and Windows service description fields are optional. If a name contains spaces, use quotation marks.
The Mask:jrunsvc -install server_name “service display name” “service description”

The Example:

jrunsvc -install flexsamples “Flex Sample Applications Server” “Flex Samples”

-remove service-name
Removes the named Windows service, if you installed it using this utility. You can mark the service for deletion on system start.
-stop service-name
Starts the named service, if it is not already started.
-start service-name
Stops the named service, if it has started.

-console service-name
Runs the service from the console rather than from the Windows service Control Manager. Use this option for debugging.
-config path-to-jvm.config
Specifies a path to the JVM configuration file used by the Windows service.
Overrides the default, jrun_root\bin\jvm.config, to determine the JVM configuration.
-help
Lists all options.

This table is from the JRun Documentation with some modifications.

That is it! Now, when ever the server is restarted, the necessary Flex servers will start as well.

About Rob Rusher

In his role as Principal Consultant for On3, Rob leads an software development practice to help his clients build rich Internet applications for the desktop, browser, and mobile devices, and to rapidly increase their knowledge and skills to better support their organization's goals. Rob is an Adobe Certified Expert, Community Professional, and Certified Instructor. He has taught and mentored the technical teams at HP, Overstock, Paychex, SAS, the FedEx, and other Government and Fortune 100 organizations. Rob has co-authored four best-selling books on building secure, cutting-edge and rapidly developed applications using Adobe AIR, ColdFusion and Flex. He is very active in organizing and speaking at RIA, Adobe LiveCycle, mobile conferences, and user groups. In addition to growing his software consulting practice, On3, Rob has been building expertise in rich client application development on a wider variety of devices and platforms that extend the applications to change the way we all create and live.