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.
当您在Eclipse中有一个Java项目时,如何更改类文件所在的位置?bin目录是默认位置。
5 个解决方案
#1
40
You can change the folder name from bin to something else.
您可以将文件夹名从bin更改为其他名称。
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
,...
右键单击项目并选择Properties。然后单击Java构建路径。在右边你可以看到标签源,项目,图书馆,…
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.
但是不能更改目录。例如,如果您的项目在D: drive中,您不能将输出文件夹保存在C: drive中。
#2
6
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:).
右键单击我们的项目——>选择properties——>选择Java构建路径——>选择Source选项卡。在选项卡的底部,您应该看到一个名为(默认输出文件夹:)的字段。
#3
4
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.
首先,在eclipse工作空间中创建一个新的空项目,用于存储生成的输出文件output_bin。
As mentioned in above steps, now from Default Output Folder we need a new Variable to link to our project output folder.
如上所述,现在从默认输出文件夹中,我们需要一个新变量来链接到项目输出文件夹。
- Default Output Folder -> Browse -> Create New Folder...
- 默认输出文件夹->浏览->创建新文件夹…
- -> Advance -> check "Link to folder in the file system" ->
- ->预存->检查“文件系统中的文件夹链接”->
- Variables -> New.. -> Name = PROJECT_OUT, Location = "CHOOSE_PATH_TO\output_bin\bin\Project1bin" -> Ok
- 变量- >新. .-> Name = PROJECT_OUT, Location = "CHOOSE_PATH_TO\output_bin\ \项目1bin" -> 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.
注意:Project1bin是一个存储bin文件夹的新目录。output_bin是一个空项目,您可以为不同的项目拥有多个bin文件夹。
#4
4
Right click on your project and select Properties.
右键单击项目并选择Properties。
Java Build Path --> select the Source tab
See the below image for more details:
详情如下:
#5
0
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中使用构建工具(如Gradle),您可能会因为在\bin下生成的类文件所导致的虚假构建错误而感到烦恼……因此,最好的方法是更改默认的输出文件夹:
(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.
(Eclipse Mars)窗口—>首选项—> Java—>构建路径—>输出文件夹名称:从“bin”更改为“Build”NB,但是请注意,只有在使用Java项目向导创建新的Java项目时,这个(当前)才会生效。我导入Gradle (STS)项目,发现我仍然需要手动从“bin”更改为每个项目的“构建”。
#1
40
You can change the folder name from bin to something else.
您可以将文件夹名从bin更改为其他名称。
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
,...
右键单击项目并选择Properties。然后单击Java构建路径。在右边你可以看到标签源,项目,图书馆,…
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.
但是不能更改目录。例如,如果您的项目在D: drive中,您不能将输出文件夹保存在C: drive中。
#2
6
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:).
右键单击我们的项目——>选择properties——>选择Java构建路径——>选择Source选项卡。在选项卡的底部,您应该看到一个名为(默认输出文件夹:)的字段。
#3
4
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.
首先,在eclipse工作空间中创建一个新的空项目,用于存储生成的输出文件output_bin。
As mentioned in above steps, now from Default Output Folder we need a new Variable to link to our project output folder.
如上所述,现在从默认输出文件夹中,我们需要一个新变量来链接到项目输出文件夹。
- Default Output Folder -> Browse -> Create New Folder...
- 默认输出文件夹->浏览->创建新文件夹…
- -> Advance -> check "Link to folder in the file system" ->
- ->预存->检查“文件系统中的文件夹链接”->
- Variables -> New.. -> Name = PROJECT_OUT, Location = "CHOOSE_PATH_TO\output_bin\bin\Project1bin" -> Ok
- 变量- >新. .-> Name = PROJECT_OUT, Location = "CHOOSE_PATH_TO\output_bin\ \项目1bin" -> 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.
注意:Project1bin是一个存储bin文件夹的新目录。output_bin是一个空项目,您可以为不同的项目拥有多个bin文件夹。
#4
4
Right click on your project and select Properties.
右键单击项目并选择Properties。
Java Build Path --> select the Source tab
See the below image for more details:
详情如下:
#5
0
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中使用构建工具(如Gradle),您可能会因为在\bin下生成的类文件所导致的虚假构建错误而感到烦恼……因此,最好的方法是更改默认的输出文件夹:
(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.
(Eclipse Mars)窗口—>首选项—> Java—>构建路径—>输出文件夹名称:从“bin”更改为“Build”NB,但是请注意,只有在使用Java项目向导创建新的Java项目时,这个(当前)才会生效。我导入Gradle (STS)项目,发现我仍然需要手动从“bin”更改为每个项目的“构建”。