Making a jar from a Eclipse RCP app - java

how can i make a runnable Jar from an RCP app (e.g. the mail template).
In the MAINFEST.MF under exporting -> Export Wizard i can export the project as a JAR File.
When i try
java -jar mail_1.0.0.201301161746.jar
it says
Failed to load Main-Class manifest attribute from mail_1.0.0.201301161746.jar
cause there is no Main-Class:xyzclass entry in there (cause it's a rcp app).
So what do i add there or how can i make it runnable?

I don't think that you need to.
Once you have your application configured/developed/branded you can export it as an eclipse product.
To do this Right click the project > Export > Plug-in development > Eclipse product
You are going to need a configuration file to do that.
You can create it by clicking the new project button on Eclipse > Plug-in development > Product Configuration I suggest you give the file the name config.ini.
For more information pls refer:
http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.pde.doc.user%2Fguide%2Ftools%2Feditors%2Fproduct_editor%2Fconfiguration.htm

An RCP app is running in Equinox (an implementation of OSGi), hence a one-jar export is not possible.
The entire notion of OSGi is to provide a modular architecture.

Related

How do I "export" this Eclipse plugin from sources?

I'd like to use this Eclipse plugin:
https://marketplace.eclipse.org/content/opencl-development-tool#group-details
with my Eclipse 2019-09. But - there's a version incompatibility, or so I'm told. It's been suggested to me that I might be able to use the plugin sources to "export it yourself as a deployable in order to install it".
But it's not at all clear to me how I'm supposed to do that. I'm not fluent with building Java artifacts nor with Eclipse plugin development and deployment. At the link above, there are several repositores, and most of them are only two or three files, one of them being pom.xml. Only one seems like a proper repo (this one).
What do I do with these repos and how can I make a plugin I can install in Eclipse, using them?
Looks like it's become simpler over time--there's a wizard with options for doing this once you've got the plug-in in your workspace compiling cleanly. Install the Plug-in Development Environment for your version of Eclipse. It should be in an update site already in your list of Available Software Sites (that's a preference page). Then, follow the steps of the Export and Install into the Running Host task in the built-in Help. The first 3 sentences of that task refer to the normal process of debugging plug-ins from source projects in the workspace. The rest of it is a guide to exactly what needs to be done here.
Here's the link to the 2020-03 version of that documentation:
https://help.eclipse.org/2020-03/topic/org.eclipse.pde.doc.user/tasks/ui_export_install_into_host.htm?cp=4_2_4_0
And the relevant parts:
...it is sometimes necessary for code to be tested in your host, your currently running Eclipse instance. To test code in the host, you need to export and install into the running Eclipse instance.
To export plug-ins and features and install them into the host Eclipse do the following:
Develop your plug-ins and features in the workspace
Open the export wizard, either Open the plug-in export wizard File > Export... > Plug-in Development > Deployable plug-ins and fragments or Open the feature export wizard File > Export... > Plug-in Development > Deployable features
Select your plug-ins or features to export and install
Select the last option on the Destination tab Install into host. Repository. Then choose a directory to create the repository in
Hit Finish. The export operation will run followed by the installation operation.
If the operations completed successfully, you will be prompted to restart. Choose to restart now
our plug-ins will be installed and running after the restart. You can see what has been installed using the Installation Details button on the About Dialog (available by going to Help > About Eclipse SDK)

Exporting an E4 Application

