How can I use JavaPOS to print reciepts with an Epson printer?

17,297
  1. Get the Epson JavaPOS ADK from the Epson website, you'll need to register to download it.
  2. Be sure you have a 32-bit JVM installed
  3. Install the Epson JavaPOS ADK
    • select 32-bit JVM
    • select option that lib files are copied to the jvm's ext folder.
    • create a port for your printer
  4. In the installation folder: Epson/JavaPos/checkHealth can be used to check if your printer is connected correctly.
  5. Run Epson/JavaPos/setupPOS/setupPOS.exe, you will create a jpos.xml file which lets your java programm know which deviced are connected where and should be configured how.
    • Press new
    • Add your devices
    • Save the JPos.xml file
  6. You can test your installation with: http://sourceforge.net/projects/javapospostest2/ select there your newly created jpos.xml
  7. You can specify a specific path to your jpos.xml in Java with: System.setProperty(JposPropertiesConst.JPOS_POPULATOR_FILE_PROP_NAME, System.getenv("jposxml_path")); I used a system-enviroment variable but you can use of course any other way to specify the path.

Now you are ready to go!

Example:

POSPrinterControl113 printer = (jpos.POSPrinterControl113) new POSPrinter();
CashDrawerControl113 drawer = (CashDrawerControl113) new CashDrawer();
try {
        printer.open("POSPrinter");
        printer.claim(100);

        printer.setDeviceEnabled(true);
    } catch (Exception e) {
        System.err.println("Printer deactivated " + e.getMessage());
        printerdisabled = true;
        drawerdisabled  = true;
        return;
    }
    try {
        drawer.open("CashDrawer");
        drawer.claim(100);
        drawer.setDeviceEnabled(true);
    } catch (Exception e) {
        System.out.println("Cashdrawer deactivated: " + e.getMessage());
        drawerdisabled = true;
        return;
    }
Share:
17,297
thi gg
Author by

thi gg

my about-me is currently blank

Updated on June 13, 2022

Comments

  • thi gg
    thi gg almost 2 years

    How can I develop Java Software to print reciepts with an Epson reciept printer?

  • Rocket Garden
    Rocket Garden over 8 years
    This is the clearest simple exposition I've found of the development process for JavaPOS applications, hence my uptick. The snag is that the JavaPOS ADK for Epson seems to no longer be available. I created an account and logged in but no searches are returned. If I browse into the support area of the site and look for my POS printer (TM-2011) I find that there are no Java POS drivers listed. It looks as though Epson has dropped support. Also on the various sites related to javaPOS there seems to have been limited activity, giving the impression that javaPOS is no longer widely used.
  • Rocket Garden
    Rocket Garden over 8 years
    No, we are doing a technology evaluation. If vendors don't publish drivers we might assume they are not interested in promoting that platform. My take on javaPOS is that it has failed to get widespread adoption and has withered as the world has moved on to mobile POS and web service API's therefore this kind of thing is being orphaned by the vendors. If we get some more time I may contact them, but most likely we will choose different platforms/components/vendors.
  • thi gg
    thi gg over 8 years
    Actually I guess that the terrible lack of documentation is the reason that there was no widlespread use of JavaPOS
  • Ale Rojas
    Ale Rojas about 8 years
    @RocketGarden try this one: download.epson-biz.com/modules/pos/…
  • Jaiwo99
    Jaiwo99 almost 8 years
    Hi, why is 32-bit JVM required, doesn't it work with b4-bit JVM? thanks
  • thi gg
    thi gg almost 8 years
    I am honestly not totally sure, but as far as I can remember I had an issue with 64 bit.
  • Cas
    Cas over 7 years
    I can't install it with a 32-bit JVM either. Tried both jdk and jre.. When I install it with the jre it goes a bit further and then I get this error.
  • thi gg
    thi gg over 7 years
    Which version are you installing? Try jdk7
  • Kwesi Aryee
    Kwesi Aryee over 6 years
    Maybe I am too late on this issue, but JavaPos is still supported on epson. It works even with the sample above.