Setup jar to run as service on Ubuntu

Hello there,

Now I have a jar application on my Ubuntu server and is located in /home/steve/deployment/bear.server-1.0-SNAPSHOT-fat.jar and everytime i want to run my application I need to run this cmd
 java -jar bear.server-1.0-SNAPSHOT-fat.jar -conf config.json

Open in new window

. I want to know how I can run this cmd with a shotcut for e.g. run myapp. Please help!!

cheers
Zolf
zolfAsked:
Who is Participating?

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

x
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.

CEHJCommented:
What does bear.server-1.0-SNAPSHOT-fat.jar do? Tanukisoft probably still make their service wrapper. Whether it's been updated to cope with systemd is another issue. If it hasn't, you can write your own systemd service
1
David FavorLinux/LXD/WordPress/Hosting SavantCommented:
Be sure you make all your files absolute paths, or likely you'll have no end of troubles. This includes both your .jar + .conf file.

In your system wide or user shell startup file, you can add...

alias mycmd=" java -jar bear.server-1.0-SNAPSHOT-fat.jar -conf config.json"

Open in new window


Or you can take CEHJ's suggestion + turn the above into a systemd service, so then you'd use something like...

service mycmd start

Open in new window


Where your mycmd service implemented parts of service management you require.
0
zolfAuthor Commented:
Thanks for all your comments.

David

In your system wide or user shell startup file, you can add...
Can you please elaborate more, I am new to ubuntu world.

CEHJ
What does bear.server-1.0-SNAPSHOT-fat.jar do?
It runs my server side application.

If it hasn't, you can write your own systemd service
Can you please tell me how to setup with reference to my jar file location which is in my home directory
0
CEHJCommented:
Can you please tell me how to setup with reference to my jar file location which is in my home directory
The answer to that is - not easily. It would depend on the context. If you'd like to try it the 'proper' (but initially harder) way, then you need to study something like https://wiki.archlinux.org/index.php/Systemd

I would imagine the Tanukisoft wrapper would be easier. If it's well maintained, it will do the above for you
I'm also imagining that the service is network-oriented - is that the case?
0

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
zolfAuthor Commented:
cheers
0
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
Linux

From novice to tech pro — start learning today.