simple problem. Java is pissing me off SO badly. I'm currently using slick2d, and in order for my resources to work from jar, I have to make them so they are read correctly, and not from an absolute path. I used to use, TiledMap k = new TiledMap(locationstringhere) and that works fine in eclipse, but it wont run from jar. So now i'm trying a new thing, where I initialize an input stream by saying InputStream k = ResourceLoader.getResourceFromStream(locationstringhere) and then I load my map up by saying map = new TiledMap(k, tilemaplocationstringhere). This works, but it will NOT find the tilemap location. It keeps saying "can't find data//pave.png//pave.png wtf does that mean? I don't even have it twice like its showing. Code:
InputStream k = ResourceLoader.getResourceAsStream("data//maps//3directionroomleftside(goesalongleftedge).tmx");
mapleftside = new TiledMap(k, "data//maps//pave.png");
So I guess my question is, what is a way I can intialize a TiledMap, that can be ran from a jar. And if my method is correct, how do I get the gosh damned tileset to be found? I've tried so many different things, moving the png EVERYWHERE, its always "new location/pave.png/pave.png" Im going to go insane. Please help.
Java字符串中的文件和文件夹分隔符是/
,而不是//
。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.