File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

copy paste existing eclipse project

 
sai rama krishna
Ranch Hand
Posts: 411
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have one perfectly working shopping cart sample servlet web project(say name sampleweb) with 10 different servlets, 12 different html pages. I want to copy paste same project into new project
(say sampleweb_enhance)and enhance the application little bit more by adding couple of more servlets, couple of more HTMLs without disturbing orignal project. I am able to copy but I am not able to paste when I go to File option under Eclipse top menu.

Alternately I went to my physical C:\eclipse_workspace folder and copied sampleweb folder and pasted it and renamed it as sampleweb_enhance.

Now I went to eclipse and went to File then new dynamic web project and gave project name as sampleweb_enhance. I gave project location as C:\eclipse_workspace\sampleweb_enhance.

When sampleweb_enhance opened in eclipse 'src' directory under 'Java Resources' is empty and also 'WebContent' directory is also empty

what is the best way to achieve it. I do not want to do manual copying each and every file, libraries, htmls pages and set up bilid path etc

Please advise. Thanks in advance
 
Kemal Sokolovic
Bartender
Posts: 825
5
Java Python Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use Git and save yourself from copy/paste or other alternatives. Just create a new branch each time you want to keep stable version of your project safe, but also want to experiment with it or try to enhance it.

By the way, paste is never in the File menu.
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is what I do. Let's say your project's name is shopping. Using a file manager I copy the shopping directory as shopping2 (in the same workspace). Then I edit the shopping2/.project file with a text editor changing the project name to shopping2. Then in Eclipse I do File | Import | General | Import existing project into Eclipse. In the import dialog I open the workspace directory, then all of the projects are listed (most of then are greyed out because they are already in Eclipse) and I select the shopping2 project. That's it. Now I have a shopping2 project that looks exactly like shopping. By the way, I do this all the time, works great.

Oh, if your project is under source control, after copying shopping to shopping2, make sure you remove the source control data files - you don;t want to mess up the original project. For example, I always delete the .svn directories under shopping.
 
Martin Vajsar
Sheriff
Pie
Posts: 3747
62
Chrome Netbeans IDE Oracle
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Peter Johnson wrote:Oh, if your project is under source control, after copying shopping to shopping2, make sure you remove the source control data files - you don;t want to mess up the original project. For example, I always delete the .svn directories under shopping.

That depends on the source control software. In distributed systems, the copy can live independent life from the original, but still retaining all history. And in case the projects should be merged again, it is generally possible (though if they diverge a lot, it can be too hard to do).

In my opinion, distributed source control systems are ideal for small/hobby projects.
 
sai rama krishna
Ranch Hand
Posts: 411
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
File | Import | General | Import existing project into Eclipse. In the import dialog

Here I see two radio button options
1. select root directory
2. select archive file

which one shall i choose. Please advise
 
Kemal Sokolovic
Bartender
Posts: 825
5
Java Python Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you followed the guidelines given by Peter Johnson then the first option is the right one. Then click on Browse button and choose the directory where your project is copied to (e.g. shopping2).
 
sai rama krishna
Ranch Hand
Posts: 411
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
my project's name is ServletExample. Using a file manager I copy the shopping directory as ServletExample2 (in the same workspace). Then I edit the ServletExample2/.project file with a text editor changing the project name to shopping2. Then in Eclipse I did File | Import | General | Import existing project into Eclipse. In the import dialog I opened the workspace directory by selecting
select archive file option

as in the attachment.

It is asking for some file name which I am not sure. Please advise

importProject2.JPG
import project screen
[Thumbnail for importProject2.JPG]
 
sai rama krishna
Ranch Hand
Posts: 411
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
select root directory radio button option worked fine as in the attachment.

I wonder what are the differences between those two radio button options

Please advise
importProject3.JPG
import with first option
[Thumbnail for importProject3.JPG]
 
sai rama krishna
Ranch Hand
Posts: 411
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I have to run the same SErvletExample on NetBeans IDE how do I do it. Please advise
 
Kemal Sokolovic
Bartender
Posts: 825
5
Java Python Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Importing and Exporting Java Projects in Eclipse
 
Kemal Sokolovic
Bartender
Posts: 825
5
Java Python Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please PostTextNotScreenshots.

If you want to import an Eclipse project into NetBeans, go to File -> Import project -> Eclipse project...
  • To import an entire Eclipse workspace choose the first option (Import Projects from Workspace), then click Browse and navigate to your workspace folder.
  • To import only one Eclipse project choose the second option (Import Project ignoring Project Dependencies) and then specify location of project to import and destination folder.
  •  
    sai rama krishna
    Ranch Hand
    Posts: 411
    • 0
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    sure. I will avoid screenshot as much as possible.

    I imported the single eclipse project successfully into netbeans and working fine there as well.

    I see one issue. The URL it is launching the login page initially is

    http://localhost:8080/WEB-INF/


    which is continuiong later also.

    I expected some thing like

    http://localhost:8080/ServletExample2

    please advise
     
    sai rama krishna
    Ranch Hand
    Posts: 411
    • 0
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    How do I change context name. Please advise
     
    sai rama krishna
    Ranch Hand
    Posts: 411
    • 0
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    I did to imported an Eclipse project into NetBeans by going to File -> Import project -> Eclipse project.

    How to do otherway around. I mean how to import netbeans project into eclipse. Please advise
     
    Maneesh Godbole
    Saloon Keeper
    Posts: 10971
    11
    Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
     
    sai rama krishna
    Ranch Hand
    Posts: 411
    • 0
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    sure
     
    sai rama krishna
    Ranch Hand
    Posts: 411
    • 0
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    that other post is still has one valid open question as in the last comment

    Is there a typo? In Step III you said to copy from "c:\Users\Almir\Eclipse\ToEclipse\bin" and to paste it to "c:\Users\Almir\Eclipse\ToEclipse\bin". Same directory isn't it?

     
    Shishir Shivhare
    Greenhorn
    Posts: 7
    • 0
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    How to do otherway around. I mean how to import netbeans project into eclipse. Please advise


    If there is no option in eclipse for importing netbeans project then you have to create new project in eclipse and copy all files in it because .metdata of eclipse and netbeans are used to be different.
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic