In my Eclipse Java Build Path, I set Source Output Folders to:
WEB-INF/classes
and I put the config file globals.conf in this folder.
When I run Project - Clean, my config file globals.conf is gone
How can I keep my config file when I run Clean?
globals.conf should be putted under source folder, not source output folder.
Eclipse will copy all resource files(not *.java) in source folder into output folder.
Related
I have changed project build path to my webcontent folder, but it doesn't generate the class file to my new folder, still generate the class file to /target/classes.
I have checked the "Allow output folders for source folders", and give the default and output folder to webcontent folder. Eclipse still build to the older folder. Even restart.
Eclipse version is
Version: Luna Service Release 1 (4.4.1)
Build id: 20140925-1800
With M2E Installed
Hope you have changed "Default Output folder" in
project->properties->java Build path ->default output folder
I have a Project that I have built on Eclipse. I have a property file added in the src directory. The java class file is available in bin, but the property file is not available. Where am I going wrong?
Assuming the type of project is Java Project
Right click on the project and select properties option. Check in the Java build path all files under source folder are included or not and also check if some files are excluded.
In my case property file is being copied to bin folder. See the picture below.
Hierarchy of source folder and bin folder are same in my case.
If project is of type plugin project
Open the Manifest.mf file in Plugin Manifest editor and go to Build tab. Check the property file is selected here if NOT then select the file and check.
Edit:
Troubleshooting steps:
Simply Restart eclipse and completely clean and build the workspace and check.
I have a program that alters a file in my src/resources folder, but the file that gets selected is in the bin/resources directory. How can I tell Eclipse to modify the file in the src/ directory. I understand that the bytecode is executed from the bin/ directory and the file needs to be visible to that folder, but I would like to know if it is possible to reference the src/ file.
I am using:
File file = new File(MyClass.class.getResource("resources/test.xml").getPath());
to load my file, but I don't want the path to my bin/ directory.
The path is:
/C:/Users/Foo/workspace/MyProject/bin/resources/test.xml
If you add src/resources to Eclipse Build Path, the compiler will then copy the entire folder structure to your output directory (i.e. bin) in which case you refer to test.xml using the same code:
File file = new File(MyClass.class.getResource("resources/test.xml").getPath());
I read (and sometimes write in) a .txt file in my java project and I'd like it to be copied in the eclipse output folder called "bin".
Can eclipse do it while compiling ?
My project is like :
Project
Bin
blabla.class
...
Src
blabla.java
...
MyFile.txt
Thanks !
I think you need to actually move the text file to a sub-directory - something like "resources" and add that "resources" directory as a source directory to the project - Project/Properties/Java Build Path/Source/Add Folder. That doesn't mean that everything in a source folder has to be compilable.
I don't think that you would have another option, because if you would add the root directory as source folder, eclipse would complain, that it cannot nest source folders. So you need an additional (re-)source folder here.
The solution is :
use Eclipse Classic 4.2.1
click on "add project 'YourProjectName' folder to build path" while creating a new project (in Source tab)
Doing the right Include/Eclude stuff to select which files you want to copy
Suppose I extracted a Java project from a tar archive. How do I add it to Eclipse (Indigo)?
In the past when I have had to so something like this, I simply created a new Eclipse project with the same name and manually copied all the .java files into the proper folder down at workspace/projectName/src/topDomain/companyDomain/packageName.
Is there a better way?
File - Import... - Existing project into workspace.
This supposes that the tar archive contains the whole project, including the .project and .classpath files.
If it doesn't, then either make a new project where you want, and copy the source files, or create a project and specify that its location must be the directory containing the sources folder that you extracted from the tar.