I have a feature based E4 application that I'd like to export as an executable project (.exe since I'm under windows).
I'm following the automated procedure called "Export Project Wizard" but despite I'm getting a .exe file + some JAR's in the same export folder, when I run it I get this error message: "org.eclipse.e4.core.di.InjectionException: java.lang.NoClassDefFoundError com/test/test1"
com.test.test1 is an external plugin which I included in the depedency tab, and it seems that Eclipse won't find it.
How can I work it out? Should it not automatically export all the required plugins?
I also tried to export that plugin manually, as JAR, but it didn't work.
Thanks
Use 'Export > Plug-in Development > Eclipse product'. This will require you to specify the xxx.product file that was created when you created your e4 application.
You can also launch the same wizard from the xxx.product editor by clicking 'Use the Eclipse product export wizard'.
You must configure your xxx.product file to specify all the features that you are using - your own features and the standard Eclipse features (on the Dependencies tab). For example on my product I have:
my feature
org.eclipse.e4.rcp
org.eclipse.emf.common
org.eclipse.emf.ecore
the 3 Eclipse features are the minimum needed for an e4 application.
Your feature must list all your plugins in its feature.xml plus any dependencies that are not covered in any other feature. Every plugin you want to use must appear in one of the features.

How to remove reference of a jar file in a java based web application?

I have a java based web application, which has certain java files and due to some need, i have added some jar files with in the project and made it project specific.
Now, While deploying them in production, I see, that the web file server (tomcat6) already has those jar files in its global library. Now, How do i remove reference of that jar file it, with out disturbing my code(which is working fine).
I saw in other article saying we just have to change the build path to refer the global library instead of local library.
Finally I have 2 questions.
How to do this?
If i'm working on windows and using path while configuring the build path, will it not be a problem if i deploy it in Unix environment.?
Please suggest. Also, its the problem with servlet-api.jar.
I use eclipse IDE. So how to perform these changes in eclipse?
Open your web project in eclipse and right click on the project. click on Properties and then choose build path and remove the jars you want to remove under the tab 'Libraries' and then export the war and deploy it in your tomcat6 server. if you want to run your web application in eclipse, you have to configure the server libraries by clicking 'Add Library' button in build path and then choose server runtime and choose the tomcat6 server configured in eclipse. Hope this helps

Java Application executed from Desktop

I have made a java application in Eclipse and it has a Main class which has the main method from which the application runs. I want that i should be able to run the application from outside the eclipse maybe by clicking on some icon.
Can anyone guide how that might be possible?
Create a Java .exe/.jar file
Create JAR file in Java & Eclipse
JAR file using Eclipse IDE
Right click on your project, which you want to create a JAR file of. And select Export from the context menu.
Select JAR file from Java folder and click Next.
Provide the Destination path and click on Finish to create the JAR.
You should build the application first,then you'll find a file with the extension ".jar" in the project's directory
you can run this jar anywhere
Once you have a Jar, you might also deploy the app. using Java Web Start.
JWS can do desk-top integration tasks like providing a desktop icon (with customized icon) and/or menu item. JWS also offers many other nice features like configurable automatic update & file associations, and offers a comprehensive API that is only available to JWS apps. The JNLP API makes persistence, single instance code and other things easy.

Runtime configuration of a project without an IDE

Say i have a java project setup in eclipse. i have all the thirdparty jar's and reading the resources etc set in the eclipse IDE.
ie all the classpath etc are set through the IDE
Now if i want to launch my app from commandline.
Can i get some hints/ links where i can undersand the configuration settings that can be done in Unix / windows machine to launch the application.
Looking for runtime configuration settings.
Because in production environment there is no IDE involved?
Also How do i set classpath in the server say jboss?
You can include the classpath and dependencies info in the Manifest of your application.
And in addition, you can consider ant if you want to be able to build your project on a machine without an IDE at all.
Is there any information that you specify in Eclipse and you need to use in your production env?
Use Eclipse 3.5
Create a launch configuration by selecting your class containing the main method, and running it.
File -> Export -> Java -> Runnable Jar
Personally I like the "put libraries in a sub-folder" since that does not merge jars or use a custom classloader.
The generated jar file can be executed with "java -jar whatever.jar".
You can redo this easier by either generating an ant script or making the launch configuration a shared file.
(Run -> Run configurations. Select launch configuration, Choose "Common" pane. Choose "Shared file" and select a place to put it.

Categories