user2081442
user2081442

Reputation: 11

Create and publish a static web project in Eclipse

when I tried to create and publish a static web project in eclipse I got: "Error copying file index.html: No such file or directory"

My environment: SuSE 12.2, Eclipse Indigo Release 2, Apache2 2.2.22,

This is what I did to create the project:

1) Create new Server

2) Create Project

3) Create very simple page

4) Start Project

Here I got the error message mentioned above. At this point there is a new folder /srv/www/htdocs/Simplepage created but has no content.

Later I made a test with the following configuration:

Start Project gives error: "Access forbidden! You don't have permission to access the requested directory..."

At this time there is a new directory created: /srv/www/htdocs/XY/Simplepage containing the file index.html.

The window in eclipse is showing the path http://localhost/Simplepage/. When I change this manually to http://localhost/XY/Simplepage/ the newly created page is shown.

I don't understand this behaviour. Can someone explain this?

Upvotes: 1

Views: 10328

Answers (1)

Baruch Youssin
Baruch Youssin

Reputation: 391

You have installed Apache2 server on your home computer, with the publishing directory /srv/www

Note that Apache2 runs on its own user (on my Ubuntu it is www-data). Apache's publishing directory /srv/www is normally owned by Apache's user.

You have also directed HTTP Server of Eclipse to the same directory. Note that this server is different from Apache; it is run by Eclipse inside its belly, and usually on different ports from Apache, to avoid port conflict. I think this server is run on the same user Eclipse runs, i.e., your regular user on your home comp.

I think that the error messages you get, are permission mismatch: Eclipse cannot publish in directories owned by Apache's user.

The solution is not to try to use Apache's directories but rather the default directories of Eclipse.

I have explained this in more detail here: Eclipse Web (http) servers: Debugging and publishing http files in Eclipse.

I do use both Eclipse' HTTP Preview server and Apache2:

  • Eclipse' HTTP Preview server for files I work on in Eclipse, and
  • Apache2 to run a localhost copy of my Wordpress site.

When files I work on in Eclipse, are mature, I transfer them manually to Wordpress as posts or pages.

Upvotes: 1

Related Questions