Ver Mensaje Individual
  #4 (permalink)  
Antiguo 07/08/2013, 16:14
LuisChavezB
 
Fecha de Ingreso: diciembre-2011
Mensajes: 152
Antigüedad: 13 años, 2 meses
Puntos: 34
Respuesta: porqué pasa esto?

Si verificas el código de la clase System (Openjdk) lo encontraras:
http://grepcode.com/file/repository....stem.java#1087

Código Java:
Ver original
  1. private static void More ...initializeSystemClass() {
  2. 1088        props = new Properties();
  3. 1089        initProperties(props);
  4. 1090        sun.misc.Version.init();
  5. 1091        FileInputStream fdIn = new FileInputStream(FileDescriptor.in);
  6. 1092        FileOutputStream fdOut = new FileOutputStream(FileDescriptor.out);
  7. 1093        FileOutputStream fdErr = new FileOutputStream(FileDescriptor.err);
  8. 1094        setIn0(new BufferedInputStream(fdIn));
  9. 1095        setOut0(new PrintStream(new BufferedOutputStream(fdOut, 128), true));
  10. 1096        setErr0(new PrintStream(new BufferedOutputStream(fdErr, 128), true));
  11. 1097
  12. 1098        // Load the zip library now in order to keep java.util.zip.ZipFile
  13. 1099        // from trying to use itself to load this library later.
  14. 1100        loadLibrary("zip");
  15. 1101
  16. 1102        // Setup Java signal handlers for HUP, TERM, and INT (where available).
  17. 1103        Terminator.setup();
  18. 1104
  19. 1105        // The order in with the hooks are added here is important as it
  20. 1106        // determines the order in which they are run.
  21. 1107        // (1)Console restore hook needs to be called first.
  22. 1108        // (2)Application hooks must be run before calling deleteOnExitHook.
  23. 1109        Shutdown.add(sun.misc.SharedSecrets.getJavaIOAccess().consoleRestoreHook());
  24. 1110        Shutdown.add(ApplicationShutdownHooks.hook());
  25. 1111        Shutdown.add(sun.misc.SharedSecrets.getJavaIODeleteOnExitAccess());
  26. 1112
  27. 1113        // Initialize any miscellenous operating system settings that need to be
  28. 1114        // set for the class libraries. Currently this is no-op everywhere except
  29. 1115        // for Windows where the process-wide error mode is set before the java.io
  30. 1116        // classes are used.
  31. 1117        sun.misc.VM.initializeOSEnvironment();
  32. 1118
  33. 1119        // Set the maximum amount of direct memory.  This value is controlled
  34. 1120        // by the vm option -XX:MaxDirectMemorySize=<size>.  This method acts
  35. 1121        // as an initializer only if it is called before sun.misc.VM.booted().
  36. 1122        sun.misc.VM.maxDirectMemory();
  37. 1123
  38. 1124        // Set a boolean to determine whether ClassLoader.loadClass accepts
  39. 1125        // array syntax.  This value is controlled by the system property
  40. 1126        // "sun.lang.ClassLoader.allowArraySyntax".  This method acts as
  41. 1127        // an initializer only if it is called before sun.misc.VM.booted().
  42. 1128        sun.misc.VM.allowArraySyntax();
  43. 1129
  44. 1130        // Subsystems that are invoked during initialization can invoke
  45. 1131        // sun.misc.VM.isBooted() in order to avoid doing things that should
  46. 1132        // wait until the application class loader has been set up.
  47. 1133        sun.misc.VM.booted();
  48. 1134
  49. 1135        // The main thread is not added to its thread group in the same
  50. 1136        // way as other threads; we must do it ourselves here.
  51. 1137        Thread current = Thread.currentThread();
  52. 1138        current.getThreadGroup().add(current);
  53. 1139
  54. 1140        // Allow privileged classes outside of java.lang
  55. 1141        sun.misc.SharedSecrets.setJavaLangAccess(new sun.misc.JavaLangAccess(){
  56. 1142            public sun.reflect.ConstantPool More ...getConstantPool(Class klass) {
  57. 1143                return klass.getConstantPool();
  58. 1144            }
  59. 1145            public void More ...setAnnotationType(Class klass, AnnotationType type) {
  60. 1146                klass.setAnnotationType(type);
  61. 1147            }
  62. 1148            public AnnotationType More ...getAnnotationType(Class klass) {
  63. 1149                return klass.getAnnotationType();
  64. 1150            }
  65. 1151            public <E extends Enum<E>>
  66. 1152                    E[] More ...getEnumConstantsShared(Class<E> klass) {
  67. 1153                return klass.getEnumConstantsShared();
  68. 1154            }
  69. 1155            public void More ...blockedOn(Thread t, Interruptible b) {
  70. 1156                t.blockedOn(b);
  71. 1157            }
  72. 1158        });
  73. 1159    }