Unable to import org.eclipse.datatools.connectivity.IConnectionProfile package - javadb

I am trying to connect to a javaDB using the eclipse DTP profile programmatically.
IConnectionProfile profile = ProfileManager.getInstance().getProfileByName("myprofile");
Is there a jar file that I need to add to the project?

For connectivity within your eclipse plugin, you need to have the DTP installed then add org.eclipse.datatools.connectivity to your plugin’s MANIFEST.MF file Require-Bundle section.

Related

cannot resolve a specific bundle from a manifest file

I downloaded a plugin for java bytecode metamodelling for eclipse.
I got problems running the application.
I have to import the Plugin as projects into eclipse and opening a new eclipse by running the plugin.
I get an error in the Manifest file as you can see in the screenshot.
The other bundles can be imported correctly, I just don't know why "org.objectweb.asm.util" can't be imported.
Screenshot of the Manifest file:
You can't use * in a Bundle id in the Require-Bundle entries in the MANIFEST.MF. The entries are the ids of plugins, you must add a seperate item to the list for each plugin you require. The ids are not package names.

How to import or extend existing CRS (CommerceReferenceStore) project into eclipse

I have successfully installed ATG10.2 and deployed CRS using CIM.
Now i want to import CRS Project into eclipse.
But i am unable to import it.
Please help me to import into eclipse (elipse ATG Plugin already installed).
This is a common tweak, I use it. If you are able to create a new ATG web module then you would be able to do this too.
Create a test application from your atg plugin, and copy its .classpath and .project files to the CommerceReferenceStore Folder under ATG root directory, don't forget to change the name of the project in the .project file. You can change the classpath after importing the project to eclipse.
then go to eclipse and import an already existing project (without using atg plugin), you are good to go.
If you want to get the individual modules as projects, add these two files to the individual modules and import them to eclipse.
Hope this helps!
Install the Eclipse plugin from %DYNAMO_ROOT%\Eclipse folder. Then add new exusting ATG project.

Servlet libraries are not defined in Eclipse

I am trying to make a simple servlet in Eclipse. But including the following libraries generates errors as if they were not defined in Eclipse.
import javax.servlet.*;
import javax.servlet.http.*;
How to have them recognised and defined?
Please add servlet-api.jar in classpath of your project.if you are using tomcat server, then it should be present in ${CATALINA_HOME}/lib
Be sure you are doing the right way:
If you are using the Classic version of Eclipse, then you must donwload the Web Tools Platform.
If you have an Eclipse Java EE Edition, then there is already installed the necessary plugins.
Create a new Dynamic Web Project: Menu New > Project > Dynamic Web Project.
Fill all values you want for the new project.
Do right click on the project and select New Servlet.
Last step creates a new Class file that is a servlet class, already importing the necessary packages, such as javax.servlet.http.*.
If you are using a Eclipse with a Maven plugin installed then, after configured it, you can only add the following dependencies:
http://mvnrepository.com/artifact/javax.servlet/servlet-api/2.5
http://mvnrepository.com/artifact/javax.servlet/jstl/1.2
http://mvnrepository.com/artifact/javax.servlet/jsp-api/2.0
In fact, you can see this tutorial explaining very well all the steps to create a Dynamic Web Prroject using WTP.
Or by ugin Maven, this one and this full explained.
Hope this help...

Adding jars to a Eclipse PlugIn

I try to build a Eclipse plugin that has to use a self written jar which is dependent on other jars, but I don't get the point where to start with handling jars as seperate PlugIns. Anywhere I have to use just the .jar files or am I wrong?
I think I found a proper solution; the trick is that you have to implement all the files via Eclipse. I just copy here the solution which was posted to news.eclipse.platform:
Include the jars in a plugin:
Use Import > File System to import the jar files into your plugin project, say in the <project>/lib directory.
Use Add... button to add the jars to the classpath section of the plugin.xml > Runtime tab.
Use New... button to add "." library back (with no quotes, of course).
Make sure your binary build exports the new jar files on the plugin.xml > Build tab.
Save
On the project, use context menu > PDE Tools > Update Classpath to correctly add the jars to the eclipse project classpath.
What is a self-written jar?
Normally you turn 3rd party jars into bundles using an OSGi MANIFEST.MF (See New>Plug-in Development>Plug-in from Existing JAR archive) or you include them in your plugin.jar and add extra Bundle-ClassPath entries as mentioned by TomaC.
If you mean at runtime your plugin will create a new jar and needs to load it, that's different, though.
Project Properties -> Java Build Path -> Add External jars. Is this what you are looking for?

How can I add the external jar to the eclipse rcp application?

I tried to add the apache vfs jar file as the runtime dependency. Even though it throws the below error:
java.lang.ClassNotFoundException: org.apache.commons.vfs.VFS
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:489)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:405)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:393)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:105)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at file_explorer.View.setInput(View.java:295)
at file_explorer.View.initialize(View.java:130)
How can i resolve this, thanks in advance.
If you are looking for adding the required jars to your project classpath.Add the required files to lib directory in the project structure.Then from project click the 'run time' tab of plugin.xml and add the required jars from the lib directory to the project classpath.
The best way to include external Jar in Eclipse RCP application is to package it as a plugin and then use classic plugin dependency.
Just create a new plugin containing only your Jar. Then in the build tab of the manifest editor, add your jar to the classpath (at the bottom right) and export all its packages in this same runtime tab. Also be sure to check that you jar is checked in the Build tab.
Nevertheless you should be able to use the jar in a Given plugin source code if you only add it to the classpath as I mentioned previously.
Because some other of your plugins may be interested in using the vfs jar and for separtion of concerns matter I think you should wrap it in its own plugin
The easiest way is to find bundle in an existing OSGI bundle repository.
http://bundles.osgi.org/Main/Repository
http://www.springsource.com/repository/app/
http://www.eclipse.org/orbit/
http://www.knopflerfish.org/repo/index.html
springsource repo contains apache VFS bundle
Then you need to add the bundle to the target platform (or just copy it to the dropins folder)
In order to properly install bundle into a newer version of eclipse you should use an existing p2 repository and install bundle from p2 repository into your runtime platform. There are two ways: you could use existing one (like orbit p2 repo), or you could create your own using p2 publisher as described at https://docs.sonatype.org/display/TYCHO/How+to+make+existing+OSGi+bundles+consumable+by+Tycho
Eclipse RCP is an OSGi environment which extends the Java dependency model, so you can't simply take a jar file and hope it works. To use an external jar, you have to build it to a plugin first, which p2-maven-plugin can help, you can follow the readme document.
With the plugin ready, you should install the plugin and add it to MANIFEST.MF. Then restart Eclipse to make the plugin work.
A more easily way, you needn't install the plugin, just follow(but build the jar):
go to plugin.xml -> Runtime tab;
click Add at the classpath section, then add the plugin to classpath;
make sure there is . path in the text area, otherwise New it.