I am new to Lejos and in my first year of experience with Java. I was able to modify the Intelligence Unleashed segoway to use Dexter Industries DIMU. (I learned a lot!). I am now beginning to use the Dexter Industries WIFI sensor. There is a beta library for this device for Lejos from the manufacturer. I am able to communicate via wifi with the NXT. I am looking to implement an HTML5 websocket server on the NXT. In order to avoid writing code for the long handshake, I am trying to embed a Jetty server. I have worked with Jetty on my home Linux box, and can deploy it without difficulty. As a first step with the NXT, I just want to deploy a simple test server that responds when called. I have tried my code on the JRE 7 linux box and it works. When I compile this using eclipse juno and NXT runtime, I get the "indirectly referenced from required .class files." I have researched this forum, stack overflow and google search. I know I need to add the missing .jar file to the classpath, but here I am stumped. I can obtain the source code for the missing class. It is java.io.PrintWriter.java . However, the classes.jar in NXT runtime are already compiled, then jar'd (is that a verb?). I have tried to add the .java file as a referenced library, and have also placed it in the src (default package). These attempts didn't work. I have also added the source code to the classes source files in the NXJ Development Kit Sources and tried to build the classes.jar again using Ant in Eclipse, but it did not compile due to the addition of the new file to the .io folder. Is there any way to integrate this class, which is absent in the classes.jar in its correct location so it can be referenced and interact appropriately with the rest of the java.io package? I am posting the code for the test server below. I have all of the jetty-specific jars in their appropriate locations. Can I replace the entire java.io class in the NXT runtime library? I suspect that would break more than it fixes.
- Code: Select all
public class NXTHello extends AbstractHandler
public void handle(String target,
throws IOException, ServletException
response.getWriter().println("<h1>You have reached Fredly. I'm not in right now...</h1>");
public static void main(String args) throws Exception
Server server = new Server(8080);