Thursday, June 30, 2011

How to import NetBeans project into Eclipse

How to import NetBeans project into Eclipse

netbeansFew days ago, when I faced some issues with NetBeans IDE, I switched to Eclips. Now the problem was my work. Placing java files from one place to another seems easy. But preparing configuration file is really time-consuming. And as usual I avoid manual work. SO let's see what I did to import NetBeans workspace into Eclipse without wasting time
1


  1. There is a dist folder inside NetBeans workspace, containing a .war file. Import this war file into Eclipse. For this;
    1. Open eclips IDE > Go to File Menu => Import => War
  2. Above step will make package structure in Eclipse workspace similar to NetBeans. It'll also prepare configuration file. Now you need to place source files only. For this
    1. Go to src folder inside NetBeans folder => Copy all contents => Place them to src folder inside NetBeans folder.
    2. Right click on Project name in right side panel of Eclipse IDE => Refresh

Your Eclipse workspace is prepared. If above trick doesn't work for you refer another way;

2


OVERVIEW OF THE PROCESS

  1. Lets say you already have a NetBeans project created called MyProjectand located at <PATH>\MyProject
  2. open NetBeans and change the project settings
  3. create a ZIP file of the <PATH>\MyProject\MyProject.zip
  4. create a new folder <PATH>\NEW (or your choice), this is where we are going to create the Eclipse Project
  5. open Eclipse create a new project and import the ZIP file
  6. create a new folder <PATH>\NEW\MyProject\dist(necessary forNetBeans)
  7. Now you can DECIDE when to work with Eclipse or NetBeans

DETAILED PROCESS

  1. Let's say you already have a NetBeans project created called MyProjectand located at <PATH>\MyProject
  2. open NetBeans
    • open MyProject
    • Right click MyProject and select Clean Project (this deletes thebuild/classed and dist folders)
    • open the file project.properties located in the folder<PATH>\MyProject\nbproject
    • change the build.dir to bin
    • change the build.classed.dir to ${build.dir}
    • save and close the file

close NetBeans

  1. create a ZIP file of the <PATH>\MyProject\MyProject.zip that will contain this folders:
    • nbproject
    • src
    • Any other folder or file that is located at <PATH>\MyProject
  2. create a new folder <PATH>\NEW (or your choice), this is where we are going to create the Eclipse Project
  3. open Eclipse
    • go to Window, Open Perspective, Java
    • go to File, New, Project, Java Project
    • click NEXT
    • type MyProject
    • select Create project at external location
    • type <PATH>\NEW\MyProject (this folder will be created by ECLIPSE)
    • select Create separate source and output folders
    • click NEXT
    • click FINISH
    • Right click on MyProject (at the Package Explorer)
    • select IMPORT
    • select ZIP file (usually the last option on the list)
    • click NEXT
    • BROWSE and look for the <PATH>\MyProject\MyProject.zip created onSTEP 3
    • click FINISH

close Eclipse

  1. create a new folder <PATH>\NEW\MyProject\dist(necessary forNetBeans)
  2. Now you can DECIDE when to work with Eclipse or NetBeans



No comments:

Post a Comment