I'm trying to export a plug-in into a jar. In this jar file I would like to include an extra file placed in the bin\com.example.myapp. This file is generated during compilation, but it's not copied automatically into the jar file when exporting the plug-in.
To include the file I selected the file in the Build Configuration tab for plugin.xml file. Thus, the following build.properties is created:
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
bin/com/example/myapp/myfile.bin
jre.compilation.profile = JavaSE-1.7
This works partially, because even though myfile.bin is included into the exported jar file, it is placed in "bin/com/example/myapp/myfile.bin" whereas I would like to be placed as "com/example/myapp/myfile.bin", without the initial "bin" folder. Is there a way to achieve that result?
You can change the bin output folder but I think it will apply to ALL files, not just one :
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.
Related
I have a Plugin that has p2.inf file in META-INF. This single p2.inf file works when I get a RCP product via eclipse product export wizard. Now I want other p2.inf files in other Plugins.
I put a new p2.inf file in another plugin's META-INF directory. I made it available in exported product by selecting it in build.properties file...
For experimenting I put another p2.inf file near MyRCP.product file and again I selected this new p2.inf file under bin.includes section of build.properties file.
But I cannot make other p2.inf files work? How can I have multiple p2.inf files under different plugins work ?
After an export only one p2.inf file runs which copies a folder. But other p2.inf files that update the myrcp.ini via command .p2.touchpoint.eclipse.addProgramArg and ...removeProgramArg does not work. (Why only one p2.inf file works and why the same p2.inf file is executed always ?)
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 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
As this documentation says, "For example if you place this jndi.properties file on your classpath", but how can I place the .properties file on my classpath if I am using Eclipse?
Just to add. If you right-click on an eclipse project and select Properties, select the Java Build Path link on the left. Then select the Source Tab. You'll see a list of all the java source folders. You can even add your own. By default the {project}/src folder is the classpath folder.
One option is to place your properties file in the src/ directory of your project. This will copy it to the "classes" (along with your .class files) at build time. I often do this for web projects.
This might not be the most useful answer, more of an addendum, but the above answer (from greenkode) confused me for all of 10 seconds.
"Add Folder" only lets you see folders that are the sub-folders of the project whose build path you are looking at.
The "Link Source" button in the above image would be called "Add External Folder" in an ideal world.
I had to make a properties file that is to be shared between multiple projects, and by keeping the properties file in an external folder, I am able to have only one, instead of having a copy in each project.
Well one of the option is to goto your workspace, your project folder, then bin copy and paste the log4j properites file.
it would be better to paste the file also in source folder.
Now you may want to know from where to get this file, download smslib, then extract it, then smslib->misc->log4j sample configuration -> log4j here you go.
This what helped,me so just wanted to know.
Copy the file into your src folder. Go to the Project Explorer in Eclipse, Right-click on your project, and click on "Refresh". The file should appear on the Project Explorer pane as well.
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.