Chris J
Chris J

Reputation: 9252

How do I change a Java project's bin folder in Eclipse?

When you have a Java project in Eclipse, how do you change the location where the class files are placed? The bin directory is the default location.

Upvotes: 41

Views: 70708

Answers (5)

mike rodent
mike rodent

Reputation: 15633

These answers only describe changing for one specific project.

But if you are using a build tool in Eclipse such as Gradle, you are likely to get annoyed by spurious build errors caused by class files being produced under \bin... the best thing is therefore to change the default output folder:

(Eclipse Mars)
Window --> Preferences --> Java --> Build Path --> Output folder name: change from "bin" to "build"
NB be aware, however, that this (currently) only appears to work when you create a new Java project using the Java project wizard. I import Gradle (STS) projects and find that I nevertheless have to change manually from "bin" to "build" for each project.

Upvotes: 2

Sumit Singh
Sumit Singh

Reputation: 15886

Right click on your project and select Properties.

Java Build Path --> select the Source tab

See the below image for more details:

enter image description here

Upvotes: 8

ashjtech
ashjtech

Reputation: 101

I would like to describe an approach below.

First, create a new empty project locally in eclipse work space for storing generated output files say output_bin.

As mentioned in above steps, now from Default Output Folder we need a new Variable to link to our project output folder.

  1. Default Output Folder -> Browse -> Create New Folder...
  2. -> Advance -> check "Link to folder in the file system" ->
  3. Variables -> New.. -> Name = PROJECT_OUT, Location = "CHOOSE_PATH_TO\output_bin\bin\Project1bin" -> Ok

Note: Project1bin is a new directory which stores the bin folder. output_bin is an empty project and you can have multiple bin folder for various projects.

Upvotes: 4

eSniff
eSniff

Reputation: 5875

Right-click on our project --> select properties --> select Java Build Path --> select the Source tab. At the bottom of the tab you should see a field named (Default Output Folder:).

Upvotes: 6

Puru
Puru

Reputation: 9083

You can change the folder name from bin to something else.

Right click on your project and select Properties. And then click on Java Build Path. On the right side you can see the tabs Source, Projects, Libraries,...

Click on Source. Check the Default output folder:. There you can browse and select the different folder you want.

But you cannot change the directory. For example if your project is in D: drive you cannot keep the output folder in C: drive.

Upvotes: 51

Related Questions