Note that there are some explanatory texts on larger screens.

plurals
  1. PORed5 + Java + Windows installation + ant compilation : it works, but why?
    text
    copied!<p>I'm totally new to both java <strong>and</strong> java Server worlds... But I've a good knowledge (17 years) of object-oriented programming. My question is : </p> <p>Why do I have to call ant to make it work (see later, if you're not interested, skip my question ^_^ ) ?</p> <p>Here's what I want : create a simple application that can do a videoconference (= the server receives one client video stream and dispatches it to X clients). I wanted it free (Adobe Server costs something like 10000 dollars). The only solution I found is Red5 (see <a href="http://code.google.com/p/red5/" rel="nofollow noreferrer">there</a>)</p> <p>I've downloaded and installed the 0.7 version. Here are the steps I did to be able to compile successfully a java application for Red5 :</p> <ol> <li>download and install (Windows XP) the latest release (0.7)</li> <li>download &amp; copy manually in the install folder some files that have been forgotten in the 0.7 installation (compare to the v0.6 release and guess which ones) (<code>ivy.xml</code> if I remember)</li> <li>go in the <code>[Red5 path]\webapps</code> folder. Copy / paste the <code>tutorial</code> folder.</li> <li>rename the folder to <code>myapp</code>.</li> <li>edit all the xml files in that folder, search the string <code>tutorial</code> and rename it to <code>myapp</code></li> <li>here's what I did and <em>it did <strong>not</strong> work</em> : compile with javac :<br> <code>javac -classpath "[Red5 path]\red5.jar" -d "[Red5 path]\webapps\myapp\WEB-INF\classes" Application.java javac -classpath "[Red5 path]\red5.jar" -d "[Red5 path]\webapps\myapp\WEB-INF\classes" TestService.java</code></li> <li>Everything worked fine but once I launched the Flex client the answer from the server was "Invalid Application"</li> <li><p>After many tries I found that removing everything but that code made everything work :</p> <pre><code>package myapp; import org.red5.server.adapter.ApplicationAdapter; import org.red5.server.api.IConnection; import org.red5.server.api.IScope; /* myapp */ public class Application extends ApplicationAdapter { <pre><code>public String sayHello(Object[] params){ return "got : " + params[0].toString(); } </code></pre> } </code></pre></li> </ol> <p>Then I then wanted to be able to trace.</p> <ol> <li><p>I wrote that code that was working in the Red5 examples :<br> <code><pre> package myapp;</p> <p>import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.red5.server.adapter.ApplicationAdapter; import org.red5.server.api.IConnection; import org.red5.server.api.IScope;</p> <p>public class Application extends ApplicationAdapter {</p> <pre><code>protected static Logger log = LoggerFactory.getLogger(Application.class); public String sayHello(Object[] params){ log.info("I got your name: "+params[0].toString()); return "I got your name: " + params[0].toString(); } </code></pre> <p>} </code></pre></p></li> <li><p>After restarting Red5 server : I always got that response from the server: "Invalid application"</p></li> <li>Then I downloaded <a href="http://ant.apache.org/bindownload.cgi" rel="nofollow noreferrer">ant</a>, unpacked it in the <code>[Red5 path]</code></li> <li>I've created a new file <code>[Red5 path]\webapps\myapp\WEB-INF\build.xml</code></li> <li>I've put that xml in it :</li> </ol> <pre><code>&lt;project name="Projet myapp" default="compile" basedir="."&gt; &lt;target name="clean" description="Clean output directories"&gt; &lt;/target&gt; &lt;target name="compile" depends="clean"&gt; &lt;javac srcdir="./src" destdir="./classes" source="1.6" classpath="C:\Program Files\Red5\red5.jar" &gt; &lt;/javac&gt; &lt;/target&gt; &lt;target name = "jar" depends ="compile"&gt; &lt;echo message ="Creating jar..."/&gt; &lt;jar destfile="./lib/myapp.jar" basedir="./classes"/&gt; &lt;echo message ="Done."/&gt; &lt;/target&gt; &lt;/project&gt; </code></pre> <ol start="6"> <li>Run a shell, then type :<br> <code><pre>cd [Red5 path]\webapps\myapp\WEB-INF ......\apache-ant-1.7.1\bin\ant jar</code></pre></li> <li>Everything works fine now !</li> <li>Here's the question !</li> <li>What I don't understand is :<br> <strong>Why do I have to call ant to make it work ?</strong></li> </ol>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload