how to get value of eclipse .classpath classpathentry - eclipse

I am writing some eclipse plugin that will do some work for BlackBerry developers.
This is the .classpath file entry of my BB project:
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/net.rim.ejde.BlackBerryVMInstallType/BlackBerry JRE 5.0.0"/>
Using this information is it possible (programmatically) to find out the exact location of the rim plugin on the disk ?
In my case I am looking for the following pass:
D:\WORK\eclipse-java-galileo-SR2-win32\eclipse\plugins\net.rim.ejde.componentpack5.0.0_5.0.0.25
But I need to find the pass from my Eclipse Plugin java code.
My second question is how can i get from code .classpath file of my BlackBerry project.
Regards,
Slavik.

You can get the classpath entries from your IJavaProject, which you can get from your IProject something like this:
IJavaProject javaProject = (IJavaProject) JavaCore.create(project);

Related

IntelliJ IDEA - Eclipse .classpath files and relative locations?

I'd like to use IntelliJ IDEA with an Eclipse project, without converting the project format.
The main problem I'm running into right now is that in my .classpath file, we have entries like:
<classpathentry kind="lib" path="/lib/whatever.jar" />
In Eclipse, that path is relative to the workspace root. But in IntelliJ, I believe it's looking for the actual "/lib" folder on my hard drive, which obviously doesn't exist.
How can I maintain the Eclipse functionality while having IntelliJ look in the "lib" module in my project? Is there a variable that both support?

Adding external folder jar in to build path

In my RCP plugin application, earlier having a folder at project level "neededJar" in which i have all external jar needed in project build
But now I want to put all jar at a common library say a lib folder in installation directory, at my workspace i added needed jar as project->build path->configure build path->add external jar it works but when I export the plugin project it is not able to resolve dependency.
I also tried to give it as class path variable but it did not work.
My classpath entry is as follow:
<classpathentry kind="var" path="MY_JAR"/>
<classpathentry kind="var" path="MY_JAR/MYClasses.jar"/>
<classpathentry kind="var" path="MY_JAR/jMYlex.jar"/>
<classpathentry kind="var" path="MY_JAR/MYsm.jar"/>
By digging i got to know, not sure about it I am missing some entry in Manifiest.MF and build properties.
Please count what are the steps that i am missing. Please suggest me through process to add external jar in plugin project
update: it is yet not answered well.
You could use a linked folder.
Create a new folder in your workspace, but open the "advanced" tab in the wizard. Chose "Link to alternate location".
Just be careful with references to folders outside your workspace, since they have a tendency to move from time to time :).

Eclipse classpath container - file for defining associated jars

I have a .classpath file with entries such as
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/current-3d"/>
I can then add external user libraries to that container inside eclipse.
But which file is updated once I've done this? I.e. is there a similar xml file that says JAR's x,y + z are associated with the current-3d container?
Right I did actually find the answer, turns out it's the org.eclipse.jdt.core.prefs file, more info here Where/How does Eclipse store user libraries?
And the specific entry for the jars/user libraries is like so
org.eclipse.jdt.core.userLibrary.current-3d=<?xml version\="1.0" encoding\="UTF-8"?>\r\n<userlibrary systemlibrary\="false" version\="1">\r\n\t<archive path\="C\:/Users/pstatham/javacode/master/RunImported/3d/jgl.jar"/>\r\n</userlibrary>\r\n

The project XXX does not have any GWT SDKs on its build path

Sometimes, when I start Eclipse (Java EE IDE for Web Developers, Indigo SR 1) on my MacOSX Lion, my GWT (2.4.0) project initially fails to compile.
Eclipse displays the following message in the "Problems" section:
The project XXX does not have any GWT SDKs on its build path
Here is a list of semi-solutions that sometimes work (I normally try them in this order):
Project > Clean.
Remove and re-add GWT SDK to the build path.
Restart the machine.
Any help with preventing the problem from re-occurring would be most welcome.
I encountered the same problems as described above. But none of the solutions worked.
What did work was moving the GWT SDK above the other GWT dependencies in the build path. See the following blog (written by my personal hero of the day):
Grant Little's Blog
I believe the problem was occurring because Eclipse had some stale settings about available/linked GWTs.
Therefore, building on the answer by Chris Cashwell, I recommend the following:
Remove all GWTs from your build path. (You might have more than one GWT on your build path.)
Remove all GWTs linked in Eclipse in Project>Properties>Google>Web Toolkit>Configure SDKs, .
Add only the latest GWT, and make it default.
EDIT: Sometimes, I still need to do a Project > Clean, but this is rare now.
I tried the above, but had to do a bit more:
From above:
Remove GWT SDK from my project
Remove all GWT SDKs from eclipse
Download new GWT SDK (2.5.0)
Add it to eclipse and to my project
What I did extra:
Edit the .classpath file of my project
Move the classpathentry for GWT to just under 'src'
Save the .classpath file
Close the project
Open the project
And that did it for me. Moving it in the Build Path GUI did not seem to work for me!
So, the start of my .classpath ended up looking like this:
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="com.google.gwt.eclipse.core.GWT_CONTAINER"/>
etc...
Project->Properties->Java Build Path, find GWT SDK in this list, click Edit.
If Use default SDK is checked make sure the default is available. If not, click Configure SDKs... and make sure you don't have an x symbol on your SDK. If so, remove it and re-add it.
If Use specific SDK is checked, make sure you've selected one that is available.
In my case the GWT_CONTAINER was added below the JRE_CONTAINER.
Fixing this manually within my .classpath file solved the problem!
<classpathentry kind="con" path="com.google.gwt.eclipse.core.GWT_CONTAINER"/>
<classpathentry exported="true" kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
Also an other soulutin is to move the GWT SDK to the top of the Library list(right after your project) on the Properties/Java Build Path/Order and Export page.
You could use maven for compilation and setting up your workspace.
However I guess this would be overkill for you.
There is a Maven GWT Plugin.

Eclipse Plug-In Dependencies Vanished

I am developing OSGi in Eclipse, and the plugin dependices has vanished for a project.
I have checked .classpath, and it seems fine:
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
I have tried starting eclipse with -clean and I have tried creating a new workspace and importing the projects into that workspace - no luck with either.
Any ideas? :)
Some strange eclipse bug. Re-edited the manifest file, and the dependencies reappeared and the project successfully compiled.
In case anyone still encounters this issue, the solution that worked for me eventually was (on Eclipse 4.3)
Delete the org.eclipse.pde.core.prefs file under the .settings folder in the plugin project
Remove/Delete the project from the workspace
Re-import the project back into the workspace
This should fix the Plug-in Dependencies entries for that project.
Hope it helps!
Check that you defined a valid target platform in Eclipse.
Go to Window -> Preferences -> Plug-in Development -> Target Platform.
When importing the plugin it was set to an empty target platform, you can verify this by first edit the selected target, then selecting the content tab of the target platform, it's empty.
I changed the Target Platform to 'Running Platform (Active)'.
This imported the necessary libs in the project, they were added to the plugin dependencies.
You can also opt to define your own custom target platform but that needs some more work and knowledge.
The .classpath file is for Java builder only. Dependencies are in META-INF/MANIFEST.MF