[Advanced-java] Java apps and doing OS stuff

Thomas Nichols nx10mail at yahoo.co.uk
Fri Jul 11 22:23:38 2003


At 16:12 11/07/2003 -0400, Nikolaos Giannopoulos wrote:

> > -----Original Message-----
> > From: Thomas Nichols [mailto:nx10mail@yahoo.co.uk]
> > Sent: Friday, July 11, 2003 3:32 PM
> >
> > >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....
> >
> > 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.
>
>This option although ideal won't work as we won't have control over the
>target system i.e. in addition any solution will require that I be able to
>re-distribute it in a rather feasible manner.

Ok.



> > Alternatively you could go for an enhanced Windows command processor such
> > as 4NT from jpsoft.
>
>I'll look into this although as I'm seeing it now it would be nice to get
>rid of the dos and unix scripting altogether and have a cross-platform
>solution.

Sounds good.

> > If you want a Java-based solution, perhaps Jython or JudoScript.
>
>Can these languages allow you to issue OS commands and tests on the
>filesystem such as:  recursive directory copy (keeping permissions),
>conditional processing on exit result of an app, conditional processing on
>existence of a dir, etc....
>
>One of the reasons the install/upgrade scripts are not 100% java is because
>java does not retain permissions during file copy - do these languages get
>me any further along in this respect?  I'm guessing no from what I had
>previously read on Jython.

 From http://www.judoscript.com/faq.html#q8 JudoScript can handle chmod on *nix
However, http://www.jython.org/docs/differences.html suggests Jython cannot.
Ant has a Chmod task implemented for *nix, can I think do recursive dir 
copies, not sure about testing exit code of an app -- and is utterly 
wonderful as a Java build tool. Not my first choice for cross-platform 
deployment, though, and scripts can get fairly large even for low complexities.
So, AFAIK (and I know startlingly little about this) if you want a 
Java-based solution JudoScript and Ant may be your options. JudoScript is 
LGPL, so redistribution is ok if handled carefully, Ant is Apache, so few 
restrictions.

If you're happy with a wholly different language, Python (BSD-style CNRI 
license) can be shipped with your apps without too much difficulty.

But there are plenty more in that list of 165 JVM-driven languages, and 
plenty more general purpose scripting languages, which may provide a better 
solution for you. Rexx and Tcl might be the first I'd consider if 
JudoScript and Python prove unsuitable.



> > 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.
>
>Okay.  But I'm not looking for an alternative to Java.  I'm looking for
>something that will plug holes that Java currently has -

Understood.


>Which of these scripting languages would be best in manipulating the file
>system, is compact, re-distributable (with a commercial product) and is
>cross platform?

I take it the "compact" criterion applies both to binary distro size and to 
how much scripting code you need?


>Thanks,
>
>--Nikolaos

Please do report back on your research!
     - Thomas.