Untitled
compile group: 'org.slf4j', name: 'slf4j-api', version: '2.0.0-alpha1'
-> slf4j-api-2.0.0-alpha1.jar
testCompile group: 'org.slf4j', name: 'slf4j-simple', version: '2.0.0-alpha1'
This https://crunchify.com/how-to-add-resources-folder-properties-at-runtime-into-intellijs-classpath-adding-property-files-to-classpath/ help me added a resources folder in intellij project
Get OS type:
private static final int osType;
String osName = System.getProperty("os.name");
if (osName.startsWith("Linux")) {
if ("dalvik".equals(System.getProperty("java.vm.name").toLowerCase())) {
osType = ANDROID;
// Native libraries on android must be bundled with the APK
System.setProperty("jna.nounpack", "true");
}
else {
osType = LINUX;
}
}
else if (osName.startsWith("AIX")) {
osType = AIX;
}
else if (osName.startsWith("Mac") || osName.startsWith("Darwin")) {
osType = MAC;
}
else if (osName.startsWith("Windows CE")) {
osType = WINDOWSCE;
}
else if (osName.startsWith("Windows")) {
osType = WINDOWS;
}
else if (osName.startsWith("Solaris") || osName.startsWith("SunOS")) {
osType = SOLARIS;
}
else if (osName.startsWith("FreeBSD")) {
osType = FREEBSD;
}
else if (osName.startsWith("OpenBSD")) {
osType = OPENBSD;
}
else if (osName.equalsIgnoreCase("gnu")) {
osType = GNU;
}
else if (osName.equalsIgnoreCase("gnu/kfreebsd")) {
osType = KFREEBSD;
}
else if (osName.equalsIgnoreCase("netbsd")) {
osType = NETBSD;
}
else {
osType = UNSPECIFIED;
}
boolean hasBuffers = false;
try {
Class.forName("java.nio.Buffer");
hasBuffers = true;
}
catch(ClassNotFoundException e) {
}
// NOTE: we used to do Class.forName("java.awt.Component"), but that
// has the unintended side effect of actually loading AWT native libs,
// which can be problematic
HAS_AWT = osType != WINDOWSCE && osType != ANDROID && osType != AIX;
HAS_JAWT = HAS_AWT && osType != MAC;
HAS_BUFFERS = hasBuffers;
RO_FIELDS = osType != WINDOWSCE;
C_LIBRARY_NAME = osType == WINDOWS ? "msvcrt" : osType == WINDOWSCE ? "coredll" : "c";
MATH_LIBRARY_NAME = osType == WINDOWS ? "msvcrt" : osType == WINDOWSCE ? "coredll" : "m";
HAS_DLL_CALLBACKS = osType == WINDOWS;
ARCH = getCanonicalArchitecture(System.getProperty("os.arch"), osType);
RESOURCE_PREFIX = getNativeLibraryResourcePrefix();
}
`
String osName = System.getProperty("os.name");
Last updated
Was this helpful?