If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

run java app on Linux at boot up

Hi there,

I just noticed that when I loaded up J2SDK onto Linux that there is no
javaw command. Does anybody know why this command has been removed from
the Linux distribution? I was going to make use of it in a shell
script, which brings me to my next question.

Has anybody successfully launched a Java application using shell scripts
on Linux at boot up so that the application runs silently in the
background?

Naturally, after I've logged on as root and given my password I can
certainly run a java app from the prompt using something like:

java myApp

However, javaw was a lot more convenient. I could launch a java
application without a terminal window bound to it.

MAIN OBJECTIVE: I just want to set up whatever scripts are necessary to
launch my java application when Linux boots up. Linux has a special
command: chkconfig
I don't know if it can be used or not to schedule the running of a java
application upon boot up. Maybe there is another, better way?

Basically, I just want to have the java application running without my
having to log in, except to shut it down.

Re: run java app on Linux at boot up

Hi Alen,
each unix flavour has 2 files in its /etc directory.
one is /etc/inittab and other /etc/services
you can add a line in the /etc/inittab file which is a executable path for
a file or a shell script and get the program executed once it is booted.

if you add the entry in the /etc/services, then the program runs as a service
on the system, till you stop the same or kill it.

Tushar

Alan Shiers <ashiers@hfx.eastlink.ca> wrote:
>Hi there,
>
>I just noticed that when I loaded up J2SDK onto Linux that there is no
>javaw command. Does anybody know why this command has been removed from
>the Linux distribution? I was going to make use of it in a shell
>script, which brings me to my next question.
>
>Has anybody successfully launched a Java application using shell scripts
>on Linux at boot up so that the application runs silently in the
>background?
>
>Naturally, after I've logged on as root and given my password I can
>certainly run a java app from the prompt using something like:
>
>java myApp
>
>However, javaw was a lot more convenient. I could launch a java
>application without a terminal window bound to it.
>
>MAIN OBJECTIVE: I just want to set up whatever scripts are necessary to
>launch my java application when Linux boots up. Linux has a special
>command: chkconfig
>I don't know if it can be used or not to schedule the running of a java
>application upon boot up. Maybe there is another, better way?
>
>Basically, I just want to have the java application running without my
>having to log in, except to shut it down.
>
>Can all this be done?
>
>Please advise,
>
>Alan Shiers

Re: run java app on Linux at boot up

Hi Tushar,
I'm new to Linux so perhaps you can explain what the difference is
between launching a java application in either of the two ways you
mentioned. What is a typical service program as opposed to some other
type of program? I don't quite understand the difference. Please
explain.

Alan

Tushar Zaware wrote:
>
> Hi Alen,
> each unix flavour has 2 files in its /etc directory.
> one is /etc/inittab and other /etc/services
> you can add a line in the /etc/inittab file which is a executable path for
> a file or a shell script and get the program executed once it is booted.
>
> if you add the entry in the /etc/services, then the program runs as a service
> on the system, till you stop the same or kill it.
>
> Tushar
>
> Alan Shiers <ashiers@hfx.eastlink.ca> wrote:
> >Hi there,
> >
> >I just noticed that when I loaded up J2SDK onto Linux that there is no
> >javaw command. Does anybody know why this command has been removed from
> >the Linux distribution? I was going to make use of it in a shell
> >script, which brings me to my next question.
> >
> >Has anybody successfully launched a Java application using shell scripts
> >on Linux at boot up so that the application runs silently in the
> >background?
> >
> >Naturally, after I've logged on as root and given my password I can
> >certainly run a java app from the prompt using something like:
> >
> >java myApp
> >
> >However, javaw was a lot more convenient. I could launch a java
> >application without a terminal window bound to it.
> >
> >MAIN OBJECTIVE: I just want to set up whatever scripts are necessary to
> >launch my java application when Linux boots up. Linux has a special
> >command: chkconfig
> >I don't know if it can be used or not to schedule the running of a java
> >application upon boot up. Maybe there is another, better way?
> >
> >Basically, I just want to have the java application running without my
> >having to log in, except to shut it down.
> >
> >Can all this be done?
> >
> >Please advise,
> >
> >Alan Shiers

Re: run java app on Linux at boot up

If you want to add a program which should start at the booting time of Linux,
you need to have a executable file / shell script which will launch the same
and your problem is resolved.

No talking about the /etc/inittab file
I have worked on Solaris exclusively.
In solaris you need to add an entry like
T1:234:wait:</opt/apache1.3.12>/bin/startHttpd.sh >/dev/console 2>&1

This will vary depending on OS and you need to go through the installation
manual for the services on your respective OS and also you need to check
the application requirement you have.

Adding this line also expecs the startOsagent.sh to exist in the said folder.
This file might look like
###########################
#/bin/sh
/opt/apache1.3.12/httpd -start &
###########################

And you are through.

If you want to add the service, it will work as a daemon process and in that
case you need to add the entry in the /etc/services file as
Httpd 8080/tcp # Apache web Server daemon

If the above entries are made in the either files, the Apache service will
be started automatically at the tiome of startup.
Tushar
Alan Shiers <ashiers@hfx.eastlink.ca> wrote:
>
>Hi Tushar,
>I'm new to Linux so perhaps you can explain what the difference is
>between launching a java application in either of the two ways you
>mentioned. What is a typical service program as opposed to some other
>type of program? I don't quite understand the difference. Please
>explain.
>
>Alan
>
>Tushar Zaware wrote:
>>
>> Hi Alen,
>> each unix flavour has 2 files in its /etc directory.
>> one is /etc/inittab and other /etc/services
>> you can add a line in the /etc/inittab file which is a executable path
for
>> a file or a shell script and get the program executed once it is booted.
>>
>> if you add the entry in the /etc/services, then the program runs as a
service
>> on the system, till you stop the same or kill it.
>>
>> Tushar
>>
>> Alan Shiers <ashiers@hfx.eastlink.ca> wrote:
>> >Hi there,
>> >
>> >I just noticed that when I loaded up J2SDK onto Linux that there is no
>> >javaw command. Does anybody know why this command has been removed from
>> >the Linux distribution? I was going to make use of it in a shell
>> >script, which brings me to my next question.
>> >
>> >Has anybody successfully launched a Java application using shell scripts
>> >on Linux at boot up so that the application runs silently in the
>> >background?
>> >
>> >Naturally, after I've logged on as root and given my password I can
>> >certainly run a java app from the prompt using something like:
>> >
>> >java myApp
>> >
>> >However, javaw was a lot more convenient. I could launch a java
>> >application without a terminal window bound to it.
>> >
>> >MAIN OBJECTIVE: I just want to set up whatever scripts are necessary
to
>> >launch my java application when Linux boots up. Linux has a special
>> >command: chkconfig
>> >I don't know if it can be used or not to schedule the running of a java
>> >application upon boot up. Maybe there is another, better way?
>> >
>> >Basically, I just want to have the java application running without my
>> >having to log in, except to shut it down.
>> >
>> >Can all this be done?
>> >
>> >Please advise,
>> >
>> >Alan Shiers
>Content-Description: Card for Alan Shiers
>
>begin:vcard
>n:Shiers;Alan
>tel;work:902-876-7897
>x-mozilla-html:FALSE
>url:http://www.mss-webdesign.ca
>org:Mustard Seed Software
>adr:;;23 Norway Maple Dr.;Timberlea;Nova Scotia;B3T 1G5;Canada
>version:2.1
>email;internet:ashiers@hfx.eastlink.ca
>titlerogrammer/webdesigner
>fn:Alan Shiers
>end:vcard
>
>