DIfference between Eclipse Application and Java Application Run Configurations in Eclipse

Dear all,

I'm creating a runnable Jar file, when I try to select the run configuration it only displays Java Run configurations.  The run configuration I'm trying to use is an Eclipse Run Configuration.

What is the difference and workaround?

I haven't noticed this issue before.

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

I think Eclipse Run config is for eclipse applications only i.e eclipse plugin development.
AndyC1000Author Commented:
How to convert from Eclipse Run Config to Java Application Run Config?

The difference between the two configurations is JRE, Classpath and Source.

Are the plugins added under the class path?  Any way to copy from the existing run configuration (config.ini) to the java run configuration?

I've copied a portion of the config.ini and added the eclipse launch configuration below.

#Configuration File
#Thu Oct 15 17:06:18 EST 2015
osgi.install.area=file\:C\:\\Kepler SR1\\eclipse
osgi.framework=file\:C\:/Kepler SR1/eclipse/plugins/org.eclipse.osgi_3.9.1.v20130814-1242.jar
osgi.bundles=reference\:file\:C\:/Workspaces/Current/org.jgap,reference\:file\:C\:/Kepler SR1/eclipse/plugins/org.eclipse.ui.views_3.6.100.v20130326-1250.jar,reference\:file\:C\:/Kepler SR1/eclipse/plugins/org.eclipse.e4.core.services_1.1.0.v20130515-1343.jar,reference\:file\:C\:/Kepler SR1/eclipse/plugins/org.eclipse.emf.ecore_2.9.1.v20130827-0309.jar,reference\:file\:C\:/Kepler SR1/eclipse/plugins/org.apache.batik.css_1.6.0.v201011041432.jar,reference\:file\:C\:/Kepler SR1/eclipse/plugins/org.eclipse.e4.ui.workbench.swt_0.12.1.v20130815-1438.jar,reference\:file\:C\:/Kepler SR1/eclipse/plugins/javax.inject_1.0.0.v20091030.jar,reference\:file\:C\:/Kepler SR1/eclipse/plugins/org.eclipse.core.jobs_3.5.300.v20130429-1813.jar,reference\:file\:C\:/Kepler SR1/eclipse/plugins/org.apache.commons.lang_2.6.0.v201205030909.jar,reference\:file\:C\:/Kepler SR1/eclipse/plugins/org.eclipse.emf.edit_2.9.0.v20130902-0605.jar,reference\:file\:C\:/Kepler SR1/eclipse/plugins/org.eclipse.ui.forms_3.6.1.v20130822-1117.jar,reference\:file\:C\:/Kepler SR1/eclipse/plugins/org.eclipse.ui.workbench_3.105.1.v20130821-1411.jar

Eclipse Run Configuration .Launch
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.pde.ui.RuntimeWorkbench">
<setAttribute key="additional_plugins"/>
<booleanAttribute key="append.args" value="true"/>
<stringAttribute key="application" value="usp.slf.app.application"/>
<booleanAttribute key="askclear" value="true"/>
<booleanAttribute key="automaticAdd" value="true"/>
<booleanAttribute key="automaticValidate" value="false"/>
<stringAttribute key="bootstrap" value=""/>
<stringAttribute key="checked" value="[NONE]"/>
<booleanAttribute key="clearConfig" value="false"/>
<booleanAttribute key="clearws" value="false"/>
<booleanAttribute key="clearwslog" value="false"/>
<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/RPI"/>
<booleanAttribute key="default" value="false"/>
<stringAttribute key="featureDefaultLocation" value="workspace"/>
<stringAttribute key="featurePluginResolution" value="workspace"/>
<booleanAttribute key="includeOptional" value="true"/>
<stringAttribute key="location" value="${workspace_loc}/../runtime-RPIApp"/>
<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
<listEntry value="org.eclipse.debug.ui.launchGroup.run"/>
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog region data.slfcore -root C:\\RPI"/>
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xms1G -Xmx48G -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC -Djava.util.logging.config.file=slflogging.cfg"/>
<stringAttribute key="pde.version" value="3.3"/>
<stringAttribute key="product" value="org.eclipse.platform.ide"/>
<setAttribute key="selected_features">
<setEntry value="usp.slf.dependencies:default"/>
<setEntry value="usp.slf:default"/>
<booleanAttribute key="show_selected_only" value="false"/>
<stringAttribute key="templateConfig" value="${target_home}\configuration\config.ini"/>
<booleanAttribute key="tracing" value="false"/>
<booleanAttribute key="useCustomFeatures" value="true"/>
<booleanAttribute key="useDefaultConfig" value="true"/>
<booleanAttribute key="useDefaultConfigArea" value="true"/>
<booleanAttribute key="useProduct" value="false"/>

Lets back track a bit.

You have a java applicaton. You want to run it from eclipse?
Right click > run as Java application.
Become a Microsoft Certified Solutions Expert

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

AndyC1000Author Commented:
I'm trying to creating a runnable Jar in order to run the software using a batch file on users machines.  

When I try to select the run configuration after export -> Java -> Runnable Jar etc. it only displays Java Run configurations.   The run configuration for the code is an Eclipse Run Configuration.  I'm trying to find a way to create a Java run configuration because there are many plugins and dependencies.

I've taken over this code and the developer has moved on. So I'm trying to use the config.ini and Eclipse Run Configuration .Launch to make sure I don't miss anything.
Is this an eclipse plugin application?

If you want to create a jar to distribute to users machines, just File > export > Java Jar file. Which will package up your code in a Jar file.

I'm still not clear why you would want to "execute" the jar from eclipse. If thats what you want, then perhaps you could use an external tool config.
Run > External Tools Configuration > program.
AndyC1000Author Commented:
I've created a jar to package the code to run on other machines using export > Java> jar.   I'm now having difficulties how to run the jar file.  I've tried:
java -jar slf.jar au.ces.app.Application arg1 arg2 arg1 arg3 arg4
Exception in thread "main" java.lang.NullPointerException
        at sun.launcher.LauncherHelper.getMainClassFromJar(LauncherHelper.java:3
        at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:463)

I wanted to create a runnable jar using an eclipse run configuration because I know run configuration executes the code and has all the plugin dependencies.  But the issue is an Eclipse Run configuration cannot be selected when creating a runnable jar.

I'm not wanting to execute a jar from eclipse.
Amitkumar PSr. ConsultantCommented:
Check if your java file contain manifest file within META-INF directory. If so, check it has an entry for main class as given below.

Manifest-Version: 1.0
Class-Path: swt.jar
Main-Class: mypackage.MyClassWithMainMethod
(blank line at end of file)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.