Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4379008

Linux: java wrapper does not work without setting certain pathes

XMLWordPrintable

    • ladybird
    • x86
    • linux
    • Verified



        Name: egR10015 Date: 10/13/2000



        The script .java_wrapper from linux jdk1.2.x and jdk1.3.x uses external commands
        basename, uname, dirname without absolute pathnames.
        So wrapper wrongly assumes that certain pathes to these commands are already set
        in user environment but actually this is not right.

        Another issue is that tests cannot be run under Tonga harness on Linux platform without
        setting these additional pathes in user environment.

        Example consists of the two following programs.
        Here is the main program:
        ------------------------------- test.java --------------------------------------
        import java.io.BufferedReader;
        import java.io.InputStreamReader;
        import java.io.IOException;

        public class test {
            public static void main(String args[]) {
                String[] env = { "PATH=" };
                String s;

                try {
                    Process proc = Runtime.getRuntime().exec(System.getProperty("java.home") +
                                                             "/bin/java test1", env);

                    BufferedReader pout = new BufferedReader(new InputStreamReader(proc.getInputStream()));
                    BufferedReader perr = new BufferedReader(new InputStreamReader(proc.getErrorStream()));
                    while ((s=pout.readLine())!=null)
                        System.out.println(s);
                    while ((s=perr.readLine())!=null)
                        System.err.println(s);
        } catch (IOException e) {
                    System.err.println("EXEC ERROR : "+e.getMessage());
        }
            }
        }
        --------------------------------------------------------------------------------

        Here is the invoked program:
        ----------------------------- test1.java ---------------------------------------
        public class test1 {
            public static void main(String args[]) {
                System.out.println("test1: OK!");
            }
        }
        --------------------------------------------------------------------------------

        To reproduce the bug compile test.java and test1.java and run test class as follows:
        java test

        Note that on all platforms except Linux this test works fine.

        --------------------------- output from Solaris --------------------------------
        $ /export/ld25/java/dest/jdk1.3/solaris/bin/java test
        test1: OK!
        --------------------------------------------------------------------------------

        ---------------------------- output from win32 ---------------------------------
        $ h:/hotspot/jdk1.3.0/win32/bin/java test
        test1: OK!
        --------------------------------------------------------------------------------

        ---------------------------- output from Linux ---------------------------------
        $ /net/linux-15/export/home/jdk1.3.0/linux/bin/java test
        Error: can't find libjava.so.
        /.automount/linux-15/root/export/home/jdk1.3.0/linux/jre/bin/java: basename: No such file or directory
        /.automount/linux-15/root/export/home/jdk1.3.0/linux/jre/bin/java: uname: No such file or directory
        /.automount/linux-15/root/export/home/jdk1.3.0/linux/jre/bin/java: uname: No such file or directory
        /.automount/linux-15/root/export/home/jdk1.3.0/linux/jre/bin/java: dirname: No such file or directory
        --------------------------------------------------------------------------------

        ======================================================================

              dwallmansunw David Wallman (Inactive)
              eugsunw Eug Eug (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: