[Advanced-java] Java apps and doing OS stuff

Thomas Nichols nx10mail at yahoo.co.uk
Fri Jul 11 20:42:57 2003


At 14:48 11/07/2003 -0400, Nikolaos Giannopoulos wrote:

>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

If all you want is a better scripting environment for Windows, there are 
several Unix-clone options (such as Cygwin or MKS); these will add the 
functionality you're currently missing  and allow you to run bash scripts 
under Windows.
Alternatively you could go for an enhanced Windows command processor such 
as 4NT from jpsoft.
If you want a Java-based solution, perhaps Jython or JudoScript. There are 
currently 165 languages for the Java VM listed at
http://grunge.cs.tu-berlin.de/~tolk/vmlanguages.html
These include scripting languages like JavaScript/Rhino and JRuby, 
"scripting frameworks" like Bean Scripting Framework and implementations of 
many other languages such as Prolog, Ada and even  (if you're feeling 
nostalgic) COBOL.

Or you could choose another non-Java cross-platform scripting language such 
as Tcl (giving you dialogs with Tcl/Tk), REXX, Python or even Perl.

Apologies for the plethora of choices - most of these will do what you 
want, personally for your situation I'd look at Python or Jython, but very 
definitely YMMV.

     - Thomas.