0

This is my first time with Java and Eclipse. I started a brand new Java project and I want to import/add NanoHTTPD into it. How do you this?

This is NanoHTTPD's site: http://nanohttpd.com

Thanks!

Edit

Lesson learned, be specific or you get backslashed for asking. I edited the question and here's some background and the problem I'm running into.

I'm developing a Nodejs backend that needs to query a JAVA project I was given. Pipes are a no go because the services will run on different machines. Tomcat seems like an overkill so I decided to use NanoHTTPD to develop the web service. I come from Ruby & Nodejs so compilation and Eclipse are very new to me. First off, I have no JAR file just TAR and ZIP and from what I read they are fundamentally different. However, I tried importing the TAR and ZIP files as recommended but the structure I get in Eclipse does not seem right compared to the JRE System Library or others I've seen. Notwithstanding, I went ahead and tried to import the package from my Main.java file

package fi.iki.elonen;

public class Main {
    public static void main (String[] args)
    {
        System.out.println("Main");
    }
} 

When I try to run it I get the following error:

Exception in thread "main" java.lang.Error: Unresolved compilation problem:
at Main.main(Main.java:4)

I found a great article from IBM "Managing the Java classpath (UNIX and Mac OS X)" where it mentions that an IDE such as Eclipse can alleviate the pain of dealing with the source path, classpath and compilation. Unfortunately, I'm afraid this is where I might be getting stuck.

I tried uploading images of what I have but apparently I'm not popular enough yet to do it.

Could someone help me figuring out how to not only import libraries but using them on projects? Even just a URL to a clear Linux/Mac OS X post that explains import with multiple packages would be great.

1

2 Answers 2

2

NanoHTTPD is designed to be very lightweight.

I just cut and pasted the 'NanoHTTPD' class from the source on github, its all in there - and pasted it as a class into my own project.

Then I created a subclass of nanoHTTPD, overrode the 'serve' method to send my own stuff and it was job done.

0

Download the jar, drag it into the project, and right-click it to add it to the build path.

1
  • sir, from where can I get the nano httpd jar? Commented Dec 11, 2014 at 9:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.