Saturday, November 1, 2014

Run a jar file in command line

This is a very simple and short post on running a jar file in command line.
Simplest command that you can try is
java –jar [jarFileName].jar

But you may need to have the MANIFEST file in the jar to run it simply with the above command.

So how to bundle MANIFEST.MF to your jar?

You can add the following maven plugin to your pom.xml and get it done. Remember to add the main class name of your app here.




How to run the jars with external dependencies?

If you need to use the simple command java –jar [jarFileName].jar to run your application which has external dependencies, you can bundle the dependencies you need to the executable jar itself. Again use the below maven plugin to get it done.




The highlighted part is doing this for you and the part above is to bundle MANIFEST.MF file to that jar file too.

2 comments:

  1. Which is the best product among those listed in this site?
    Best Computer Gaming Chair

    ReplyDelete
  2. How to get free spins no deposit bonus on Casino Sites
    The first pcie 슬롯 thing that is needed 트 위치 룰렛 to make a deposit 룰렛사이트 is to make your 텍사스 홀덤 룰 first deposit with your new account. Once you've finished your registration bet 분석 you can deposit cash into your new

    ReplyDelete