Use Eclipse to write your html

Eclipse is a great tool for writing and debugging html files and projects. It allows creating and editing html files and publishing them on a server automatically.

There is a good description how to set up things on Eclipse on StackOverflow.

Eclipse and Apache server on the same machine

There was one issue that confused me.

I set up an Apache 2.2 server on my development machine for testing purposes, to copy my website eventually to the production server when I set it up, and thought of using that Apache 2.2 for debugging my files as I write them on Eclipse; I am not the only person to come up with this idea as apparently one StackOverflow user thought the same way.

Well, this was a mistake.

HTTP Preview in Eclipse

In fact, to run and debug html files in Eclipse, one has two options for a server type: HTTP Preview and HTTP Server. (You can see them in Define a New Server form that is opened from Server view, right-click on this view and choose New → Server. The Server view can be opened from Web or Java EE perspectives, Window → Show View → Servers.)

Both of these are internal http servers that Eclipse runs in its belly; I do not know how to make Eclipse publish on an external server like the Apache 2.2 I set up myself on the same machine. (One can, of course, do this manually.)

Moreover, when I selected HTTP Server in Define a New Server form as above and tried to run it, it did not. The reason was that I set up this server on ports 80/81 on which I already had my Apache 2.2, and they conflicted.

The solution I am happy with, is to use HTTP Preview for testing my html (it uses ports 8080/8081), and when everything is ready, publish it on Apache 2.2 before transferring to production.

In fact, Eclipse help, Web Tools Platform User Guide > Using the server tools > Testing and publishing on your server > Testing applications on a server > Testing on an HTTP Preview server, mentions debugging your project on HTTP Preview server and then progressing to an external HTTP server; the role of the internal HTTP Server is not clear.

Eclipse Web projects vs. the root directory of server

One side note: Eclipse does not seem to allow publishing anything in the root directory of its servers as all files in an Eclipse Web project whose name is ProjectName are published to the subdirectory ProjectName of the root (e.g., www/ProjectName).

©Baruch Youssin 2014

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>