Export to JAR with external JavaPOS Files

466 views Asked by At

I've currently finished my project, but can't get it to work when it is exported. I use JAXB to read and write XML Files and also have dependencies on other external Folders, which are needed to use a POS-Printer.

I've managed to link my external XML Save-Files with absolute paths, but not with relative paths. So that worked, although not the way i wanted. Yet, using the external class folder for the printer didn't work at all.

This means, that in my Eclipse Project Build Path i've added a class folder, which contains all of these needed files (which are not only jars, so adding them one by one wouldnt work). So exporting my project to a jar either includes all the files into the jar itself, or doesnt include them at all. Everything works perfectly in Eclipse, but not when i export it.

My folder structure looks like this:

src
   /model
   /view
   /control
data
   /articles.xml
   /...
JavaPOS  <--- needed folder with all its files
   /jpos.xml
   /xerxers.jar
   /swt-..-.dll

I've tried:

  • InputStreams is = getClass().getResourceAsStream(url);

  • absolute paths

  • manipulating the manifest file and/or jar structure

  • runnable and non runnable jars with nearly every combination of options

  • putting the files inside the library "by hand"

  • changing the build path of the project

My Question is:

How do i get my jar-file to know where these files are?

EDIT:

Do you think Maven or an Ant file could solve my problems? I don't have any experience with those.

1

There are 1 answers

0
Musti On BEST ANSWER

The Problem was, that i had more than one JRE installed and that the one eclipse was using, had all the dll files, but the other ones didnt have it. So i had to add them manually, because reinstalling the drivers of the printer didnt change anything. Gotta fix that somehow, but right now it works and that is all i wanted.

Turns out i didn't even need that Folder, just needed one file out of it and the missing dlls.