user2518618
user2518618

Reputation: 1407

Run Apache CXF Client from command line

I have generated a CXF client (this is my first webservice client) that runs on Eclipse but I don't know how to run it from the command line.

The client was generated using the top-down approach: the java files where created using wsdl2java and WDSL files, then I modified them.

I want to execute it from the command line, but I don't know how to set the classpath or if there is something else to set up. In the properties of the Eclipse project there are some libraries that I don't know how to use from the command line: Apache CXF Library, EAR Libraries, Web App Libraries.

How can I execute an Apache CXF client from the command line? Is there a better way to execute it in the production environment? I have heard about maven, but I haven't used it.

Upvotes: 1

Views: 1971

Answers (3)

Neels
Neels

Reputation: 194

I had similar issues trying to run CXF with embedded & configured jetty, eventually got it working: In eclipse: Export - runnable jar file - and select copy required libs in subfolder!

on cmd: java -jar yourunablejar.jar

my jar is then very small, but program_lib folder is big.. In CXF lib dir there is a WHICH_JARS file telling you which jars to include for what.

Ciao

Upvotes: 2

user2518618
user2518618

Reputation: 1407

I finally figured it out. I copied all jars in cxf\lib folder to the same location of my jar. If there are more libraries in the Eclipse properties, copy them as well. Then call "java -cp myjar.jar;.\* my.Class"

The .\* loads all jars in the current directory.

Upvotes: 0

Thomas
Thomas

Reputation: 1420

If you want to execute the client from command line, you have to create a main class or use a library such as Apache Commons Cli : http://commons.apache.org/proper/commons-cli/

Then build a jar and execute it with java.

Ear and webapp librairies are for other kind of deployment.

Upvotes: 0

Related Questions