in reply to Why isn't my array populating?

That you got output on your screen is your clue that java was writing to STDERR, not STDOUT. Redirect and all will be fixed (adjust accordingly to your shell's syntax, of couse).

my @javaInfo = `java -version 2>&1`;

The cake is a lie.
The cake is a lie.
The cake is a lie.

Replies are listed 'Best First'.
Re^2: Why isn't my array populating?
by gokuraku (Monk) on Mar 27, 2008 at 19:16 UTC
    Ah yeah, I can see that now. It actually had not occurred to me that this might be the case.
    I still have the question why java would direct to STDERR and not STDOUT.
      I still have the question why java would direct to STDERR and not STDOUT.

      When a command-line utility (in this case "java") offers a "-v" (or "--version") option to print its version number, it's actually fairly common for the version string to be printed to STDERR rather than to STDOUT, especially if the app tends to write actual data to STDOUT. This is so that the version string won't get treated as actual data in a typical pipeline. (Your case is exceptional: you want the version string treated as data, so you have to explicitly make it do that.)