/[classpath]/classpath/java/lang/Runtime.java
ViewVC logotype

Diff of /classpath/java/lang/Runtime.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.8.2.4 by gnu_andrew, Sat Feb 19 10:50:36 2005 UTC revision 1.8.2.5 by gnu_andrew, Wed Mar 23 21:00:04 2005 UTC
# Line 1  Line 1 
1  /* Runtime.java -- access to the VM process  /* Runtime.java -- access to the VM process
2     Copyright (C) 1998, 2002, 2003, 2004 Free Software Foundation     Copyright (C) 1998, 2002, 2003, 2004, 2005 Free Software Foundation
3    
4  This file is part of GNU Classpath.  This file is part of GNU Classpath.
5    
# Line 93  public class Runtime Line 93  public class Runtime
93    {    {
94      if (current != null)      if (current != null)
95        throw new InternalError("Attempt to recreate Runtime");        throw new InternalError("Attempt to recreate Runtime");
96        
97        // If used by underlying VM this contains the directories where Classpath's own
98        // native libraries are located.
99        String bootPath = SystemProperties.getProperty("gnu.classpath.boot.library.path", "");
100        
101        // If properly set by the user this contains the directories where the application's
102        // native libraries are located. On operating systems where a LD_LIBRARY_PATH environment
103        // variable is available a VM should preset java.library.path with value of this
104        // variable.
105      String path = SystemProperties.getProperty("java.library.path", ".");      String path = SystemProperties.getProperty("java.library.path", ".");
106      String pathSep = SystemProperties.getProperty("path.separator", ":");      String pathSep = SystemProperties.getProperty("path.separator", ":");
107      String fileSep = SystemProperties.getProperty("file.separator", "/");      String fileSep = SystemProperties.getProperty("file.separator", "/");
108      StringTokenizer t = new StringTokenizer(path, pathSep);  
109      libpath = new String[t.countTokens()];      StringTokenizer t1 = new StringTokenizer(bootPath, pathSep);
110      for (int i = 0; i < libpath.length; i++)      StringTokenizer t2 = new StringTokenizer(path, pathSep);
111        {      libpath = new String[t1.countTokens() + t2.countTokens()];
112          String prefix = t.nextToken();      
113          if (! prefix.endsWith(fileSep))      int i = 0;
114            prefix += fileSep;      while(t1.hasMoreTokens()) {
115          libpath[i] = prefix;        String prefix = t1.nextToken();
116        }        if (! prefix.endsWith(fileSep))
117            prefix += fileSep;
118          
119          libpath[i] = prefix;
120          i++;
121        }
122        
123        while(t2.hasMoreTokens()) {
124          String prefix = t2.nextToken();
125          if (! prefix.endsWith(fileSep))
126            prefix += fileSep;
127      
128          libpath[i] = prefix;
129          i++;
130        }
131    }    }
132    
133    /**    /**
# Line 687  public class Runtime Line 710  public class Runtime
710     * <code>System.mapLibraryName(libname)</code>. There may be a security     * <code>System.mapLibraryName(libname)</code>. There may be a security
711     * check, of <code>checkLink</code>.     * check, of <code>checkLink</code>.
712     *     *
713       * <p>Note: Besides <code>java.library.path</code> a VM may chose to search
714       * for native libraries in a path that is specified by the
715       * <code>gnu.classpath.boot.library.path</code> system property. However
716       * this is for internal usage or development of GNU Classpath only.
717       * <b>A Java application must not load a non-system library by changing
718       * this property otherwise it will break compatibility.</b></p>
719       *
720     * <p>     * <p>
721     * The library is loaded using the class loader associated with the     * The library is loaded using the class loader associated with the
722     * class associated with the invoking method.     * class associated with the invoking method.
# Line 731  public class Runtime Line 761  public class Runtime
761              return;              return;
762        }        }
763      throw new UnsatisfiedLinkError("Native library `" + libname      throw new UnsatisfiedLinkError("Native library `" + libname
764        + "' not found (as file `" + filename + "')");        + "' not found (as file `" + filename + "') in gnu.classpath.boot.library.path and java.library.path");
765    }    }
766    
767    /**    /**

Legend:
Removed from v.1.8.2.4  
changed lines
  Added in v.1.8.2.5

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26