commons.java subversion repository
sventon subversion web client - http://www.sventon.org |
[show recent changes] | |
Rev: 679 - https://secure.bioinfweb.info/Code/svn/commons.java / trunk / main / info.bioinfweb.commons.core / src / info / bioinfweb / commons / SystemUtils.java |
Show File - SystemUtils.java [show properties] |

1 | /* |
2 | * bioinfweb.commons.java - Shared components of bioinfweb projects made available in a Java library |
3 | * Copyright (C) 2008-2011, 2013-2018 Ben Stöver, Sarah Wiechers |
4 | * <http://commons.bioinfweb.info/Java> |
5 | * |
6 | * This file is free software: you can redistribute it and/or modify |
7 | * it under the terms of the GNU Lesser General Public License as published by |
8 | * the Free Software Foundation, either version 3 of the License, or |
9 | * (at your option) any later version. |
10 | * |
11 | * This file is distributed in the hope that it will be useful, |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | * GNU Lesser General Public License for more details. |
15 | * |
16 | * You should have received a copy of the GNU Lesser General Public License |
17 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
18 | */ |
19 | package info.bioinfweb.commons; |
20 | |
21 | |
22 | |
23 | /** |
24 | * An extension of the apache commons class {@link org.apache.commons.lang3.SystemUtils}. |
25 | * |
26 | * @author Ben Stöver |
27 | */ |
28 | public class SystemUtils extends org.apache.commons.lang3.SystemUtils { |
29 | public static final boolean IS_64_BIT_ARCHITECTURE = is64BitArchitecture(); |
30 | |
31 | |
32 | /** |
33 | * It is unnecessary to create instances of this class. |
34 | */ |
35 | protected SystemUtils() { |
36 | super(); |
37 | } |
38 | |
39 | |
40 | private static boolean is64BitArchitecture() { |
41 | String arch = System.getenv("PROCESSOR_ARCHITECTURE"); |
42 | String wow64Arch = System.getenv("PROCESSOR_ARCHITEW6432"); |
43 | |
44 | if (IS_OS_WINDOWS) { |
45 | return arch.endsWith("64") || wow64Arch != null && wow64Arch.endsWith("64"); |
46 | } |
47 | else { |
48 | return System.getProperty("os.arch").contains("64"); |
49 | } |
50 | } |
51 | } |
sventon 2.5.1