Popular Posts
android.intent.action.SCREEN_ON & android.intent.action.SCREEN_OFF First, I've tried create a receiver to receive screen on/off and register receiver on AndroidManifest.xml like below, but unfortunately ... runas RUNAS 使用方法: RUNAS [ [/noprofile | /profile] [/env] [/netonly] ] /user: program RUNAS [ [/noprofile | /profile] [/env] [/netonly] ... Diff Time DateTime from = new DateTime(2011, 1, 7); DateTime to = DateTime.Now; TimeSpan ts = to - from; Console.WriteLine("start time : {0:yyyy...
Stats
Dynamic add classpath path
public void appendClasspath(String path) throws NoSuchMethodException, MalformedURLException, InvocationTargetException, IllegalAccessException {
    Path externalResourcesFolder = Paths.get(path);
    ClassLoader sysLoader = ClassLoader.getSystemClassLoader();
    if (sysLoader instanceof URLClassLoader) {
        Class<URLClassLoader> sysLoaderClass = URLClassLoader.class;

        // Use reflection to invoke the private addURL method
        Method method = sysLoaderClass.getDeclaredMethod("addURL", URL.class);
        method.setAccessible(true);
        method.invoke(sysLoader, externalResourcesFolder.toUri().toURL());

        System.out.printf("classpath: %s loaded%n", path);
    }
}