001    /*
002     * Licensed to the Apache Software Foundation (ASF) under one or more
003     * contributor license agreements.  See the NOTICE file distributed with
004     * this work for additional information regarding copyright ownership.
005     * The ASF licenses this file to You under the Apache License, Version 2.0
006     * (the "License"); you may not use this file except in compliance with
007     * the License.  You may obtain a copy of the License at
008     *
009     *      http://www.apache.org/licenses/LICENSE-2.0
010     *
011     * Unless required by applicable law or agreed to in writing, software
012     * distributed under the License is distributed on an "AS IS" BASIS,
013     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014     * See the License for the specific language governing permissions and
015     * limitations under the License.
016     */
017    package org.apache.commons.lang3;
018    
019    import java.io.File;
020    
021    /**
022     * <p>
023     * Helpers for {@code java.lang.System}.
024     * </p>
025     * <p>
026     * If a system property cannot be read due to security restrictions, the corresponding field in this class will be set
027     * to {@code null} and a message will be written to {@code System.err}.
028     * </p>
029     * <p>
030     * #ThreadSafe#
031     * </p>
032     *
033     * @since 1.0
034     * @version $Id: SystemUtils.java 1199816 2011-11-09 16:11:34Z bayard $
035     */
036    public class SystemUtils {
037    
038        /**
039         * The prefix String for all Windows OS.
040         */
041        private static final String OS_NAME_WINDOWS_PREFIX = "Windows";
042    
043        // System property constants
044        // -----------------------------------------------------------------------
045        // These MUST be declared first. Other constants depend on this.
046    
047        /**
048         * The System property key for the user home directory.
049         */
050        private static final String USER_HOME_KEY = "user.home";
051    
052        /**
053         * The System property key for the user directory.
054         */
055        private static final String USER_DIR_KEY = "user.dir";
056    
057        /**
058         * The System property key for the Java IO temporary directory.
059         */
060        private static final String JAVA_IO_TMPDIR_KEY = "java.io.tmpdir";
061    
062        /**
063         * The System property key for the Java home directory.
064         */
065        private static final String JAVA_HOME_KEY = "java.home";
066    
067        /**
068         * <p>
069         * The {@code awt.toolkit} System Property.
070         * </p>
071         * <p>
072         * Holds a class name, on Windows XP this is {@code sun.awt.windows.WToolkit}.
073         * </p>
074         * <p>
075         * <b>On platforms without a GUI, this value is {@code null}.</b>
076         * </p>
077         * <p>
078         * Defaults to {@code null} if the runtime does not have security access to read this property or the property does
079         * not exist.
080         * </p>
081         * <p>
082         * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or
083         * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of
084         * sync with that System property.
085         * </p>
086         *
087         * @since 2.1
088         */
089        public static final String AWT_TOOLKIT = getSystemProperty("awt.toolkit");
090    
091        /**
092         * <p>
093         * The {@code file.encoding} System Property.
094         * </p>
095         * <p>
096         * File encoding, such as {@code Cp1252}.
097         * </p>
098         * <p>
099         * Defaults to {@code null} if the runtime does not have security access to read this property or the property does
100         * not exist.
101         * </p>
102         * <p>
103         * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or
104         * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of
105         * sync with that System property.
106         * </p>
107         *
108         * @since 2.0
109         * @since Java 1.2
110         */
111        public static final String FILE_ENCODING = getSystemProperty("file.encoding");
112    
113        /**
114         * <p>
115         * The {@code file.separator} System Property. File separator (<code>&quot;/&quot;</code> on UNIX).
116         * </p>
117         * <p>
118         * Defaults to {@code null} if the runtime does not have security access to read this property or the property does
119         * not exist.
120         * </p>
121         * <p>
122         * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or
123         * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of
124         * sync with that System property.
125         * </p>
126         *
127         * @since Java 1.1
128         */
129        public static final String FILE_SEPARATOR = getSystemProperty("file.separator");
130    
131        /**
132         * <p>
133         * The {@code java.awt.fonts} System Property.
134         * </p>
135         * <p>
136         * Defaults to {@code null} if the runtime does not have security access to read this property or the property does
137         * not exist.
138         * </p>
139         * <p>
140         * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or
141         * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of
142         * sync with that System property.
143         * </p>
144         *
145         * @since 2.1
146         */
147        public static final String JAVA_AWT_FONTS = getSystemProperty("java.awt.fonts");
148    
149        /**
150         * <p>
151         * The {@code java.awt.graphicsenv} System Property.
152         * </p>
153         * <p>
154         * Defaults to {@code null} if the runtime does not have security access to read this property or the property does
155         * not exist.
156         * </p>
157         * <p>
158         * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or
159         * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of
160         * sync with that System property.
161         * </p>
162         *
163         * @since 2.1
164         */
165        public static final String JAVA_AWT_GRAPHICSENV = getSystemProperty("java.awt.graphicsenv");
166    
167        /**
168         * <p>
169         * The {@code java.awt.headless} System Property. The value of this property is the String {@code "true"} or
170         * {@code "false"}.
171         * </p>
172         * <p>
173         * Defaults to {@code null} if the runtime does not have security access to read this property or the property does
174         * not exist.
175         * </p>
176         * <p>
177         * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or
178         * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of
179         * sync with that System property.
180         * </p>
181         *
182         * @see #isJavaAwtHeadless()
183         * @since 2.1
184         * @since Java 1.4
185         */
186        public static final String JAVA_AWT_HEADLESS = getSystemProperty("java.awt.headless");
187    
188        /**
189         * <p>
190         * The {@code java.awt.printerjob} System Property.
191         * </p>
192         * <p>
193         * Defaults to {@code null} if the runtime does not have security access to read this property or the property does
194         * not exist.
195         * </p>
196         * <p>
197         * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or
198         * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of
199         * sync with that System property.
200         * </p>
201         *
202         * @since 2.1
203         */
204        public static final String JAVA_AWT_PRINTERJOB = getSystemProperty("java.awt.printerjob");
205    
206        /**
207         * <p>
208         * The {@code java.class.path} System Property. Java class path.
209         * </p>
210         * <p>
211         * Defaults to {@code null} if the runtime does not have security access to read this property or the property does
212         * not exist.
213         * </p>
214         * <p>
215         * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or
216         * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of
217         * sync with that System property.
218         * </p>
219         *
220         * @since Java 1.1
221         */
222        public static final String JAVA_CLASS_PATH = getSystemProperty("java.class.path");
223    
224        /**
225         * <p>
226         * The {@code java.class.version} System Property. Java class format version number.
227         * </p>
228         * <p>
229         * Defaults to {@code null} if the runtime does not have security access to read this property or the property does
230         * not exist.
231         * </p>
232         * <p>
233         * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or
234         * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of
235         * sync with that System property.
236         * </p>
237         *
238         * @since Java 1.1
239         */
240        public static final String JAVA_CLASS_VERSION = getSystemProperty("java.class.version");
241    
242        /**
243         * <p>
244         * The {@code java.compiler} System Property. Name of JIT compiler to use. First in JDK version 1.2. Not used in Sun
245         * JDKs after 1.2.
246         * </p>
247         * <p>
248         * Defaults to {@code null} if the runtime does not have security access to read this property or the property does
249         * not exist.
250         * </p>
251         * <p>
252         * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or
253         * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of
254         * sync with that System property.
255         * </p>
256         *
257         * @since Java 1.2. Not used in Sun versions after 1.2.
258         */
259        public static final String JAVA_COMPILER = getSystemProperty("java.compiler");
260    
261        /**
262         * <p>
263         * The {@code java.endorsed.dirs} System Property. Path of endorsed directory or directories.
264         * </p>
265         * <p>
266         * Defaults to {@code null} if the runtime does not have security access to read this property or the property does
267         * not exist.
268         * </p>
269         * <p>
270         * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or
271         * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of
272         * sync with that System property.
273         * </p>
274         *
275         * @since Java 1.4
276         */
277        public static final String JAVA_ENDORSED_DIRS = getSystemProperty("java.endorsed.dirs");
278    
279        /**
280         * <p>
281         * The {@code java.ext.dirs} System Property. Path of extension directory or directories.
282         * </p>
283         * <p>
284         * Defaults to {@code null} if the runtime does not have security access to read this property or the property does
285         * not exist.
286         * </p>
287         * <p>
288         * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or
289         * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of
290         * sync with that System property.
291         * </p>
292         *
293         * @since Java 1.3
294         */
295        public static final String JAVA_EXT_DIRS = getSystemProperty("java.ext.dirs");
296    
297        /**
298         * <p>
299         * The {@code java.home} System Property. Java installation directory.
300         * </p>
301         * <p>
302         * Defaults to {@code null} if the runtime does not have security access to read this property or the property does
303         * not exist.
304         * </p>
305         * <p>
306         * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or
307         * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of
308         * sync with that System property.
309         * </p>
310         *
311         * @since Java 1.1
312         */
313        public static final String JAVA_HOME = getSystemProperty(JAVA_HOME_KEY);
314    
315        /**
316         * <p>
317         * The {@code java.io.tmpdir} System Property. Default temp file path.
318         * </p>
319         * <p>
320         * Defaults to {@code null} if the runtime does not have security access to read this property or the property does
321         * not exist.
322         * </p>
323         * <p>
324         * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or
325         * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of
326         * sync with that System property.
327         * </p>
328         *
329         * @since Java 1.2
330         */
331        public static final String JAVA_IO_TMPDIR = getSystemProperty(JAVA_IO_TMPDIR_KEY);
332    
333        /**
334         * <p>
335         * The {@code java.library.path} System Property. List of paths to search when loading libraries.
336         * </p>
337         * <p>
338         * Defaults to {@code null} if the runtime does not have security access to read this property or the property does
339         * not exist.
340         * </p>
341         * <p>
342         * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or
343         * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of
344         * sync with that System property.
345         * </p>
346         *
347         * @since Java 1.2
348         */
349        public static final String JAVA_LIBRARY_PATH = getSystemProperty("java.library.path");
350    
351        /**
352         * <p>
353         * The {@code java.runtime.name} System Property. Java Runtime Environment name.
354         * </p>
355         * <p>
356         * Defaults to {@code null} if the runtime does not have security access to read this property or the property does
357         * not exist.
358         * </p>
359         * <p>
360         * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or
361         * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of
362         * sync with that System property.
363         * </p>
364         *
365         * @since 2.0
366         * @since Java 1.3
367         */
368        public static final String JAVA_RUNTIME_NAME = getSystemProperty("java.runtime.name");
369    
370        /**
371         * <p>
372         * The {@code java.runtime.version} System Property. Java Runtime Environment version.
373         * </p>
374         * <p>
375         * Defaults to {@code null} if the runtime does not have security access to read this property or the property does
376         * not exist.
377         * </p>
378         * <p>
379         * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or
380         * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of
381         * sync with that System property.
382         * </p>
383         *
384         * @since 2.0
385         * @since Java 1.3
386         */
387        public static final String JAVA_RUNTIME_VERSION = getSystemProperty("java.runtime.version");
388    
389        /**
390         * <p>
391         * The {@code java.specification.name} System Property. Java Runtime Environment specification name.
392         * </p>
393         * <p>
394         * Defaults to {@code null} if the runtime does not have security access to read this property or the property does
395         * not exist.
396         * </p>
397         * <p>
398         * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or
399         * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of
400         * sync with that System property.
401         * </p>
402         *
403         * @since Java 1.2
404         */
405        public static final String JAVA_SPECIFICATION_NAME = getSystemProperty("java.specification.name");
406    
407        /**
408         * <p>
409         * The {@code java.specification.vendor} System Property. Java Runtime Environment specification vendor.
410         * </p>
411         * <p>
412         * Defaults to {@code null} if the runtime does not have security access to read this property or the property does
413         * not exist.
414         * </p>
415         * <p>
416         * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or
417         * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of
418         * sync with that System property.
419         * </p>
420         *
421         * @since Java 1.2
422         */
423        public static final String JAVA_SPECIFICATION_VENDOR = getSystemProperty("java.specification.vendor");
424    
425        /**
426         * <p>
427         * The {@code java.specification.version} System Property. Java Runtime Environment specification version.
428         * </p>
429         * <p>
430         * Defaults to {@code null} if the runtime does not have security access to read this property or the property does
431         * not exist.
432         * </p>
433         * <p>
434         * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or
435         * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of
436         * sync with that System property.
437         * </p>
438         *
439         * @since Java 1.3
440         */
441        public static final String JAVA_SPECIFICATION_VERSION = getSystemProperty("java.specification.version");
442        private static final JavaVersion JAVA_SPECIFICATION_VERSION_AS_ENUM = JavaVersion.get(JAVA_SPECIFICATION_VERSION);
443    
444        /**
445         * <p>
446         * The {@code java.util.prefs.PreferencesFactory} System Property. A class name.
447         * </p>
448         * <p>
449         * Defaults to {@code null} if the runtime does not have security access to read this property or the property does
450         * not exist.
451         * </p>
452         * <p>
453         * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or
454         * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of
455         * sync with that System property.
456         * </p>
457         *
458         * @since 2.1
459         * @since Java 1.4
460         */
461        public static final String JAVA_UTIL_PREFS_PREFERENCES_FACTORY =
462            getSystemProperty("java.util.prefs.PreferencesFactory");
463    
464        /**
465         * <p>
466         * The {@code java.vendor} System Property. Java vendor-specific string.
467         * </p>
468         * <p>
469         * Defaults to {@code null} if the runtime does not have security access to read this property or the property does
470         * not exist.
471         * </p>
472         * <p>
473         * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or
474         * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of
475         * sync with that System property.
476         * </p>
477         *
478         * @since Java 1.1
479         */
480        public static final String JAVA_VENDOR = getSystemProperty("java.vendor");
481    
482        /**
483         * <p>
484         * The {@code java.vendor.url} System Property. Java vendor URL.
485         * </p>
486         * <p>
487         * Defaults to {@code null} if the runtime does not have security access to read this property or the property does
488         * not exist.
489         * </p>
490         * <p>
491         * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or
492         * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of
493         * sync with that System property.
494         * </p>
495         *
496         * @since Java 1.1
497         */
498        public static final String JAVA_VENDOR_URL = getSystemProperty("java.vendor.url");
499    
500        /**
501         * <p>
502         * The {@code java.version} System Property. Java version number.
503         * </p>
504         * <p>
505         * Defaults to {@code null} if the runtime does not have security access to read this property or the property does
506         * not exist.
507         * </p>
508         * <p>
509         * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or
510         * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of
511         * sync with that System property.
512         * </p>
513         *
514         * @since Java 1.1
515         */
516        public static final String JAVA_VERSION = getSystemProperty("java.version");
517    
518        /**
519         * <p>
520         * The {@code java.vm.info} System Property. Java Virtual Machine implementation info.
521         * </p>
522         * <p>
523         * Defaults to {@code null} if the runtime does not have security access to read this property or the property does
524         * not exist.
525         * </p>
526         * <p>
527         * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or
528         * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of
529         * sync with that System property.
530         * </p>
531         *
532         * @since 2.0
533         * @since Java 1.2
534         */
535        public static final String JAVA_VM_INFO = getSystemProperty("java.vm.info");
536    
537        /**
538         * <p>
539         * The {@code java.vm.name} System Property. Java Virtual Machine implementation name.
540         * </p>
541         * <p>
542         * Defaults to {@code null} if the runtime does not have security access to read this property or the property does
543         * not exist.
544         * </p>
545         * <p>
546         * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or
547         * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of
548         * sync with that System property.
549         * </p>
550         *
551         * @since Java 1.2
552         */
553        public static final String JAVA_VM_NAME = getSystemProperty("java.vm.name");
554    
555        /**
556         * <p>
557         * The {@code java.vm.specification.name} System Property. Java Virtual Machine specification name.
558         * </p>
559         * <p>
560         * Defaults to {@code null} if the runtime does not have security access to read this property or the property does
561         * not exist.
562         * </p>
563         * <p>
564         * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or
565         * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of
566         * sync with that System property.
567         * </p>
568         *
569         * @since Java 1.2
570         */
571        public static final String JAVA_VM_SPECIFICATION_NAME = getSystemProperty("java.vm.specification.name");
572    
573        /**
574         * <p>
575         * The {@code java.vm.specification.vendor} System Property. Java Virtual Machine specification vendor.
576         * </p>
577         * <p>
578         * Defaults to {@code null} if the runtime does not have security access to read this property or the property does
579         * not exist.
580         * </p>
581         * <p>
582         * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or
583         * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of
584         * sync with that System property.
585         * </p>
586         *
587         * @since Java 1.2
588         */
589        public static final String JAVA_VM_SPECIFICATION_VENDOR = getSystemProperty("java.vm.specification.vendor");
590    
591        /**
592         * <p>
593         * The {@code java.vm.specification.version} System Property. Java Virtual Machine specification version.
594         * </p>
595         * <p>
596         * Defaults to {@code null} if the runtime does not have security access to read this property or the property does
597         * not exist.
598         * </p>
599         * <p>
600         * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or
601         * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of
602         * sync with that System property.
603         * </p>
604         *
605         * @since Java 1.2
606         */
607        public static final String JAVA_VM_SPECIFICATION_VERSION = getSystemProperty("java.vm.specification.version");
608    
609        /**
610         * <p>
611         * The {@code java.vm.vendor} System Property. Java Virtual Machine implementation vendor.
612         * </p>
613         * <p>
614         * Defaults to {@code null} if the runtime does not have security access to read this property or the property does
615         * not exist.
616         * </p>
617         * <p>
618         * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or
619         * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of
620         * sync with that System property.
621         * </p>
622         *
623         * @since Java 1.2
624         */
625        public static final String JAVA_VM_VENDOR = getSystemProperty("java.vm.vendor");
626    
627        /**
628         * <p>
629         * The {@code java.vm.version} System Property. Java Virtual Machine implementation version.
630         * </p>
631         * <p>
632         * Defaults to {@code null} if the runtime does not have security access to read this property or the property does
633         * not exist.
634         * </p>
635         * <p>
636         * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or
637         * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of
638         * sync with that System property.
639         * </p>
640         *
641         * @since Java 1.2
642         */
643        public static final String JAVA_VM_VERSION = getSystemProperty("java.vm.version");
644    
645        /**
646         * <p>
647         * The {@code line.separator} System Property. Line separator (<code>&quot;\n&quot;</code> on UNIX).
648         * </p>
649         * <p>
650         * Defaults to {@code null} if the runtime does not have security access to read this property or the property does
651         * not exist.
652         * </p>
653         * <p>
654         * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or
655         * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of
656         * sync with that System property.
657         * </p>
658         *
659         * @since Java 1.1
660         */
661        public static final String LINE_SEPARATOR = getSystemProperty("line.separator");
662    
663        /**
664         * <p>
665         * The {@code os.arch} System Property. Operating system architecture.
666         * </p>
667         * <p>
668         * Defaults to {@code null} if the runtime does not have security access to read this property or the property does
669         * not exist.
670         * </p>
671         * <p>
672         * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or
673         * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of
674         * sync with that System property.
675         * </p>
676         *
677         * @since Java 1.1
678         */
679        public static final String OS_ARCH = getSystemProperty("os.arch");
680    
681        /**
682         * <p>
683         * The {@code os.name} System Property. Operating system name.
684         * </p>
685         * <p>
686         * Defaults to {@code null} if the runtime does not have security access to read this property or the property does
687         * not exist.
688         * </p>
689         * <p>
690         * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or
691         * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of
692         * sync with that System property.
693         * </p>
694         *
695         * @since Java 1.1
696         */
697        public static final String OS_NAME = getSystemProperty("os.name");
698    
699        /**
700         * <p>
701         * The {@code os.version} System Property. Operating system version.
702         * </p>
703         * <p>
704         * Defaults to {@code null} if the runtime does not have security access to read this property or the property does
705         * not exist.
706         * </p>
707         * <p>
708         * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or
709         * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of
710         * sync with that System property.
711         * </p>
712         *
713         * @since Java 1.1
714         */
715        public static final String OS_VERSION = getSystemProperty("os.version");
716    
717        /**
718         * <p>
719         * The {@code path.separator} System Property. Path separator (<code>&quot;:&quot;</code> on UNIX).
720         * </p>
721         * <p>
722         * Defaults to {@code null} if the runtime does not have security access to read this property or the property does
723         * not exist.
724         * </p>
725         * <p>
726         * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or
727         * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of
728         * sync with that System property.
729         * </p>
730         *
731         * @since Java 1.1
732         */
733        public static final String PATH_SEPARATOR = getSystemProperty("path.separator");
734    
735        /**
736         * <p>
737         * The {@code user.country} or {@code user.region} System Property. User's country code, such as {@code GB}. First
738         * in Java version 1.2 as {@code user.region}. Renamed to {@code user.country} in 1.4
739         * </p>
740         * <p>
741         * Defaults to {@code null} if the runtime does not have security access to read this property or the property does
742         * not exist.
743         * </p>
744         * <p>
745         * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or
746         * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of
747         * sync with that System property.
748         * </p>
749         *
750         * @since 2.0
751         * @since Java 1.2
752         */
753        public static final String USER_COUNTRY = getSystemProperty("user.country") == null ?
754                getSystemProperty("user.region") : getSystemProperty("user.country");
755    
756        /**
757         * <p>
758         * The {@code user.dir} System Property. User's current working directory.
759         * </p>
760         * <p>
761         * Defaults to {@code null} if the runtime does not have security access to read this property or the property does
762         * not exist.
763         * </p>
764         * <p>
765         * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or
766         * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of
767         * sync with that System property.
768         * </p>
769         *
770         * @since Java 1.1
771         */
772        public static final String USER_DIR = getSystemProperty(USER_DIR_KEY);
773    
774        /**
775         * <p>
776         * The {@code user.home} System Property. User's home directory.
777         * </p>
778         * <p>
779         * Defaults to {@code null} if the runtime does not have security access to read this property or the property does
780         * not exist.
781         * </p>
782         * <p>
783         * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or
784         * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of
785         * sync with that System property.
786         * </p>
787         *
788         * @since Java 1.1
789         */
790        public static final String USER_HOME = getSystemProperty(USER_HOME_KEY);
791    
792        /**
793         * <p>
794         * The {@code user.language} System Property. User's language code, such as {@code "en"}.
795         * </p>
796         * <p>
797         * Defaults to {@code null} if the runtime does not have security access to read this property or the property does
798         * not exist.
799         * </p>
800         * <p>
801         * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or
802         * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of
803         * sync with that System property.
804         * </p>
805         *
806         * @since 2.0
807         * @since Java 1.2
808         */
809        public static final String USER_LANGUAGE = getSystemProperty("user.language");
810    
811        /**
812         * <p>
813         * The {@code user.name} System Property. User's account name.
814         * </p>
815         * <p>
816         * Defaults to {@code null} if the runtime does not have security access to read this property or the property does
817         * not exist.
818         * </p>
819         * <p>
820         * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or
821         * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of
822         * sync with that System property.
823         * </p>
824         *
825         * @since Java 1.1
826         */
827        public static final String USER_NAME = getSystemProperty("user.name");
828    
829        /**
830         * <p>
831         * The {@code user.timezone} System Property. For example: {@code "America/Los_Angeles"}.
832         * </p>
833         * <p>
834         * Defaults to {@code null} if the runtime does not have security access to read this property or the property does
835         * not exist.
836         * </p>
837         * <p>
838         * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or
839         * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of
840         * sync with that System property.
841         * </p>
842         *
843         * @since 2.1
844         */
845        public static final String USER_TIMEZONE = getSystemProperty("user.timezone");
846    
847        // Java version checks
848        // -----------------------------------------------------------------------
849        // These MUST be declared after those above as they depend on the
850        // values being set up
851    
852        /**
853         * <p>
854         * Is {@code true} if this is Java version 1.1 (also 1.1.x versions).
855         * </p>
856         * <p>
857         * The field will return {@code false} if {@link #JAVA_VERSION} is {@code null}.
858         * </p>
859         */
860        public static final boolean IS_JAVA_1_1 = getJavaVersionMatches("1.1");
861    
862        /**
863         * <p>
864         * Is {@code true} if this is Java version 1.2 (also 1.2.x versions).
865         * </p>
866         * <p>
867         * The field will return {@code false} if {@link #JAVA_VERSION} is {@code null}.
868         * </p>
869         */
870        public static final boolean IS_JAVA_1_2 = getJavaVersionMatches("1.2");
871    
872        /**
873         * <p>
874         * Is {@code true} if this is Java version 1.3 (also 1.3.x versions).
875         * </p>
876         * <p>
877         * The field will return {@code false} if {@link #JAVA_VERSION} is {@code null}.
878         * </p>
879         */
880        public static final boolean IS_JAVA_1_3 = getJavaVersionMatches("1.3");
881    
882        /**
883         * <p>
884         * Is {@code true} if this is Java version 1.4 (also 1.4.x versions).
885         * </p>
886         * <p>
887         * The field will return {@code false} if {@link #JAVA_VERSION} is {@code null}.
888         * </p>
889         */
890        public static final boolean IS_JAVA_1_4 = getJavaVersionMatches("1.4");
891    
892        /**
893         * <p>
894         * Is {@code true} if this is Java version 1.5 (also 1.5.x versions).
895         * </p>
896         * <p>
897         * The field will return {@code false} if {@link #JAVA_VERSION} is {@code null}.
898         * </p>
899         */
900        public static final boolean IS_JAVA_1_5 = getJavaVersionMatches("1.5");
901    
902        /**
903         * <p>
904         * Is {@code true} if this is Java version 1.6 (also 1.6.x versions).
905         * </p>
906         * <p>
907         * The field will return {@code false} if {@link #JAVA_VERSION} is {@code null}.
908         * </p>
909         */
910        public static final boolean IS_JAVA_1_6 = getJavaVersionMatches("1.6");
911    
912        /**
913         * <p>
914         * Is {@code true} if this is Java version 1.7 (also 1.7.x versions).
915         * </p>
916         * <p>
917         * The field will return {@code false} if {@link #JAVA_VERSION} is {@code null}.
918         * </p>
919         *
920         * @since 3.0
921         */
922        public static final boolean IS_JAVA_1_7 = getJavaVersionMatches("1.7");
923    
924        // Operating system checks
925        // -----------------------------------------------------------------------
926        // These MUST be declared after those above as they depend on the
927        // values being set up
928        // OS names from http://www.vamphq.com/os.html
929        // Selected ones included - please advise dev@commons.apache.org
930        // if you want another added or a mistake corrected
931    
932        /**
933         * <p>
934         * Is {@code true} if this is AIX.
935         * </p>
936         * <p>
937         * The field will return {@code false} if {@code OS_NAME} is {@code null}.
938         * </p>
939         *
940         * @since 2.0
941         */
942        public static final boolean IS_OS_AIX = getOSMatchesName("AIX");
943    
944        /**
945         * <p>
946         * Is {@code true} if this is HP-UX.
947         * </p>
948         * <p>
949         * The field will return {@code false} if {@code OS_NAME} is {@code null}.
950         * </p>
951         *
952         * @since 2.0
953         */
954        public static final boolean IS_OS_HP_UX = getOSMatchesName("HP-UX");
955    
956        /**
957         * <p>
958         * Is {@code true} if this is Irix.
959         * </p>
960         * <p>
961         * The field will return {@code false} if {@code OS_NAME} is {@code null}.
962         * </p>
963         *
964         * @since 2.0
965         */
966        public static final boolean IS_OS_IRIX = getOSMatchesName("Irix");
967    
968        /**
969         * <p>
970         * Is {@code true} if this is Linux.
971         * </p>
972         * <p>
973         * The field will return {@code false} if {@code OS_NAME} is {@code null}.
974         * </p>
975         *
976         * @since 2.0
977         */
978        public static final boolean IS_OS_LINUX = getOSMatchesName("Linux") || getOSMatchesName("LINUX");
979    
980        /**
981         * <p>
982         * Is {@code true} if this is Mac.
983         * </p>
984         * <p>
985         * The field will return {@code false} if {@code OS_NAME} is {@code null}.
986         * </p>
987         *
988         * @since 2.0
989         */
990        public static final boolean IS_OS_MAC = getOSMatchesName("Mac");
991    
992        /**
993         * <p>
994         * Is {@code true} if this is Mac.
995         * </p>
996         * <p>
997         * The field will return {@code false} if {@code OS_NAME} is {@code null}.
998         * </p>
999         *
1000         * @since 2.0
1001         */
1002        public static final boolean IS_OS_MAC_OSX = getOSMatchesName("Mac OS X");
1003    
1004        /**
1005         * <p>
1006         * Is {@code true} if this is FreeBSD.
1007         * </p>
1008         * <p>
1009         * The field will return {@code false} if {@code OS_NAME} is {@code null}.
1010         * </p>
1011         *
1012         * @since 3.1
1013         */
1014        public static final boolean IS_OS_FREE_BSD = getOSMatchesName("FreeBSD");
1015    
1016        /**
1017         * <p>
1018         * Is {@code true} if this is OpenBSD.
1019         * </p>
1020         * <p>
1021         * The field will return {@code false} if {@code OS_NAME} is {@code null}.
1022         * </p>
1023         *
1024         * @since 3.1
1025         */
1026        public static final boolean IS_OS_OPEN_BSD = getOSMatchesName("OpenBSD");
1027    
1028        /**
1029         * <p>
1030         * Is {@code true} if this is NetBSD.
1031         * </p>
1032         * <p>
1033         * The field will return {@code false} if {@code OS_NAME} is {@code null}.
1034         * </p>
1035         *
1036         * @since 3.1
1037         */
1038        public static final boolean IS_OS_NET_BSD = getOSMatchesName("NetBSD");
1039    
1040        /**
1041         * <p>
1042         * Is {@code true} if this is OS/2.
1043         * </p>
1044         * <p>
1045         * The field will return {@code false} if {@code OS_NAME} is {@code null}.
1046         * </p>
1047         *
1048         * @since 2.0
1049         */
1050        public static final boolean IS_OS_OS2 = getOSMatchesName("OS/2");
1051    
1052        /**
1053         * <p>
1054         * Is {@code true} if this is Solaris.
1055         * </p>
1056         * <p>
1057         * The field will return {@code false} if {@code OS_NAME} is {@code null}.
1058         * </p>
1059         *
1060         * @since 2.0
1061         */
1062        public static final boolean IS_OS_SOLARIS = getOSMatchesName("Solaris");
1063    
1064        /**
1065         * <p>
1066         * Is {@code true} if this is SunOS.
1067         * </p>
1068         * <p>
1069         * The field will return {@code false} if {@code OS_NAME} is {@code null}.
1070         * </p>
1071         *
1072         * @since 2.0
1073         */
1074        public static final boolean IS_OS_SUN_OS = getOSMatchesName("SunOS");
1075    
1076        /**
1077         * <p>
1078         * Is {@code true} if this is a UNIX like system, as in any of AIX, HP-UX, Irix, Linux, MacOSX, Solaris or SUN OS.
1079         * </p>
1080         * <p>
1081         * The field will return {@code false} if {@code OS_NAME} is {@code null}.
1082         * </p>
1083         *
1084         * @since 2.1
1085         */
1086        public static final boolean IS_OS_UNIX = IS_OS_AIX || IS_OS_HP_UX || IS_OS_IRIX || IS_OS_LINUX || IS_OS_MAC_OSX
1087                || IS_OS_SOLARIS || IS_OS_SUN_OS || IS_OS_FREE_BSD || IS_OS_OPEN_BSD || IS_OS_NET_BSD;
1088    
1089        /**
1090         * <p>
1091         * Is {@code true} if this is Windows.
1092         * </p>
1093         * <p>
1094         * The field will return {@code false} if {@code OS_NAME} is {@code null}.
1095         * </p>
1096         *
1097         * @since 2.0
1098         */
1099        public static final boolean IS_OS_WINDOWS = getOSMatchesName(OS_NAME_WINDOWS_PREFIX);
1100    
1101        /**
1102         * <p>
1103         * Is {@code true} if this is Windows 2000.
1104         * </p>
1105         * <p>
1106         * The field will return {@code false} if {@code OS_NAME} is {@code null}.
1107         * </p>
1108         *
1109         * @since 2.0
1110         */
1111        public static final boolean IS_OS_WINDOWS_2000 = getOSMatches(OS_NAME_WINDOWS_PREFIX, "5.0");
1112    
1113        /**
1114         * <p>
1115         * Is {@code true} if this is Windows 2003.
1116         * </p>
1117         * <p>
1118         * The field will return {@code false} if {@code OS_NAME} is {@code null}.
1119         * </p>
1120         *
1121         * @since 3.1
1122         */
1123        public static final boolean IS_OS_WINDOWS_2003 = getOSMatches(OS_NAME_WINDOWS_PREFIX, "5.2");
1124    
1125        /**
1126         * <p>
1127         * Is {@code true} if this is Windows 2008.
1128         * </p>
1129         * <p>
1130         * The field will return {@code false} if {@code OS_NAME} is {@code null}.
1131         * </p>
1132         *
1133         * @since 3.1
1134         */
1135        public static final boolean IS_OS_WINDOWS_2008 = getOSMatches(OS_NAME_WINDOWS_PREFIX + " Server 2008", "6.1");
1136    
1137        /**
1138         * <p>
1139         * Is {@code true} if this is Windows 95.
1140         * </p>
1141         * <p>
1142         * The field will return {@code false} if {@code OS_NAME} is {@code null}.
1143         * </p>
1144         *
1145         * @since 2.0
1146         */
1147        public static final boolean IS_OS_WINDOWS_95 = getOSMatches(OS_NAME_WINDOWS_PREFIX + " 9", "4.0");
1148        // Java 1.2 running on Windows98 returns 'Windows 95', hence the above
1149    
1150        /**
1151         * <p>
1152         * Is {@code true} if this is Windows 98.
1153         * </p>
1154         * <p>
1155         * The field will return {@code false} if {@code OS_NAME} is {@code null}.
1156         * </p>
1157         *
1158         * @since 2.0
1159         */
1160        public static final boolean IS_OS_WINDOWS_98 = getOSMatches(OS_NAME_WINDOWS_PREFIX + " 9", "4.1");
1161        // Java 1.2 running on Windows98 returns 'Windows 95', hence the above
1162    
1163        /**
1164         * <p>
1165         * Is {@code true} if this is Windows ME.
1166         * </p>
1167         * <p>
1168         * The field will return {@code false} if {@code OS_NAME} is {@code null}.
1169         * </p>
1170         *
1171         * @since 2.0
1172         */
1173        public static final boolean IS_OS_WINDOWS_ME = getOSMatches(OS_NAME_WINDOWS_PREFIX, "4.9");
1174        // Java 1.2 running on WindowsME may return 'Windows 95', hence the above
1175    
1176        /**
1177         * <p>
1178         * Is {@code true} if this is Windows NT.
1179         * </p>
1180         * <p>
1181         * The field will return {@code false} if {@code OS_NAME} is {@code null}.
1182         * </p>
1183         *
1184         * @since 2.0
1185         */
1186        public static final boolean IS_OS_WINDOWS_NT = getOSMatchesName(OS_NAME_WINDOWS_PREFIX + " NT");
1187        // Windows 2000 returns 'Windows 2000' but may suffer from same Java1.2 problem
1188    
1189        /**
1190         * <p>
1191         * Is {@code true} if this is Windows XP.
1192         * </p>
1193         * <p>
1194         * The field will return {@code false} if {@code OS_NAME} is {@code null}.
1195         * </p>
1196         *
1197         * @since 2.0
1198         */
1199        public static final boolean IS_OS_WINDOWS_XP = getOSMatches(OS_NAME_WINDOWS_PREFIX, "5.1");
1200    
1201        // -----------------------------------------------------------------------
1202        /**
1203         * <p>
1204         * Is {@code true} if this is Windows Vista.
1205         * </p>
1206         * <p>
1207         * The field will return {@code false} if {@code OS_NAME} is {@code null}.
1208         * </p>
1209         *
1210         * @since 2.4
1211         */
1212        public static final boolean IS_OS_WINDOWS_VISTA = getOSMatches(OS_NAME_WINDOWS_PREFIX, "6.0");
1213    
1214        /**
1215         * <p>
1216         * Is {@code true} if this is Windows 7.
1217         * </p>
1218         * <p>
1219         * The field will return {@code false} if {@code OS_NAME} is {@code null}.
1220         * </p>
1221         *
1222         * @since 3.0
1223         */
1224        public static final boolean IS_OS_WINDOWS_7 = getOSMatches(OS_NAME_WINDOWS_PREFIX, "6.1");
1225    
1226        /**
1227         * <p>
1228         * Gets the Java home directory as a {@code File}.
1229         * </p>
1230         *
1231         * @return a directory
1232         * @throws SecurityException if a security manager exists and its {@code checkPropertyAccess} method doesn't allow
1233         * access to the specified system property.
1234         * @see System#getProperty(String)
1235         * @since 2.1
1236         */
1237        public static File getJavaHome() {
1238            return new File(System.getProperty(JAVA_HOME_KEY));
1239        }
1240    
1241        /**
1242         * <p>
1243         * Gets the Java IO temporary directory as a {@code File}.
1244         * </p>
1245         *
1246         * @return a directory
1247         * @throws SecurityException if a security manager exists and its {@code checkPropertyAccess} method doesn't allow
1248         * access to the specified system property.
1249         * @see System#getProperty(String)
1250         * @since 2.1
1251         */
1252        public static File getJavaIoTmpDir() {
1253            return new File(System.getProperty(JAVA_IO_TMPDIR_KEY));
1254        }
1255    
1256        /**
1257         * <p>
1258         * Decides if the Java version matches.
1259         * </p>
1260         *
1261         * @param versionPrefix the prefix for the java version
1262         * @return true if matches, or false if not or can't determine
1263         */
1264        private static boolean getJavaVersionMatches(String versionPrefix) {
1265            return isJavaVersionMatch(JAVA_SPECIFICATION_VERSION, versionPrefix);
1266        }
1267    
1268        /**
1269         * Decides if the operating system matches.
1270         *
1271         * @param osNamePrefix the prefix for the os name
1272         * @param osVersionPrefix the prefix for the version
1273         * @return true if matches, or false if not or can't determine
1274         */
1275        private static boolean getOSMatches(String osNamePrefix, String osVersionPrefix) {
1276            return isOSMatch(OS_NAME, OS_VERSION, osNamePrefix, osVersionPrefix);
1277        }
1278    
1279        /**
1280         * Decides if the operating system matches.
1281         *
1282         * @param osNamePrefix the prefix for the os name
1283         * @return true if matches, or false if not or can't determine
1284         */
1285        private static boolean getOSMatchesName(String osNamePrefix) {
1286            return isOSNameMatch(OS_NAME, osNamePrefix);
1287        }
1288    
1289        // -----------------------------------------------------------------------
1290        /**
1291         * <p>
1292         * Gets a System property, defaulting to {@code null} if the property cannot be read.
1293         * </p>
1294         * <p>
1295         * If a {@code SecurityException} is caught, the return value is {@code null} and a message is written to
1296         * {@code System.err}.
1297         * </p>
1298         *
1299         * @param property the system property name
1300         * @return the system property value or {@code null} if a security problem occurs
1301         */
1302        private static String getSystemProperty(String property) {
1303            try {
1304                return System.getProperty(property);
1305            } catch (SecurityException ex) {
1306                // we are not allowed to look at this property
1307                System.err.println("Caught a SecurityException reading the system property '" + property
1308                        + "'; the SystemUtils property value will default to null.");
1309                return null;
1310            }
1311        }
1312    
1313        /**
1314         * <p>
1315         * Gets the user directory as a {@code File}.
1316         * </p>
1317         *
1318         * @return a directory
1319         * @throws SecurityException if a security manager exists and its {@code checkPropertyAccess} method doesn't allow
1320         * access to the specified system property.
1321         * @see System#getProperty(String)
1322         * @since 2.1
1323         */
1324        public static File getUserDir() {
1325            return new File(System.getProperty(USER_DIR_KEY));
1326        }
1327    
1328        /**
1329         * <p>
1330         * Gets the user home directory as a {@code File}.
1331         * </p>
1332         *
1333         * @return a directory
1334         * @throws SecurityException if a security manager exists and its {@code checkPropertyAccess} method doesn't allow
1335         * access to the specified system property.
1336         * @see System#getProperty(String)
1337         * @since 2.1
1338         */
1339        public static File getUserHome() {
1340            return new File(System.getProperty(USER_HOME_KEY));
1341        }
1342    
1343        /**
1344         * Returns whether the {@link #JAVA_AWT_HEADLESS} value is {@code true}.
1345         *
1346         * @return {@code true} if {@code JAVA_AWT_HEADLESS} is {@code "true"}, {@code false} otherwise.
1347         * @see #JAVA_AWT_HEADLESS
1348         * @since 2.1
1349         * @since Java 1.4
1350         */
1351        public static boolean isJavaAwtHeadless() {
1352            return JAVA_AWT_HEADLESS != null ? JAVA_AWT_HEADLESS.equals(Boolean.TRUE.toString()) : false;
1353        }
1354    
1355        /**
1356         * <p>
1357         * Is the Java version at least the requested version.
1358         * </p>
1359         * <p>
1360         * Example input:
1361         * </p>
1362         * <ul>
1363         * <li>{@code 1.2f} to test for Java 1.2</li>
1364         * <li>{@code 1.31f} to test for Java 1.3.1</li>
1365         * </ul>
1366         *
1367         * @param requiredVersion the required version, for example 1.31f
1368         * @return {@code true} if the actual version is equal or greater than the required version
1369         */
1370        public static boolean isJavaVersionAtLeast(JavaVersion requiredVersion) {
1371            return JAVA_SPECIFICATION_VERSION_AS_ENUM.atLeast(requiredVersion);
1372        }
1373    
1374        /**
1375         * <p>
1376         * Decides if the Java version matches.
1377         * </p>
1378         * <p>
1379         * This method is package private instead of private to support unit test invocation.
1380         * </p>
1381         *
1382         * @param version the actual Java version
1383         * @param versionPrefix the prefix for the expected Java version
1384         * @return true if matches, or false if not or can't determine
1385         */
1386        static boolean isJavaVersionMatch(String version, String versionPrefix) {
1387            if (version == null) {
1388                return false;
1389            }
1390            return version.startsWith(versionPrefix);
1391        }
1392    
1393        /**
1394         * Decides if the operating system matches.
1395         * <p>
1396         * This method is package private instead of private to support unit test invocation.
1397         * </p>
1398         *
1399         * @param osName the actual OS name
1400         * @param osVersion the actual OS version
1401         * @param osNamePrefix the prefix for the expected OS name
1402         * @param osVersionPrefix the prefix for the expected OS version
1403         * @return true if matches, or false if not or can't determine
1404         */
1405        static boolean isOSMatch(String osName, String osVersion, String osNamePrefix, String osVersionPrefix) {
1406            if (osName == null || osVersion == null) {
1407                return false;
1408            }
1409            return osName.startsWith(osNamePrefix) && osVersion.startsWith(osVersionPrefix);
1410        }
1411    
1412        /**
1413         * Decides if the operating system matches.
1414         * <p>
1415         * This method is package private instead of private to support unit test invocation.
1416         * </p>
1417         *
1418         * @param osName the actual OS name
1419         * @param osNamePrefix the prefix for the expected OS name
1420         * @return true if matches, or false if not or can't determine
1421         */
1422        static boolean isOSNameMatch(String osName, String osNamePrefix) {
1423            if (osName == null) {
1424                return false;
1425            }
1426            return osName.startsWith(osNamePrefix);
1427        }
1428    
1429        // -----------------------------------------------------------------------
1430        /**
1431         * <p>
1432         * SystemUtils instances should NOT be constructed in standard programming. Instead, the class should be used as
1433         * {@code SystemUtils.FILE_SEPARATOR}.
1434         * </p>
1435         * <p>
1436         * This constructor is public to permit tools that require a JavaBean instance to operate.
1437         * </p>
1438         */
1439        public SystemUtils() {
1440            super();
1441        }
1442    
1443    }