Currently i want to print a report in dot matrix printer using this: https://blog.jocki.me/simple-escp/
Here is my project directory:
This is my GUI Jframe to testing it
public class Index extends javax.swing.JFrame {
public Index() throws IOException, URISyntaxException {
initComponents();
Template template = new JsonTemplate(Thread.currentThread().
getContextClassLoader().getResource("com/app/tests/template.json").toURI()
);
}
...
}
Let's running it by:
public static void main(String args[]) {
/* Create and display the form */
java.awt.EventQueue.invokeLater(() -> {
try {
new Index().setVisible(true);
} catch (IOException | URISyntaxException ex) {
Logger.getLogger(Index.class.getName()).log(Level.SEVERE, null, ex);
}
});
}
I got error: How to access those template.json ?
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at com.app.views.Index.<init>(Index.java:31)
question from:https://stackoverflow.com/questions/66059527/java-simple-escp-template-not-found