execute shell script from java

J

Johan

Hi,

I want to know if it is possible to execute a shell script from a java
program.

Johan
 
K

kaeli

Hi,

I want to know if it is possible to execute a shell script from a java
program.

Sure.
I posted just such a thing to this group a couple days ago. Check the
archives.

--
 
J

Joona I Palaste

Um, yes it does indeed have a shell.
I have no clue why that came up, though, since the code I posted runs
from unix and calls another unix machine.

Let me guess, nos has a Windows box himself, so he assumes everyone else
has one too?
 
N

nos

Joona I Palaste said:
Let me guess, nos has a Windows box himself, so he assumes everyone else
has one too?

Is not the java program supposed to run on all platforms?
 
J

Joona I Palaste

Is not the java program supposed to run on all platforms?

Did the OP specify it had to?
But be my guest, try writing a shell script that can run on all
platforms, regardless of what language it's called from.
 
K

kaeli

[email protected] enlightened said:
Is not the java program supposed to run on all platforms?

Java is cross platform.
Not all java programs will run on any platform. Nor should they.
I wouldn't want my code that calls our remote (unix) server and executes
commands as root to even be found by other people, much less run on
their Windows boxes.


--
 
N

nos

Joona I Palaste said:
nos said:
Joona I Palaste said:
kaeli <[email protected]> scribbled the following:
Did the OP specify it had to?
But be my guest, try writing a shell script that can run on all
platforms, regardless of what language it's called from.

OP did not specify therefore the default environment
is in effect. Since everyone has windows, it is the default.
Some users may also have unix or linux, but that is only cuz
it is forced on them by their job.
 
S

Sudsy

nos said:
OP did not specify therefore the default environment
is in effect. Since everyone has windows, it is the default.
Some users may also have unix or linux, but that is only cuz
it is forced on them by their job.

BZZT! Wrong answer! Not everyone has windoze. I prefer the
power and stability of Linux: all my servers run it. Don't
be making preposterous statements when facts don't support
them.
 
J

Jon A. Cruz

nos said:
OP did not specify therefore the default environment
is in effect. Since everyone has windows, it is the default.
Some users may also have unix or linux, but that is only cuz
it is forced on them by their job.

No.

Currently I am having Windows forced on me by my new job.

I prefer Linux (and now OS X) whenever I have a choice (home or work).

It's also a strong consideration for Java work, since working with Java
is what made me move from Windows to Linux to begin with. I found I got
much better performance on the same hardware.
 
J

Jon A. Cruz

nos said:
OP did not specify therefore the default environment
is in effect. Since everyone has windows, it is the default.
Some users may also have unix or linux, but that is only cuz
it is forced on them by their job.


Actually...

When Windows is the platform, "bat file" or "batch file" is the term mor
used. "shell script" is more often used by 'unix guys'
 
N

nos

Sudsy said:
BZZT! Wrong answer! Not everyone has windoze. I prefer the
power and stability of Linux: all my servers run it. Don't
be making preposterous statements when facts don't support
them.
I suppose you have one server in the kitchen and one in the bathroom,
and one in each car.
 
N

nos

Jon A. Cruz said:
No.

Currently I am having Windows forced on me by my new job.

I prefer Linux (and now OS X) whenever I have a choice (home or work).

It's also a strong consideration for Java work, since working with Java
is what made me move from Windows to Linux to begin with. I found I got
much better performance on the same hardware.
More than 5 years ago, Dave Korn got unix to run on top of win NT,
so maybe that is your solution.
 
S

Sudsy

nos said:
I suppose you have one server in the kitchen and one in the bathroom,
and one in each car.

Standard architecture when you run webservers and e-commerce.
Never work with DMZs and compartmentalization? Running the
database servers separately on an internal LAN with no direct
connection to the 'net?
PLUS, I can do all the usual web surfing, run office apps and
never worry about evil ActiveX controls or common viruses.
The Linux desktop has become a lot more "user friendly" and
there's really no alternative when it comes to reliability.
The machines run 24x7 and never go down unless I explicitly
invoke shutdown. 'Course the UPS helps in that regard too...
I was just countering your "everyone has windows" statement.
It isn't true.
 
N

nos

Sudsy said:
Standard architecture when you run webservers and e-commerce.
Never work with DMZs and compartmentalization? Running the
database servers separately on an internal LAN with no direct
connection to the 'net?
PLUS, I can do all the usual web surfing, run office apps and
never worry about evil ActiveX controls or common viruses.
The Linux desktop has become a lot more "user friendly" and
there's really no alternative when it comes to reliability.
The machines run 24x7 and never go down unless I explicitly
invoke shutdown. 'Course the UPS helps in that regard too...
I was just countering your "everyone has windows" statement.
It isn't true.
So tell me then where you can buy a reasonably priced computer
as a person or individual or family member -- I.e. NOT A BUSINESS
that doesn't have WIN on it when you get it? Ok, Wal-Mart.
Can you let me have your copy of WIN XP since you don't use
it and I don't want to pay to upgrade my older machine?
 
C

Christophe Vanfleteren

<snip OT discussion>

         +------------------------+
         |                        |
         | PLEASE                 |
         |                        |
         | Do not feed the troll. |
         | Thank you.             |
         |                        |
         |         The Management |
         |                        |
         +----------+--+----------+
                    |  |
                    |  |
                    |  |
                    |  |
                    |  |
                    |  |
  *  @   @ ( ) * @ )|@ | / @ \ * * @* * +@
 _)_()_(_(_|(__)_)_(|(_|/__/__)(_(_))_(/)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,816
Latest member
SapanaCarpetStudio

Latest Threads

Top