TileManager.class.getResourceAsStream("maps/Level_0.json")
works fine if I compile everything, but when I put it in a jar, it returned
Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: com/fasterxml/jackson/databind/JsonDeserializer
My code for loading the JSON file is:
String src = "/maps/Level_0.json";
// default StandardCharsets.UTF_8
InputStream is = TileManager.class.getResourceAsStream(src);
assert is != null;
content = new BufferedReader(new InputStreamReader(is))
.lines().collect(Collectors.joining("\n"));
System.out.println(content);
data = Converter.fromJsonString(content);
The location of Level_0.json
is src/res/maps/Level_0.json
and res
is a source folder.
[x] I have imported all the libraries into the jar file.