GUACAMOLE-1407: Automatically detect whether MySQL or MariaDB version of "Connector/J" is installed.

This commit is contained in:
Michael Jumper committed 2021-08-26 18:37:39 -07:00
1 parent 5cf030a9e3
commit be1ad5dff3
3 files changed
+82 -10

No files matched your search

@@ -192,4 +192,24 @@ public abstract class JDBCEnvironment extends DelegatingEnvironment {
*/
public abstract String getPassword() throws GuacamoleException;
/**
* Returns whether the given Java class is defined within the classpath.
*
* @param classname
* The name of the Java class to check.
*
* @return
* true if the given Java class is present within the classpath, false
* otherwise.
*/
public static boolean isClassDefined(String classname) {
try {
Class.forName(classname, false, JDBCEnvironment.class.getClassLoader());
return true;
}
catch (ClassNotFoundException e) {
return false;
}
}
}