How to convert a Flowable project to jar using Eclipse

I am using Eclipse,when I run the program it runs fine,but when I try to export it to jar and run this in command window it gives an error unable to find the process definition xml file.My xml file is request.bpmn20.xml for which error is comming.Plzz help

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:rsrc:slf4j-log4j12-1.7.21.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:rsrc:slf4j-log4j12-1.7.21_2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
log4j:WARN No appenders could be found for logger (org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Exception in thread “main” java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
Caused by: org.flowable.engine.common.api.FlowableIllegalArgumentException: resource ‘request.bpmn20.xml’ not found
at org.flowable.engine.impl.repository.DeploymentBuilderImpl.addClasspathResource(DeploymentBuilderImpl.java:78)
at SchedulingTest.SchedulingClassTest.main(SchedulingClassTest.java:22)
… 5 more

How do you ‘export’ the jar?

If you’re using Maven/Gradle/…, you have to make sure it’s in the right folder. For Maven for example that’s src/main/resources.

If you’re not using any of these, you have to make sure the xml is part of a ‘source folder’ (you can check this in Eclipse), to make sure it’s exported.

Yes I have my xml file in scr/main/resources

In that case, you can’t use the export of Eclipse, cause it doesn’t know about maven.
On the command line for that project, you can do a ‘mvn clean package’ to get the jar you want.

When i export it to a jar and then convert it into zip ,i found the xml file in resources folder of zip,I am unable to understand why it still says xml file not found

Which is why it’s not working :wink:
Maven will copy anything in src/main/resources to the root of the jar.

If you export via Eclipse, it will be in a folder, which won’t work as you’re probably loading it straight from the route using .addClassPathResource(“somefile.bpmn20.xml”)

So what should I do??

So the problem is that your file is in the ‘resources’ folder. I don’t know if that’s the resources folder because you’re using Maven or because that’s a default folder being created for a regular java project.

If your are using Maven, see above:
“On the command line for that project, you can do a ‘mvn clean package’ to get the jar you want.”

If not, you have to either put the file somewhere that will be on the root of your classpath, or load the file from a folder in your code.

thanks @joram your replies helped me solve my problem,made a jar and it is running fine