views:

79

answers:

2

I know it might sound weird, but I wrote a web server without knowing how to deploy it and run it, so how do I do it in eclipse? (and please specify the eclipse version) thanks

A: 

You need to write an Eclipse plugin as well. Some of them are open source, you may want to take a look.

BalusC
No, it isn't part of the assignment.
Noona
Then you can't integrate it in Eclipse.
BalusC
I think he can, just need to get info on how, lets say, glassfish did it. As long as eclipse is free and open source, you may investigate it's code and methods on writing a plugin. You may also look through other server's plugins.
den-javamaniac
Now I know what you mean, I didn't mean integrating it into eclipse, I meant just run it on my computer and test it, it seems that I can do that just as I do with any other Java application. I am assuming I just have to type the resource in the browser while specifying the port number that the server is listening on at the end of the url. I tried that, but it seems there are many exceptions occurring that are preventing the server from functioning.
Noona
You need to investigate and fix those exceptions from top to bottom.
BalusC
I have no idea where to start :), I mean, it isn't giving any indication in the web browser that my server is running, beside the fact the server is multi-threaded, and I don't know how to debug when I have multiple threads running, but i will start unit-testing my classes for now.
Noona
You said you got exceptions. They contain useful information about the root cause of the problem. If you **understand** them, then the solution is **obvious**. If you don't understand exceptions, then well, it's getting harder. Just Google or ask a question.
BalusC
well, the exceptions I am getting are mostly null pointer exceptions that related to thread pools (created by class Executors), so I am getting for example:Exception in thread "pool-1-thread-1267" java.lang.NullPointerException
Noona
Well, some code which is executed by that thread has thrown a NPE and it is been passed through by the executor. You need to look further in the stacktrace for the **root cause**. Or just unit-test it.
BalusC
A: 

The webserver is implemented in java? Then to run it just launch it as any other java program (right click on main class, 'Run As'->'Java Application').

You can deploy it as runnable jar. Right click on the project, 'Export As...'. Choose 'Java'->'Runnable JAR file'. Follow the wizard instructions. If you have exported properly everyone can launch your webserver by an double click on the jar (as long as java is installed).

My Eclipse-Version is 3.5, but that should not matter. This functionality is implemented since ... don't know. Long ;).

Arne
Thank Arne, you may be right, at first I assumed Eclipse J2EE functionality was needed for this purpose, but if I run it just as any other Java program then it shouldn't matter.
Noona
@Noona If you can compile it in eclipse then when you run the app it just uses the jar files you compiled against.
Romain Hippeau