0

I have developed a wizard which I want to launch as a stand alone application(something like on the click of an icon /jar the wizard need to be launched) outside eclipse.

How do I make it into an executable jar. I have a main class that invokes the Wizard Dialog,but when I execute the jar,the Wizard isn't launched.

How do I make sure the equinox runtime is loaded before starting the application ? Any help ?

Santhosh
  • 534
  • 9
  • 24
  • possible duplicate of [How to generate an executable .jar from an Eclipse plug-in project?](http://stackoverflow.com/questions/6058488/how-to-generate-an-executable-jar-from-an-eclipse-plug-in-project) – oberlies Jul 14 '14 at 16:25

3 Answers3

1

If you want to run your plugin outside eclipse then your have to create Eclipse RCP product then you can export this product and run as an application.

See some examples here

http://obscuredclarity.blogspot.in/2008/11/hello-world-with-eclipse-rcp-your-first.html

RCP

Prodcut config

Product Export

Chandrayya G K
  • 8,719
  • 5
  • 40
  • 68
0

Creating a RCP is a solution, but depending of your need you can also export your plugins as runnable JAR file:

right click -> Export... -> Java -> Runnable JAR file

I always use the first option for "library handling", which is "Extract required libraries into gen JAR", the other options should also work fine.

Obviously you need to implement the main method somewhere.

Then if executing jar file do nothing you could try to debug-it by running from command-line:

java -jar <your jar>

EDIT: Here is my main method, and it works by running from the exported jar file

public static void main(String[] args) {
    Display display = new Display();
    Shell shell = new Shell(display);
    shell.setSize(0, 0);
    shell.setVisible(false);

    shell.open();

    WizardDialog dialog = new WizardDialog(shell, new __YOUR_WIZARD());
    dialog.open();

    shell.dispose();
    display.dispose();
}
Julien D.
  • 65
  • 7
  • 1
    Eclipse plugins almost always depend directly or indirectly on many core Eclipse plugins. These core plugins must be initialized correctly which won't happen using this method. This initialization is a significant part of what the Eclipse RCP system does. – greg-449 Mar 13 '14 at 08:15
  • Agreed, that's why I put the "depending of your needs"... Anyway this solution works, and is acceptable in some cases according to Eclipse dependencies you require. – Julien D. Mar 13 '14 at 08:31
  • If the goal of the relevant application is only to open a Wizard Dialog, then perform something and finish I definitely think that the RCP is like using a cannon to kill a fly... – Julien D. Mar 13 '14 at 08:39
  • Thanks for the replies .The intention is to have the wizard on SWT Jface and hence done it as a plugin project and invoking via a main class.Is it possible to create it as an RCP but when I lauch only the Wizard should appear ? – Santhosh Mar 13 '14 at 09:37
  • IMHO, with the info we have, the RCP is useless for your need... You could try by adding the piece of code in **EDIT** (replacing by your Wizard class) and check if the wizard is well opened when running the main from Eclipse. Then if -yes- try the export solution and the java -jar – Julien D. Mar 13 '14 at 12:21
0

Thanks a ton for your valuable comments. I found the solution. Please create Java project and add the following 12 plugin jars as referenced libraries

org.eclipse.osgi, org.eclipse.core.commands, org.eclipse.equinox.common, org.eclipse.equinox.registry, org.eclipse.core.runtime, org.eclipse.text, org.eclipse.swt.win32.win32.x86_64, org.eclipse.jface,eclipse.jface.text, org.eclipe.ui.workbench, com.ibm.icu_50.1.1, org.eclipse.ui.forms

This will work out for any SWT application that need to be launched directly without any RCP product.This can also be done via a tool "Windows Builder" wherein the dependencies are automatically added when a SWT/JFACE Java project is created

Santhosh
  • 534
  • 9
  • 24