| 5 |
|
import java.io.FileNotFoundException; |
| 6 |
|
import java.io.IOException; |
| 7 |
|
import java.io.PrintStream; |
| 8 |
+ |
import java.lang.reflect.InvocationTargetException; |
| 9 |
+ |
import java.lang.reflect.Method; |
| 10 |
+ |
import java.net.MalformedURLException; |
| 11 |
|
import java.net.URL; |
| 12 |
+ |
import java.net.URLClassLoader; |
| 13 |
|
import java.util.ResourceBundle; |
| 14 |
|
|
| 15 |
|
import javax.imageio.ImageIO; |
| 39 |
|
*/ |
| 40 |
|
public class AEInstaller2 { |
| 41 |
|
|
| 42 |
< |
private static ResourceBundle imagesBundle = ResourceBundle |
| 43 |
< |
.getBundle("net.oni2.aeinstaller.Images"); |
| 44 |
< |
private static ResourceBundle basicBundle = ResourceBundle |
| 41 |
< |
.getBundle("net.oni2.aeinstaller.AEInstaller"); |
| 42 |
< |
private static ResourceBundle globalBundle = ResourceBundle |
| 43 |
< |
.getBundle("net.oni2.aeinstaller.localization.Global"); |
| 42 |
> |
private static ResourceBundle imagesBundle; |
| 43 |
> |
private static ResourceBundle basicBundle; |
| 44 |
> |
private static ResourceBundle globalBundle; |
| 45 |
|
|
| 46 |
|
private static Application app = null; |
| 47 |
|
|
| 61 |
|
} |
| 62 |
|
} |
| 63 |
|
|
| 64 |
+ |
private static void addClassPath(File dir) { |
| 65 |
+ |
try { |
| 66 |
+ |
URL u = dir.toURI().toURL(); |
| 67 |
+ |
URLClassLoader urlClassLoader = (URLClassLoader) ClassLoader |
| 68 |
+ |
.getSystemClassLoader(); |
| 69 |
+ |
Class<URLClassLoader> urlClass = URLClassLoader.class; |
| 70 |
+ |
Method method = urlClass.getDeclaredMethod("addURL", |
| 71 |
+ |
new Class[] { URL.class }); |
| 72 |
+ |
method.setAccessible(true); |
| 73 |
+ |
method.invoke(urlClassLoader, new Object[] { u }); |
| 74 |
+ |
} catch (MalformedURLException e) { |
| 75 |
+ |
} catch (SecurityException e) { |
| 76 |
+ |
} catch (NoSuchMethodException e) { |
| 77 |
+ |
} catch (IllegalArgumentException e) { |
| 78 |
+ |
} catch (IllegalAccessException e) { |
| 79 |
+ |
} catch (InvocationTargetException e) { |
| 80 |
+ |
} |
| 81 |
+ |
} |
| 82 |
+ |
|
| 83 |
|
/** |
| 84 |
|
* @param args |
| 85 |
|
* Command line arguments |
| 115 |
|
Settings.setDebug(debug); |
| 116 |
|
Settings.getInstance().setNoCacheUpdateMode(noCacheUpdate); |
| 117 |
|
|
| 118 |
+ |
File localesDir = new File(Paths.getInstallerPath(), "locales"); |
| 119 |
+ |
if (localesDir.isDirectory()) |
| 120 |
+ |
addClassPath(localesDir); |
| 121 |
+ |
imagesBundle = ResourceBundle.getBundle("net.oni2.aeinstaller.Images"); |
| 122 |
+ |
basicBundle = ResourceBundle |
| 123 |
+ |
.getBundle("net.oni2.aeinstaller.AEInstaller"); |
| 124 |
+ |
globalBundle = ResourceBundle |
| 125 |
+ |
.getBundle("net.oni2.aeinstaller.localization.Global"); |
| 126 |
+ |
|
| 127 |
|
SwingJavaBuilder.getConfig().addResourceBundle(imagesBundle); |
| 128 |
|
SwingJavaBuilder.getConfig().addResourceBundle(basicBundle); |
| 129 |
|
SwingJavaBuilder.getConfig().addResourceBundle(globalBundle); |