How do I import *.java text files into an Eclipse project?

15,752

You can add your java files by simply dragging them to eclipse, then try doing this

Go to "Project" -> Clean

enter image description here

Then select all projects and click on Ok

Share:
15,752
dwwilson66
Author by

dwwilson66

Visual Communications Professional with a background in technology. In the thick of learning Java, PHP & MySQL to augment my web skills. I'm taking a shine to programming a lot more than I thought I would.

Updated on June 04, 2022

Comments

  • dwwilson66
    dwwilson66 almost 2 years

    I'm finally biting the bullet and starting use Eclipse (Europa for now) instead of command-line java and Notepad. However, I've not really organized my projects apart from naming conventions (e.g., ProjAClassname1, ProjAClassname2, ProjAClassname3, etc) and they're all in my JRE java/bin directory. I have a directory full of *.java files that I want to start organizing into a brand new install of Eclipse.

    I've followed the instructions in the Eclipse help files, googled for a while and I've found some excellent Stack answers on importing JAR files, importing existing Eclipse projects. However, none of these work. None of the resulting dialogs show a list of files to import/add; I think they assume that all my classes are contained in *.jar files instead of *.java files.

    I created java\bin\ProjA\src and copied all my source code *.java; same results. The closest I got was creating a new project, then dragging and dropping the *.jave files from Explorer to Eclipse. The classes all showed up as part of the project, but I had the little red x indicating "out of sync with file system", and even though I found this, none of the solutions offered in that answer worked for me.

    Before I start creating new classes and cutting/pasting from Notepad, I wanted to know if there were any other ideas floating out there?

  • dwwilson66
    dwwilson66 over 10 years
    Projcet > Clean got everything to say it was in sync...thanks.