1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
|
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Chapter 6. Building Red5</title><link rel="stylesheet" href="html.css" type="text/css"><meta name="generator" content="DocBook XSL-NS Stylesheets V1.74.0"><link rel="home" href="index.html" title="Red5 - Reference Documentation"><link rel="up" href="getting-started.html" title="Part I. Getting Started"><link rel="prev" href="libraries.html" title="Chapter 5. Red5 Libraries"><link rel="next" href="releasing.html" title="Chapter 7. Releasing Red5"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div xmlns="http://www.w3.org/TR/xhtml1/transitional" style="background-color:white;border:none;height:73px;border:1px solid black;"><a style="border:none;" href="http://osflash.org/red5" title="Red5 Open Source Flash Server"><img style="border:none;" src="images/red5-banner.png"></img></a><a style="border:none;" href="http://osflash.org/red5" title="Red5 Open Source Flash Server"><img style="border:none;position:absolute;padding-top:5px;right:42px;" src="images/red5-banner-logo.png"></img></a></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="building"></a>Chapter 6. Building Red5</h2></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1868"></a>6.1. Build Environment Setup</h2></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="d0e1871"></a>6.1.1. Ant</h3></div></div></div><p>Apache Ant 1.7 and above is required for building the Red5 project source code. download here
<a class="link" href="http://archive.apache.org/dist/ant/binaries/" target="_top">http://archive.apache.org/dist/ant/binaries/</a>
</p><p>The path to the ant binary must be on your system PATH environment variable (test by
typing ant -version at a system prompt) defined, typically </p><div class="literallayout"><p><br>
PATH=$PATH:/usr/local/ant <br>
</p></div><p>You can check this on windows by typing set PATH or on unix by typing echo $PATH </p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="d0e1885"></a>6.1.2. Java</h3></div></div></div><p>Java 1.5 or 1.6 and above is required for running ant, compiling the source and running the
Red5 server. </p><p>Download Java 5
<a class="link" href="http://java.sun.com/j2se/1.5.0/download.html" target="_top">http://java.sun.com/j2se/1.5.0/download.html</a>
</p><p>Download Java 6
<a class="link" href="http://java.sun.com/j2se/1.6.0/download.html" target="_top">http://java.sun.com/j2se/1.6.0/download.html</a>
</p><p>You must have the environment variables for JAVA_HOME and JAVA_VERSION defined,
typically </p><div class="literallayout"><p><br>
JAVA_HOME=C:\development\j2sdk\1.5.0_07 JAVA_VERSION=1.5 <br>
</p></div><p>You can check this on windows by typing</p><pre class="screen">
set JAVA_HOME
</pre><p>or on unix by typing</p><pre class="screen">
$ echo $JAVA_HOME
</pre></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="d0e1912"></a>6.1.3. Red5</h3></div></div></div><p>You must have the environment variables for RED5_HOME defined,
typically </p><div class="literallayout"><p><br>
RED5_HOME=/www/red5_server<br>
</p></div><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Warning"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Warning]" src="../images/admons/warning.png"></td><th align="left">Warning</th></tr><tr><td align="left" valign="top"><p>
FAILURE TO SETUP YOUR ENVIRONMENT VARIABLES WILL PREVENT YOUR FROM BEING ABLE TO BUILD PROPERLY
</p></td></tr></table></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../images/admons/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p>
You don't need netbeans or eclipse unless you need an IDE for java.
<a class="link" href="http://www.netbeans.org" target="_top">Download Netbeans</a>
<a class="link" href="http://www.eclipse.org" target="_top">Download Eclipse</a>
</p></td></tr></table></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1931"></a>6.2. Building</h2></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="d0e1934"></a>6.2.1. Getting Red5 Source</h3></div></div></div><p>The Red5 source code is available at the
<a class="link" href="http://code.google.com/p/red5/" target="_top">google code project page</a> and svn repository.
</p><div class="orderedlist"><ol type="1"><li><p>With your favourite SVN client check out the source code from svn at this address
<a class="link" href="http://red5.googlecode.com/svn/java/server/trunk/" target="_top">http://red5.googlecode.com/svn/java/server/trunk/</a> or
<a class="link" href="https://red5.googlecode.com/svn/java/server/trunk/" target="_top">https://red5.googlecode.com/svn/java/server/trunk/</a> if you have a google code login.
</p></li><li><p>Team members will be added to the google code project group and in your google code login you will find the svn password for committing changes at this address
<a class="link" href="http://code.google.com/hosting/settings" target="_top">http://code.google.com/hosting/settings</a>.
</p></li></ol></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="d0e1958"></a>6.2.2. Getting Red5 Demo Applications Source</h3></div></div></div><div class="orderedlist"><ol type="1"><li><p>With your favourite SVN client check out the source code from svn at this address
<a class="link" href="http://red5.googlecode.com/svn/java/example/trunk/" target="_top">http://red5.googlecode.com/svn/java/example/trunk/</a> or
<a class="link" href="https://red5.googlecode.com/svn/java/example/trunk/" target="_top">https://red5.googlecode.com/svn/java/example/trunk/</a> if you have a google code login.
</p></li></ol></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="d0e1971"></a>6.2.3. Getting Red5 Flash Demo Source</h3></div></div></div><div class="orderedlist"><ol type="1"><li><p>With your favourite SVN client check out the source code from svn at this address
<a class="link" href="http://red5.googlecode.com/svn/flash/trunk/" target="_top">http://red5.googlecode.com/svn/flash/trunk/</a> or
<a class="link" href="https://red5.googlecode.com/svn/flash/trunk/" target="_top">https://red5.googlecode.com/svn/flash/trunk/</a> if you have a google code login.
</p></li></ol></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="d0e1984"></a>6.2.4. Running the ant build</h3></div></div></div><p>To build the red5 source simply run the following command from the command line inside
the red5 source directory. </p><pre class="screen">
$ ant dist
</pre></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="d0e1991"></a>6.2.5. Current Ant Targets</h3></div></div></div><div class="itemizedlist"><ul type="disc"><li><p>all - Runs clean, prepare, compile, jar, javadoc targets</p></li><li><p>bootstrap - Compile and start the server using the bootstrap class</p></li><li><p>checkout - checks out the Red5 server source (requires svnant.jar)</p></li><li><p>checkout-all - checks out the entire Red5 project sources from the root level to a specified directory</p></li><li><p>clean - cleans up all the files and directories</p></li><li><p>compile - Compiles Red5</p></li><li><p>compile_core - Build Red5 server sources and downloads java 6 dependancies</p></li><li><p>compile_core_compatibility - Build Red5 server sources and downloads java 5 dependancies</p></li><li><p>compile_demos - Copies over the root and installer webapp</p></li><li><p>compile_script - Compiles scripting sources</p></li><li><p>compile_tests - Compiles junit test classes</p></li><li><p>compile_war - Compiles Red5 into a war distribution</p></li><li><p>console - launches a non-SSL jconsole for managing Red5 in JMX.</p></li><li><p>console-ssl - launches a SSL jconsole for managing Red5 in JMX with SSL enabled.</p></li><li><p>doc-all - Generate docbook documentation for html-single, multi html and pdf.</p></li><li><p>doc-clean - Cleans the docbook files.</p></li><li><p>doc-html - Compile reference documentation to chunked html.</p></li><li><p>doc-htmlsingle - Compile reference documentation to single html.</p></li><li><p>doc-pdf - Compile reference documentation to pdf.</p></li><li><p>doc-prepare - Extra preparation for the documentation.</p></li><li><p>dist - Make Binary distribution.</p></li><li><p>dist-archive - Create archive file for distribution.</p></li><li><p>dist-cluster - Create Edge/Origin distribution.</p></li><li><p>dist-debian - Create Debian package.</p></li><li><p>dist-edge - Builds a Red5 edge distribution.</p></li><li><p>dist-origin - Builds a Red5 origin distribution.</p></li><li><p>dist-installer - Make Installer distribution.</p></li><li><p>dist-macosx - Create Mac OSX installer.</p></li><li><p>dist-windows - Create Windows installer.</p></li><li><p>dist-redhat - Create Redhat installer.</p></li><li><p>ivyclear - Clears out the Ivy cache.</p></li><li><p>jar-determine-classpath - Determine classpath for jar file.</p></li><li><p>jar - Make Archive.</p></li><li><p>javadoc - Generate JavaDoc.</p></li><li><p>java6.check - Checks for Java 6. </p></li><li><p>prepare - Prepares for building Red5.</p></li><li><p>server - Compile and start the server.</p></li><li><p>shutdown - Shuts down the running Red5 instance.</p></li><li><p>udp_server - Compile and start experimental UDP server.</p></li><li><p>run-tests - Run JUnit tests and generate HTML reports.</p></li><li><p>run-tests-systemtest - Runs some end-to-end system tests against a test server using a flash client.</p></li><li><p>run-tests-server - Run the selftest server.</p></li><li><p>svn-add - Add files to svn.</p></li><li><p>remotejar - Creates a jar that may be deployed with remote applications.</p></li><li><p>retrieve - Retrieves the libraries if needed.</p></li><li><p>rtmps_keystore - Creates the keystore file in the conf directory required by RTMPS.</p></li><li><p>truststore - Creates a duplicate keystore file and generates a truststore file for jconsole SSL connections.</p></li><li><p>upload-snapshot - Uploads a snapshot of Red5 to the repository.</p></li><li><p>war_demos - Build wars for demo apps.</p></li><li><p>webwar - Make Web Archive. </p></li></ul></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="d0e2145"></a>6.2.6. Ant and Ivy</h3></div></div></div><p>When cleaning the dependancy libraries using and ant ivy with the following command</p><pre class="screen">
$ ant ivyclear
</pre><p>It is required to run the rebuild of Red5 in a particular way to make sure ivy retrieved the libraries correctly. </p><pre class="screen">
$ ant -Divy.conf.name="java6, eclipse" dist
</pre></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e2156"></a>6.3. How to build with eclipse</h2></div></div></div><p>This guide assumes eclipse 3.1.0 and you have downloaded the entire red5 build from the
subversion repository at
<a class="link" href="https://red5.googlecode.com/svn/java/server/trunk" target="_top">https://red5.googlecode.com/svn/java/server/trunk</a>
</p><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="d0e2164"></a>6.3.1. Recommended Eclipse Plugins</h3></div></div></div><p>The following plugins are recommended or required for building red5 in eclipse.</p><div class="itemizedlist"><ul type="disc"><li><p>IvyIDE -
<a class="link" href="http://ant.apache.org/ivy/ivyde/download.cgi" target="_top">http://ant.apache.org/ivy/ivyde/download.cgi</a>. See here for installation / update instructions
</p></li><li><p>Spring IDE -
<a class="link" href="http://springide.org/project/wiki" target="_top">http://springide.org/project/wiki</a>
</p></li><li><p>Subclipse SVN Plugin -
<a class="link" href="http://subclipse.tigris.org/" target="_top">http://subclipse.tigris.org/</a>
</p></li></ul></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="d0e2188"></a>6.3.2. Importing the Red5 Project</h3></div></div></div><p>There are two ways to import the Red5 project. Either import an already downloaded working copy of the Red5 project or import the project directly from SVN.</p><div class="procedure"><a name="d0e2193"></a><p class="title"><b>Procedure 6.1. Import the checked out working copy.</b></p><ol type="1"><li><p>Start Eclipse.</p></li><li><p>Begin to import project
<span class="guimenu">File</span> → <span class="guimenuitem">Import</span>
</p></li><li><p>In the Import dialog box select the item <span class="guimenuitem">Existing Projects into Workspace</span> and hit <span class="guibutton">next</span>.</p></li><li><p>Hit the <span class="guibutton">browse</span> button next to the <span class="guilabel">Select root directory</span> text box.</p></li><li><p>Select the root folder where you downloaded the red5 repository,(e.g. c:\projects \osflash\red5 or /www/red5_server) and hit ok.</p></li><li><p>Make sure red5 is selected in the projects area and hit <span class="guibutton">Finish</span>.</p></li><li><p>Eclipse should automatically build the project, you can force a build from the menu
<span class="guimenu">Project</span> → <span class="guimenuitem">Build Project</span>
</p></li></ol></div><div class="procedure"><a name="d0e2244"></a><p class="title"><b>Procedure 6.2. Import the project working copy from SVN. (Subclipse must be installed).</b></p><ol type="1"><li><p>Begin to import project
<span class="guimenu">File</span> → <span class="guimenuitem">Import</span>
</p></li><li><p>In the Import dialog box select SVN and then select the item <span class="guimenuitem">Checkout Projects from SVN</span> and hit <span class="guibutton">next</span>.</p></li><li><p>A list of available SVN urls will be available, if it is not available select <span class="guimenuitem">Create a new repository location</span> click <span class="guibutton">Next</span> and enter.
<a class="link" href="http://red5.googlecode.com/svn/java/server/trunk" target="_top">http://red5.googlecode.com/svn/java/server/trunk</a> or.\
<a class="link" href="https://red5.googlecode.com/svn/java/server/trunk" target="_top">https://red5.googlecode.com/svn/java/server/trunk</a> if you have a google code login.
</p></li><li><p>Click <span class="guibutton">Finish</span>.</p></li><li><p>Eclipse should automatically build the project, you can force a build from the menu
<span class="guimenu">Project</span> → <span class="guimenuitem">Build Project</span>
</p></li></ol></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="d0e2295"></a>6.3.3. Updating the Red5 source from Eclipse.</h3></div></div></div><div class="procedure"><a name="d0e2298"></a><p class="title"><b>Procedure 6.3. Updating the Red5 source from trunk.</b></p><ol type="1"><li><p>In eclipse right click the Red5 source project.</p></li><li><p>Locate to
<span class="guimenu">Team</span> → <span class="guimenuitem">Update</span>
</p></li><li><p>The source will be updated from SVN.</p></li><li><p>Right click the Red5 project and select <span class="guimenuitem">Refresh</span>.</p></li><li><p>The project should also be cleaned after each update, by the following
<span class="guimenu">Project</span> → <span class="guimenuitem">Clean</span>
</p></li></ol></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="d0e2331"></a>6.3.4. </h3></div></div></div><div class="procedure"><a name="d0e2333"></a><p class="title"><b>Procedure 6.4. Debugging Red5 in Eclipse.</b></p><ol type="1"><li><p>Click the arrow next to the <span class="guiicon"><img src="images/debug_icon.png"></span> icon menu and then click <span class="guimenuitem">Debug Configurations</span>.</p></li><li><p>Click <span class="guimenuitem">Java Application</span> in the menu then right click and <span class="guimenuitem">New</span>.</p></li><li><p>Type a name for the debug configuration (ie <span class="guilabel">Red</span>) and type <span class="guilabel">org.red5.server.Bootstrap</span> as the main class.</p></li><li><p>Select the <span class="guimenuitem">Arguments</span> tab.</p></li><li><p>In the <span class="guilabel">Program Arguments enter</span>
</p><div class="literallayout"><p><br>
-Dlogback.ContextSelector=org.red5.logging.LoggingContextSelector -Dcatalina.useNaming=true -Djava.security.debug=failure<br>
</p></div><p>
</p></li><li><p>In the <span class="guilabel">VM Arguments</span> enter
</p><div class="literallayout"><p><br>
-cp ./conf<br>
</p></div><p>
</p></li><li><p>In OSX with JDK 5 and JDK6 to specify JDK6 the PATH variable has to be set. Goto the <span class="guilabel">Environment</span> Tab, add a new variable called PATH, and place this in there.
</p><div class="literallayout"><p><br>
/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home/bin<br>
</p></div><p>
</p></li><li><p>Click <span class="guibutton">Apply</span> and <span class="guibutton">Close</span>.</p></li><li><p>Goto the build configure path dialog
<span class="guimenu">Build Path</span> → <span class="guimenuitem">Configure Build Path</span>
</p></li><li><p>In the <span class="guimenuitem">Source</span> tab choose <span class="guibutton">Add Folder</span>
and select the <span class="guilabel">src/conf directory</span>.</p></li><li><p>Make sure "Allow output folders for source folders" is selected.</p></li><li><p>Under <span class="guilabel">red5_server/src/conf</span>, select <span class="guilabel">Output Folder</span> and choose <span class="guibutton">Edit</span>.</p></li><li><p>Select <span class="guilabel">Specific Output Folder</span>, select the root directory and choose "create new folder" and choose "conf".</p></li><li><p>Select conf, the output folder for the Red5 configs will now be placed into red5_server/conf.</p></li><li><p>With the imported red5 project selected click the debug icon and it will launch the server.</p></li><li><p>Console logging will appear in the console window.</p></li></ol></div><p>If you get an error in the console like:</p><div class="literallayout"><p> <br>
java.net.BindException: Address already in use: bind at sun.nio.ch.Net.bind(Native <br>
Method) at sun.nio.ch.ServerSocketChannelImpl.bind(Unknown <br>
Source) at sun.nio.ch.ServerSocketAdaptor.bind(Unknown Source) at <br>
org.apache.mina.io.socket.SocketAcceptor.registerNew(SocketAcceptor.java:362) <br>
at org.apache.mina.io.socket.SocketAcceptor.access$800(SocketAcceptor.java:46) <br>
at org.apache.mina.io.socket.SocketAcceptor$Worker.run(SocketAcceptor.java:238) <br>
Exception in thread "main" <br>
</p></div><p>Then the socket red5 wants to run is in use, you can change the socket port in the property rtmp.port in the property file red5.properties.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="d0e2462"></a>6.3.5. Ant, Ivy and Eclipse</h3></div></div></div><p>When cleaning the dependancy libraries using ant and ivy with the following command</p><pre class="screen">
$ ant ivyclear
</pre><p>It is required to run the rebuild of Red5 in a particular way to make sure ivy retrieved the libraries correctly. </p><pre class="screen">
$ ant -Divy.conf.name="java6, eclipse" dist
</pre><p>Then back in eclipse right click the <span class="guilabel">ivy.xml</span> in the project and click <span class="guimenuitem">Refresh</span> it will also resolve the libraries in Eclipse.</p></div></div></div><div xmlns="http://www.w3.org/TR/xhtml1/transitional" class="navfooter"><hr></hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="libraries.html">Prev</a> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right"> <a accesskey="n" href="releasing.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 5. Red5 Libraries </td><td width="20%" align="center"><span style="color:white;font-size:90%;"><a href="http://osflash.org/red5" title="Red5">Red5 Open Source Flash Server</a></span></td><td width="40%" align="right" valign="top"> Chapter 7. Releasing Red5</td></tr></table></div></body></html>
|