autoconf-archive-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[patch #8171] AX_PROG_JAVA_WORKS: Fix class path handling


From: Arto Bendiken
Subject: [patch #8171] AX_PROG_JAVA_WORKS: Fix class path handling
Date: Sun, 25 Aug 2013 12:50:57 +0000
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_5) AppleWebKit/536.30.1 (KHTML, like Gecko) Version/6.0.5 Safari/536.30.1

URL:
  <http://savannah.gnu.org/patch/?8171>

                 Summary: AX_PROG_JAVA_WORKS: Fix class path handling
                 Project: GNU Autoconf Archive
            Submitted by: bendiken
            Submitted on: Sun 25 Aug 2013 02:50:56 PM CEST
                Priority: 5 - Normal
                  Status: None
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

At the moment AX_PROG_JAVA (which in turn relies on AX_PROG_JAVA_WORKS) will
always fail in case the CLASSPATH environment variable has been set but does
not include the current working directory (".").

The symptom is ./configure failing with the following spurious error:


checking if java works... configure: error: The Java VM java failed (see
config.log, check the CLASSPATH?)


The config.log file will in turn contain the following output:


configure:19711: checking if java works
configure:19742: java  Test
Error: Could not find or load main class Test
configure:19745: $? = 1
configure: failed program was:
/* [#]line 19721 "configure" */
public class Test {
public static void main (String args[]) {
        System.exit (0);
} }
configure:19751: error: The Java VM java failed (see config.log, check the
CLASSPATH?)


The reason for this failure is simply that the AX_PROG_JAVA_WORKS macro
attempts to execute the compiled Test.class program without explicitly
specifying a class path where $JAVA should look for it, thus leaving the
success or failure of the invocation entirely at the mercy of the class path
configuration; this is suboptimal, as the test program is in fact created in
the current working directory and thus should be always found regardless of
any external class path configuration.

The attached patch fixes AX_PROG_JAVA_WORKS to execute `java -classpath .
Test` instead of `java Test`, guaranteeing that the invocation will work
despite any value of CLASSPATH.

Similar problems manifest with some of the other Java macros (thus in practice
still necessitating specifying the current working directory as part of
CLASSPATH, despite this patch), but this one is the most egregious and
obvious. I'll see about submitting separate patches for the other issues as I
encounter, grok, and fix them.



    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Sun 25 Aug 2013 02:50:56 PM CEST  Name:
ax_prog_java_works-classpath.patch  Size: 579B   By: bendiken
Ensure that $JAVA is invoked with an explicit class path argument
<http://savannah.gnu.org/patch/download.php?file_id=28932>

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/patch/?8171>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]