[LWJGL] Game not running when used in JarSplice

Is the res supposed to be a source folder in the src/ folder? If so I can’t put it in :

Or do I make a regular folder inside of the src/:

The second picture is the one I said.

We would cut you some slack but frankly people get quite annoyed when people ask questions before trying to find a solution themselves.

Also it seems most of the advice given to you is completely ignored.

Such as learn a little more Java, in this situation running from the command line is the first thing you should have done (also one of the first things taught in any book worth a salt) , not made another forum post.

Okay, After that do I just add that file on my desktop as a jar?:

Then get natives from where I downloaded it?:

btw this is exactly like my first experience with jarSplice, which is why it sucks imo.
you should never have to pack resources in the source folder, or pack everything into a fat jar
some of you might prefer that but I think its ugly as hell.
in the end I wanna have one exe that is like 100 kb and an assets folder or pack

so yeah jarsplice is very picky about the resources and stuff.

I havent tried packr. I do own JET which worked fine. Usually I just pack it myself with an nullsoft installer an use batch-to-exe to run.

Can’t this be done manually?

First off, *you’re

Second, do you have anything constructive to add to the conversation, or are you just going to insult OP for not knowing how to do something? Guess what, people don’t know exactly the same things as you just because you’ve learned them before.

OP, what do you mean by manually? Packing the Jar? Yes, but JarSplice isn’t the issue here. The issue is how you are loading your resources. Java is (for lack of a better term) picky about how you load resources in, in different situations. Blaming JarSplice for Java’s confusing IO library is not going to get you a solution.

Maybe there should be some tutorials on resource loading.

http://www.thinkplexx.com/learn/howto/java/system/java-resource-loading-explained-absolute-and-relative-names-difference-between-classloader-and-class-resource-loading

This is how I did it with Java2D. Right now the

img  = this.getClass().getResource("foo.txt");

gives an error. I’ll try to rephrase the question, How do I load textures from the Slick_util.jar into a fat jar. I watched videos on how and I can easily get the libraries and jars, it’s just I don’t have the textures when I run it. I put the res/ folder in the src/ folder now. The textures don’t load still ofcourse.

Either use

img  = this.getClass().getClassLoader().getResourceAsStream("res/foo.txt");

or

img  = this.getClass().getResourceAsStream("/res/foo.txt");

Notice the “/” if you don’t use getClassLoader(). Also, the AsStream part is necessary.

I forgot the code to create Images and load them. I deleted the code I used to remember, but can’t I just do this with the textures?

wooda = TextureLoader.getTexture("PNG", new FileInputStream(new File("res/Baddy.png")));

This works except for when I eport the jar in Jarsplice. That is what I learned but someone suggested this which ddn’t work:

wood = TextureLoader.getTexture("PNG", MainFS.class.getClassLoader().getResourceAsStream("res/FlubberFlap.png"));

error:

Exception in thread "main" java.lang.NullPointerException
	at org.newdawn.slick.opengl.TextureLoader.getTexture(TextureLoader.java:64)
	at org.newdawn.slick.opengl.TextureLoader.getTexture(TextureLoader.java:24)
	at FSMain.MainFS.main(MainFS.java:67)

Instead of slick_util, should I just use the normal image rendering somehow ??? I have no idea what other way to draw and load them .

Can I have your screenshot of the package tree? Expand it completely and send us a screenshot.

This is the whole Project. FSMain is the package I’m working with. MainFS is the main class.:

This is how I loaded textures

based on https://www.youtube.com/watch?v=naE3nbreSUo :point:

I’ll message you the full cource code for the main class if you want. It’s not too long, It’s just the drawing methods that take up space.

I have somewhat of the same problem too. You should just continue your work and figure it out some other time.

For the last time, [icode]new File(…)[/icode] Will. Not. Work. Why? Because those “files” you want to load are zip entries when you export to jar (jar files are actually zip files), not files.

I remember that. Should I start off with

File img = new File("/res/ImageThingy.png");

then

wood = TextureLoader.getTexture("png", new FileInputStream(img));

The

res/

is a source folder.

If I’m unclear still, this is exactly what I’m doing.At the very end my results are a blank window for about a second. Please tell me what Im doing wrong, I really need to understand:
Video of what I did: http://www.mediafire.com/watch/oohf1qnh2oefkxp/exportsfail.mp4

Never use Files when packing them inside the JAR file. You have to do this.


InputStream stream = this.getClass().getClassLoader().getResourceAsStream("res/ImageThingy.png");

Then


wood = TextureLoader.getTexture("png", stream);

The [icode]res/[/icode] can be either source folder or a package, anything will work.

Great, I understand this. Could you give an example of how to use it, I keep getting a static error.

What error are you getting? Post the stackstrace.