- put all source files into one directory named after your project. i.e. "projectname" you can keep this directory in your workspace or it can be somewhere else.
- start a new project in eclipse and name it using that same project name.
- uncheck the "use default location" box and find the directory where your project is unless your project is already in the workspace - then you must not uncheck the "use default location" box
- click 'next'.
eclipse should be smart enough to figure out what's going on. after clicking next, it will show you all of the files it found in that directory. it will just automatically add those files to your project. voilà!
follow this instructions from standard eclipse docs.
- from the main menu bar, select command link file > import.... the import wizard opens.
- select general > existing project into workspace and click next.
- choose either select root directory or select archive file and click the associated browse to locate the directory or file containing the projects.
- under projects select the project or projects which you would like to import.
- click finish to start the import.
in the package explorer and the navigation screen you should now see the project you created. note that eclipse will not copy your files, it will just allow you to use the existing source and edit it from eclipse.
there are several ways to add files to an existing java project in eclipse. so lets assume you have already created the java project in eclipse (e.g. using
project... - and select
to get java files into the new project you can do any of the following. note that there are other ways as well. the sequence is my preference.
- drag the files into the
navigatorview directly from the native file manager. you must create any needed java packages first. this method is best for a few files in an existing java package.
file system. here you can then select exactly which files to import into the new project and in which java package to put them. this is extremely handy if you want to import many files or there are multiple java packages.
- copy the fires directly to the folder/directory in the workspace and then use
refreshto refresh the eclipse view of the native system. remember to select the new project before the refresh.
the last one is what you did - minus the refresh...
while creating a project from a full folder may or may not work within the workspace, there's a condition outside of the workspace that prevents starting a new project with a full folder.
this is relevant if you use numerous folder locations for sources, for example an htdocs or www folder for web projects, and a different location for desktop java applications.
the condition mentioned occurs when eclipse is told to create a new project, and given a full folder outside the workspace. eclipse will say the folder isn't empty, and prevent creating a new project within the given folder. i haven't found a way around this, and any solution requires extra steps.
my favorite solution is as follows
- rename the full folder with an appended "original" or "backup.
- create the eclipse project with the name of the full folder before the folder was renamed.
- copy all the relabeled full folders contents into the new project folder.
eclipse should make a new project, and update that project with the new folder contents as it scans for changes. the existing sources are now part of the new project.
although you had to perform three extra steps, you now have a backup with the original sources available, and are also able to use a copy of them in an existing project. if storage space is a concern, simply move/cut the source rather than fully copy the original folder contents.
if you creating a new project based on an existing maven structure :
create the project using a general project wizard and give the project the same name as just created.
if you try to create the project as a maven project via m2e will receive an error that project/pom already exists.
- create a new project..
- right click on your project..
- select build path --> configure build path
- under source tab choose link source, your .java files containing folder..
i am suggesting this since none of the methods that you tried have worked ---fyi
there are two things
1- if its already a eclipse project, then simply go to file->import->general->existing project into workplace
2- otherwise define project type e.g. java, web etc create a new project of type you define into your workplace. copy paste source , lib and other necessary files. refresh, compile and run project in eclipse.
the easiest method is really good but you don't get a standard java project, i.e., the .java and .class files separated in different folders.
to get this very easily:
- create a folder called "projectname" on the workspace of eclipse.
- copy or move your folder with the .java files to the "projectname" folder.
- create a new java project called "projectname" (with the use default location marked).
<enter>and that's it.
this answer is going to be for the question
how to create a new eclipse project and add a folder or a new package into the project, or how to build a new project for existing java files.
- create a new project from the menu file->new-> java project
- if you are going to add a new pakcage, then create the same package name here by file->new-> package
- click the name of the package in project navigator, and right click, and import... import->general->file system (choose your file or package)
this worked for me i hope it helps others. thank you.
- right-click in the package explorer and select new - java project
- create the new project game
- open the new project in the package explorer - you should see only the source folder called src (there's nothing inside yet)
- open a file explorer (e.g. windows explorer) and drag your sources
- drag them to eclipse and drop them inside the new src folder - if asked select "copy files"
- eclipse should put the files into the default package, if that's not correct you can edit the offending files (marked with a red cross) by opening them in eclipse, selecting the package declaration (usually line 1), pressing ctrl + 1 and selecting the appropriate option (e.g. "move xy to package com.game"
- How to create a project from existing source in Eclipse and then find it?
- How to create an android Project from existing source in eclipse with ADT 20.0.X and SDK r20
- How do i create a GNU Autotool Project in Eclipse CDT from existing C++ source code?
- Eclipse: how to keep project source files and ant build.xml seperate from eclipse workspace?
- How to use the same source from PhoneGap Build and PhoneGap Android project in Eclipse
- How to create Eclipse project from existing git repo
- How do I create a new eclipse project for jetty from a tomcat based project and versioned with svn/subclipse?
- How to create a maven project which will work in eclipse and from command line
- How to get Eclipse and IntelliJ working together in an existing project of IntelliJ (optional with changes in source directly transferred)
- Create android project from existing source in eclipse
- Create Eclipse project automatically from existing source code
- Eclipse "Invalid Project Description" when creating new project from existing source
- How to Create Flowchart from java source code in Eclipse
- How do I create a remote git repository in EGit and link it to an existing Eclipse project?
- How to create Jar file from Maven project in eclipse
- Eclipse 3.4 GWT 1.6 project - how to reference source from other projects?
- How to transfer Eclipse workspace and project from Windows to Linux and Mac
- What is the difference between Eclipse "Import" and "Create project from existing source" for Android projects?
- How to create new android project in eclipse and share in local git repository?
- How to remove Eclipse project related files without deleteing the source from Eclipse
- How to create new project from GIT repo using Eclipse EGit
- How to add existing files to project using Eclipse and PyDev
- How to create a git project from an existing maven project in Eclipse?
- How to create runnable jar with resources in Eclipse from Maven project
- How to create spring boot project from existing maven project
- How create a java project for both intellij and eclipse ide's
- How to create a jar file from an eclipse java project that uses *.jar files added in "Classpath"
- How to make eclipse tomcat use ant script to create a war and then deploy it
- "Could not find or load main class" after removing Maven nature and files (pom.xml, target/) from an Eclipse Project
- How to copy my Java Eclipse project to desktop, and then run with the command line?
More Query from same tag
- How Can I stop gwt's embedded server
- How to enable the bar showing file location in Eclipse
- Prevent LogCat Session Filter from stealing focus
- connecting remote mysql database using IP address of the remote system in android emulator
- Create Parent Maven Project from Existing projects
- How to create a "for" loop to add not only a value but also an indentifier. Android, Eclipse IDE
- Eclipse editor code editing
- How to download/clone a new branch from my server git repository into an already created local git repository in my PC with Eclipse EGit
- Tomcat: The server encountered an unexpected condition that prevented it from fulfilling the request
- Automatically format statement when I type a ; (semicolon) in Eclipse
- How to update Eclipse GWT Plugin 2.6.0 to higher version
- How to implement this keyword in main class?
- Missing parameter for pluginExecutionFilter eclipse jpbm 7.12 project
- How to Include additional javax.* packages in Android App with Eclipse?
- Bringing unit testing to an existing project
- Felix FileInstall configuration in Eclipse
- How to connect multiple xml files
- How to add DLLs while building a JAR - Eclipse
- Eclipse debug output file with timestamp
- Java program Opencv unsatisfiedlinkerror
- build-helper-maven-plugin add-source doesn't work
- how to uninstall Angular IDE plugin from Eclipse Oxygen?
- Android Sqlite java.lang.nullpointer exception
- Create simple listView using Fragment Android
- running selenium webdriver test cases against multiple browsers
- Why console gives me "Unable to find jdbc"
- Error inflating XML android.support.v7.widget.CardView
- how to make c-highlight in eclipse?
- Line numbers don't show in aptana plugin for eclipse
- Import and run WAR on eclipse