Java apps and doing OS stuff

  • Thread starter Nikolaos Giannopoulos
  • Start date
N

Nikolaos Giannopoulos

We use bourne shell scripts (on Linux and Solaris) to do things like:

+ pre-process commands and launch our java app
--> e.g. user can simply type: ./seahorse start

+ OS specific pre|post-installation during installs and upgrades
--> recursive copying a directory + retaining permissions, etc....

To have our app run on Win NT/2000/XP we would have to convert our shell
scripts to use dos batch files but we are finding that we are missing
things like:

+ getting the current dir (into a script var)
+ conditional processing on (non-)existence of a directory
+ choice command

So the question is short of writing C code for different platforms what
are the options for communicating with a Java app in Win NT/2000/XP,
Solaris, and Linux?

It would be nice if everything was (a) all Java or something
cross-platform and (b) had input of a scripting form (as its easier to
change and typically easier to maintain)

Any ideas?

Thanks,

--Nikolaos
 
J

Joseph Millar

We use bourne shell scripts (on Linux and Solaris) to do things like:

+ pre-process commands and launch our java app
--> e.g. user can simply type: ./seahorse start

+ OS specific pre|post-installation during installs and upgrades
--> recursive copying a directory + retaining permissions, etc....

Batch files are not anywhere as capable as shell scripts
are, but they can do most things. There have been many
enhancements to the batch file language in recent years.
To have our app run on Win NT/2000/XP we would have to convert our shell
scripts to use dos batch files but we are finding that we are missing
things like:

+ getting the current dir (into a script var)

set currentdir=%CD%

The current directory name is stored into the variable
currentdir.
+ conditional processing on (non-)existence of a directory

if exist %dirname% echo %dirname exists

if the directory in dirname exists, you will see a
+ choice command

set /p answer=Enter Yes or No...

After this command, the variable answer will have whatever
the user typed. There is no input validation, so the
if the user typed "cat", that's what you get. There are
any number of freeware programs to do input validation
which set errorlevel to indicate success or failure, etc.
Any search in google will find lots of them.

By the way, most of the above constructs are called Command
Extensions, and mean using "cmd /e:eek:n" or having them enabled
in the Registry. For detailed help on any batch command,
simply do like "set /?" or "if /?". For more info on the
Extensions, type "cmd /?".

By the way, none of these questions is Java related, you might
have more luck asking about batch file specifics in a Windows
newsgroup.
So the question is short of writing C code for different platforms what
are the options for communicating with a Java app in Win NT/2000/XP,
Solaris, and Linux?

It would be nice if everything was (a) all Java or something
cross-platform and (b) had input of a scripting form (as its easier to
change and typically easier to maintain)

InstallAnywhere, http://www.zerog.com/index.html

--Joe
 
N

Nikolaos Giannopoulos

Thanks for the feedback Joseph. I appreciate it.

set /p answer=Enter Yes or No...

After this command, the variable answer will have whatever
the user typed. There is no input validation, so the
if the user typed "cat", that's what you get. There are
any number of freeware programs to do input validation
which set errorlevel to indicate success or failure, etc.
Any search in google will find lots of them.

(1) I meant something like the unix shell case statement. Is there an
equivalent in the dos cmd.exe world?

(2) Are extensions available out of the box with NT/2000/XP (i.e.
without needed to download and install any other resources - e.g. I have
seen some mention of an NT resources kit but am not sure)?

Thanks again,

--Nikolaos
 
T

Tony BenBrahim

We use bourne shell scripts (on Linux and Solaris) to do things like:

+ pre-process commands and launch our java app
--> e.g. user can simply type: ./seahorse start

+ OS specific pre|post-installation during installs and upgrades
--> recursive copying a directory + retaining permissions, etc....

To have our app run on Win NT/2000/XP we would have to convert our shell
scripts to use dos batch files but we are finding that we are missing
things like:

You must absolutely download cygwin, which implements most of the unix
commands on Win32, including a bourne shell.
 

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,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top