I’ve been playing with Red5, an open source alternative to Adobe’s Flash Communication Server. My Eclipse setup just died on me, so in the process of setting up eclipse for developing the Red5 server, I’ll put up a quick tutorial on using eclipse to work with Red5. Note that this is aimed more towards hacking on Red5 itself than writing applications that use Red5, although the latter will definitely benefit from starting with the setup I’ll be doing.
We want to do some serious java development, so we’re going to need the Java Development Kit… Or, as it is now known, the Java Standard Edition. Download the current JDK and install.
Next, we need Eclipse itself. I grabbed Eclipse Classic (Eclipse SDK) from Eclipse’ Downloads section. Another good alternative to start from is the Expert Java build from EasyEclipse. Download the zip file and extract it to some directory. I prefer C:\Program Files\eclipse for windows, or /home/njoubert/eclipse for Ubuntu.
NOTE: If you want FlexBuilder as a plugin inside your eclipse install, you should install flexbuilder NOW before doing anything else. There seems to be some conflicts when FlexBuilder plugin gets installed after other 3rd party plugins are present or something…
Open up Eclipse, and select whatever directory you want as your workspace. If you already have Red5 checked out somewhere, you can make the directory that Red5 lives in as your workspace, or you can choose some other one, and we will associate the already-checked-out code with the workspace you select a little later.
Once Eclipse is running, we want to associate Eclipse with our shiny JDK that we downloaded instead of sitting on top of the built-in JRE. Go to Window > Preferences… and open Java > Installes JREs. It should show only the supplied jre (jre1.6.0_01 for my Eclipse 3.3.0). Hit “Add…”, then “Browse” for a JRE home directory. (aka. “C:\Program Files\Java\jdk1.6.0_01″). Everything should pop up. Hit OK, and make sure to select the new JDK in the list of Installed JREs. Hit OK, and you’re good to go.
Now we need to get IvyDE and the Spring IDE installed. The Spring IDE is technically not necessary, and I tend to not use it in the areas of Red5 i’m working on, but Red5 is built on top of Spring, so it’s worth installing it and removing later on if you think it is unnecessary. Eclipse plugins all follow the same installation procedure, so i’ll be a bit more detailed with the first plug-in, and then roll with it for the rest.
Spring IDE 2.0 plays well with Eclipse Europa’s Java Development edition, since this Eclipse build comes with Mylyn, which Spring plugs into. Mylyn is a fancy task manager that does all kinds of cool stuff, which i’m not going to go into now, but it worth looking at.
Spring IDE has an Eclipse update site, that Eclipse uses to install the plugin from. go to Help > Software Updates > Find and Install.. in Eclipse, select “Search for new features to install” and hit next. Current known sites pop up. Select “New Remote Site…” and set the URL to http://springide.org/updatesite/ and name to “Spring” (or whatever you want). Make sure there’s a check next to it, and hit “next”. After contacting the site, Eclipse should show “Spring” as a feature to install. Check it, and click Next. Accept the terms and select Finish. Click finish to start the installation procedure. Eclipse will first download the necessary utilities, then prompt you to install them. Restart Eclipse when prompted to.
Once Eclipse comes back, we follow the same procedure to add IvyDE to Eclipse. There is a good tutorial on the Red5 wiki on installing IvyDE and using it with Red5. For the moment, follow the previous procedure, with the update site “http://www.jaya.free.fr/update”.
Lastly we want to get Subversion compatibility for Eclipse, so we need Subclipse. You can follow the same procedures as before, this time with the update site “http://subclipse.tigris.org/update_1.2.x”. When it prompts you for which features to install, open up the Subclipse item and deselect Integrations. Some of the integration plugins is not installed, so i just skip that part.
To get the current Red5 source from scratch, go to File > New > Project… and choose SVN > Checkout projects from SVN. Select “Create a new repository location” and use the URL “http://svn1.cvsdude.com/osflash/red5″ in the next section. Eclipse should resolve this and download a Table of Contents from which you can select what you want to check out. Browse to java > server, select “trunk” and go for it! This should check out and try to build Red5.
If you already have a copy on disk of Red5, I opted for a File > Import > File System, and imported the root Red5 directory. Once this was in my workspace, I right-clicked on the project, and selected Team > Share…, at which point SVN should kick in and realize that this is a current SVN project and associate the project with the right repository.
To get Ivy running with your local checkout copy of Red5, you need to set some non-obvious preferences. Open up Window > Preferences > IvyDE in Eclipse. Each of the fields needs to be filled out before Ivy will start doing its job. Point the IvyConf URL to the ivyconfig.xml file that is in the root of the Red5 folder. Fill in Accepted types, Sources types and Javadoc types as in the examples below each. I checked “Do a trtrieve after resolve” and set up the Pattern to their example, although I believe you can get away by not doing this. When you click “OK”, Ivy should start running and resolving dependencies.
Voila, Red5 is ready to run! Launch it by going to src > org.red5.server and running Standalone.java as a Java application.