I'm trying to load a LibGDX jar file from a separate main jar I have. For prints I have in the GDX project I can tell it's getting there but Assets aren't being linked for some reason because when the program gets to a asset loading in claims it wasn't found.
This is pretty much what I do:
String jar = "game.jar";
JarFile jarFile = new JarFile(jar);
Enumeration e = jarFile.entries();
URLClassLoader child = new URLClassLoader (new URL[]{new File(jar).toURI().toURL()});
Thread.currentThread().setContextClassLoader(child);
Class classToLoad = Thread.currentThread().getContextClassLoader().loadClass("com.mygame.DesktopLauncher");
Method method = classToLoad.getDeclaredMethod ("launch",URLClassLoader.class);
Object instance = classToLoad.newInstance ();
Object result = method.invoke (instance,(Object) child);
And this is the exception I get:
com.badlogic.gdx.utils.GdxRuntimeException: File not found: kodable.props (Internal)
at com.badlogic.gdx.files.FileHandle.read(FileHandle.java:136)
at com.badlogic.gdx.files.FileHandle.length(FileHandle.java:602)
at com.badlogic.gdx.files.FileHandle.estimateLength(FileHandle.java:233)
at com.badlogic.gdx.files.FileHandle.readString(FileHandle.java:198)
at com.badlogic.gdx.files.FileHandle.readString(FileHandle.java:191)
at com.surfscore.kodable.KGame.create(KGame.java:52)
at com.surfscore.kodable.Main.create(Main.java:26)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:143)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:120)
In KGame I have a print in the beginning and it does print that.
Thanks!
Aucun commentaire:
Enregistrer un commentaire