Friday, June 19, 2009

Configuring the Red5 Plugin for Eclipse

Prerequisites

  1. Eclipse 3.4.2 installed
  2. Red5 plugin 0.2 installed
  3. Red5 server installed
  4. Java 6, as the default JVM on your system. If you cannot make it the default, you can still run Red5 on your system so long as you modify the startup and shutdown scripts to use Java 6.

Notes


If you are following the instructions to setup a Red5 User Development Environment, at this point you have the plugin installed, but you still need to configure it to use your particular Red5 server.

Configuration

  1. Launch Eclipse.
  2. From the Java EE perspective, choose the Servers view. If you can't find the view, open it with Window -> Show View -> Servers.
  3. Since we haven't added any servers yet, the view is blank. Right click on the background of the Server view and choose New -> Server.

  4. In the New Server dialog box that appears, scroll down in the server type list to Infrared5 and expand it by clicking on the triangle to the left of it. Select "Red5 Server Runtime" and click Next.
  5. On the next panel, we immediately see an error message: "Missing classpath entry /Applications/Red5/red5.jar".
    If you see this, great! It means you're following along with the instructions. What we want to do first is select the correct JRE to run Red5 under. From the JRE pulldown, choose JVM 1.6. [If there is no option for JVM 1.6, one of four things is true: (a) your system is not up to date (this requires OS X 10.5 + updates) (b) your system doesn't support Java 6 (requires a 64bit cpu), (c) you aren't running Mac OS X and should be using different directions, or (d) you should select the link above the JRE pulldown for "Installed JRE preferences" to create an entry for Java 6. ]
  6. On the same panel we now have to replace the /Applications/Red5 directory with the correct path to the Red5 server folder. Following the guide to Installing Red5 Server, the new value should be /Applications/red5-0.8.0. After making the change, click the Next button.

  7. On the next panel we're faced with another error. Luckily the answer is to do the same thing we did in the last step: replace /Applications/Red5 with the location we installed Red5 in. When you're done, click the Finish button.


  8. You should see a shiny new "Red5 Server Runtime at localhost" entry in the Servers view.
  9. Congratulations! You now have the Red5 Plugin configured and your server should be ready to use.

Testing your installation


You can now start and stop the server from the "Server" view in the Java EE perspective by right clicking on the Red5 Server Runtime and choosing Start (or Debug) and Stop. In the future, once you've configured your applications to run on the server, any changes you make to your server applications should automatically publish to your Red5 installation folder. In most cases the webapp(s) will be reloaded automatically and you can run your client applications to test them.

To start your server, right click on the "Red5 Server Runtime" and choose Start. (If you get an error message that the port is in use, Stop the server, then choose Start again). You should see some log messages scroll by in the Console view:



Followed by Eclipse returning to the Servers view and showing the server with a status of "Synchronized".



If you made it this far, wonderful! It looks like your server is now running from Eclipse. You're now ready to develop server-side applications in Red5!

2 comments:

Candice said...

Hi!
Thanks for the tutorials! I was so lost!!! BUT... i still have a problem when trying to start the server. It gives me a Java error:
Exception in thread "main" java.lang.UnsupportedClassVersionError: Bad version number in .class file
Do you know how I can fix it please?? I really need help with this!
THanks!

Candice

Alex said...

Candice, it sounds like you are missing prerequisite #4, listed at the top of this article. You need to use Java 6 for Red5. If you click through to that article is has instructions for getting your system configured correctly.

Post a Comment