LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 11-16-2009, 10:29 AM   #1
jaydeepnp
LQ Newbie
 
Registered: Nov 2009
Posts: 2

Rep: Reputation: 0
Shell script for jar utility


I have jar utility, I want to create schell script to execute this jar utility and also provide inputs for the jar utility from the shell script is this possiable? How?

Please help

Jaydeep
 
Old 11-16-2009, 10:40 AM   #2
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
You can do it from a shell script exactly the same way you do it from the command line.
 
Old 11-16-2009, 11:34 PM   #3
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,513

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
Code:
#!/bin/bash

cd <path-to-file.jar>

exec java -jar <file.jar>
chmod +x start-script.sh
.. and .. 'cp start-script.sh /usr/local/bin/'
.. make a Desktop Entry ( Icon ) to start the application.
.....
 
Old 11-18-2009, 02:37 AM   #4
jaydeepnp
LQ Newbie
 
Registered: Nov 2009
Posts: 2

Original Poster
Rep: Reputation: 0
Thanks Catkin & knudfl for your response.

I am herewith want to rephrase my question.

See I am having jar utility which currently I am running from command prompt. This utility asks for 5 inputs and then does its work after all inputs.

Now I want to create shell script for executing the jar utility and also provide the inputs say by reading data from separate file. Is this possible? how?

Once again thanks a lot for your response.

Jaydeep
 
Old 11-18-2009, 08:11 AM   #5
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Depending on how the jar utility works it may be possible with a here document (scroll down to sections 3.6.6 and 3.6.7).
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
I got error with this command 'java -jar NodeView-v1.1.jar' mohdismiaswaly Linux - Software 3 04-23-2009 06:24 AM
Permission Issue With Shell Script and .Jar File timmit Slackware 3 06-02-2008 07:33 AM
shell script to use Snort utility Adil_uk Programming 0 12-01-2005 05:59 PM
Fedora Core 1 Associating .jar files with java -jar command pymehta Fedora 0 01-13-2005 05:26 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 09:21 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration