У меня проблема с экспортом java (исполняемый файл JAR), которая может быть связана с моими библиотеками - PullRequest
0 голосов
/ 05 марта 2020

После того, как я добавил класс Payment в свой проект, исполняемый файл JAR больше не запускался. При экспорте показывалось предупреждение «Эта операция перепаковывает указанные библиотеки». Это предупреждение никогда не появлялось раньше.

Я предполагаю, что библиотеки, которые я добавляю в класс оплаты, создают эту проблему, но я не знаю, как ее исправить.

Я использую следующие библиотеки:

  1. comm.jar
  2. ITL_eSSP_lib.jar
  3. ITL_SCS_SPO.jar
  4. RXTXcomm.jar
  5. rxtxSerial.dll

Класс оплаты:

import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;

import ITL_SCS_SPO.BANKNOTE;
import ITL_SCS_SPO.COIN;
import ITL_SCS_SPO.CURRENCY;
import ITL_SCS_SPO.SCS_SETUP;
import ITL_SCS_SPO.SCS_SPO;
import ITL_SCS_SPO.SCS_SPO_event;
import ITL_SCS_SPO.SCS_SPO_event_listener;
import ITL_SCS_SPO.SCS_SPO_update_log;
import ITL_SCS_SPO.SPO_SETUP;
import gnu.io.CommPortIdentifier;

public class Payment implements SCS_SPO_event_listener, SCS_SPO_update_log {

    String comport;

    SCS_SPO scs_spo;
    Thread sysThread;
    SPO_SETUP spoSetup;
    SCS_SETUP scsSetup;
    List<String> listModelSCS;
    List<String> listModelSPO;
    List<String> taSSPLog;
    List<String> taEvents;

    Double lastPayed = 0.0;

    public Payment(String comport) {
        this.comport = comport;
        listModelSCS = new ArrayList<String>();
        listModelSPO = new ArrayList<String>();
        taSSPLog = new ArrayList<String>();
        taEvents = new ArrayList<String>();

        Enumeration<?> portList = CommPortIdentifier.getPortIdentifiers();
        while (portList.hasMoreElements()) {
            CommPortIdentifier portIdTmp = (CommPortIdentifier) portList.nextElement();
            if (portIdTmp.getPortType() == CommPortIdentifier.PORT_SERIAL) {
                System.out.println("availible comport:" + portIdTmp.getName());
            }
        }
    }

    @Override
    public void SCS_SPO_Log_Updated(String log) {
        taSSPLog.add(log);
    }

    public Double getLastPayed() { 
        return lastPayed;
    }

    public void setLastPayed(Double lastPayed) {
        this.lastPayed = lastPayed;
    }

    public List<String> getTaSSPLog() {
        return taSSPLog;
    }

    public void setTaSSPLog(List<String> taSSPLog) {
        this.taSSPLog = taSSPLog;
    }

    public List<String> getTaEvents() {
        return taEvents;
    }

    public void setTaEvents(List<String> taEvents) {
        this.taEvents = taEvents;
    }

    @Override
    public void SCS_SPO_Event_Occurred(SCS_SPO_event ev, CURRENCY currency) {
        System.out.println(ev);
        switch (ev) {
        case ev_COM_PORT_OPEN_FAILED:
            taEvents.add("Can't open COM port\n");
            haltSystem();
            break;
        case ev_SPO_NOT_FOUND:
            taEvents.add("Smart Payout not found\n");
            haltSystem();
            break;
        case ev_SCS_NOT_FOUND:
            taEvents.add("Smart coin system not found\n");
            haltSystem();
            break;
        case ev_SPO_KEY_EXCHANGE_FAILED:
            taEvents.add("Smart payout key exchange failed\n");
            haltSystem();
            break;
        case ev_SCS_KEY_EXCHANGE_FAILED:
            taEvents.add("Smart coin system key exchange failed\n");
            haltSystem();
            break;
        case ev_SYSTEM_INITIALISATION_FAILED:
            taEvents.add("System initialisation failed\n");
            haltSystem();
            break;
        case ev_SYSTEM_INITIALISATION_OK:
            spoSetup = scs_spo.GetSPOSetup();
            scsSetup = scs_spo.GetSCSSetup();
            UpdateDisplay();
            taEvents.add("System initialisation ok\n");
            break;
        case ev_SPO_COMMS_ERROR:
            taEvents.add("Smart payout comms error\n");
            haltSystem();
            break;
        case ev_SCS_COMMS_ERROR:
            taEvents.add("Smart coin system comms error\n");
            haltSystem();
            break;
        case ev_SYSTEM_TERMINATED:
            taEvents.add("Exiting system\n");
            break;
        case ev_NOTE_REJECTED:
            if (currency == null) {
                taEvents.add("Note rejected\n");
            } else {
                taEvents.add("Note rejected " + currency.toString() + "\n");
            }
            break;
        case ev_NOTE_STACKED:
            if (currency == null) {
                taEvents.add("Note stacked\n");
            } else {
                taEvents.add("Note stacked " + currency.toString() + "\n");
            }
            break;
        case ev_NOTE_STACKED_WITH_FRAUD_ATTEMPT:
            if (currency == null) {
                taEvents.add("Note stacked with fraud attempt\n");
            } else {
                taEvents.add("Note stacked with fraud attempt " + currency.toString() + "\n");
            }
            break;
        case ev_NOTE_STORED_IN_PAYOUT:
            if (currency == null) {
                taEvents.add("Note stored in payout\n");
            } else {
                taEvents.add("Note stored in payout " + currency.toString() + "\n");
                lastPayed = lastPayed + currency.value;
            }
            break;
        case ev_NOTE_STORED_IN_PAYOUT_WITH_FRAUD_ATTEMPT:
            if (currency == null) {
                taEvents.add("Note stored in payout with fraud attempt\n");
            } else {
                taEvents.add("Note stored in payout with fraud attempt " + currency.toString() + "\n");
            }
            break;
        case ev_SPO_STACKER_FULL:
            taEvents.add("Smart payout stacker full\n");
            break;
        case ev_SPO_CASHBOX_REMOVED:
            taEvents.add("Smart payout cashbox removed\n");
            break;
        case ev_SPO_CASHBOX_REPLACED:
            taEvents.add("Smart payout cashbox replaced\n");
            break;
        case ev_SPO_SAFE_JAM:
            taEvents.add("Smart payout safe jam\n");
            break;
        case ev_SPO_UNSAFE_JAM:
            taEvents.add("Smart payout unsafe jam\n");
            break;
        case ev_SPO_VALIDATOR_JAM_CLEARED:
            taEvents.add("Smart payout validator jam cleared\n");
            break;
        case ev_SYSTEM_VALUES_UPDATED:
            UpdateDisplay();
            break;
        case ev_COIN_VALUE_ACCEPTED:
            taEvents.add("Coin value accepted " + currency.toString() + "\n");
            lastPayed = lastPayed + currency.value;
            break;
        case ev_DISPENSING:
            taEvents.add("Dispensing " + currency.toString() + "\n");
            break;
        case ev_DISPENSED:
            taEvents.add("Dispensed " + currency.toString() + "\n");
            break;
        case ev_DISPENSE_RESPONSE_OK:
            taEvents.add("Dispense response - OK\n");
            break;
        case ev_DISPENSE_RESPONSE_SYSTEM_BUSY:
            taEvents.add("Dispense response - system busy\n");
            break;
        case ev_DISPENSE_RESPONSE_NOT_ENOUGH_MONEY_FOR_PAYOUT:
            taEvents.add("Dispense response - not enough money for payout\n");
            break;
        case ev_DISPENSE_RESPONSE_CANNOT_PAY_EXACT_AMOUNT:
            taEvents.add("Dispense response - can't pay exact amount\n");
            break;
        case ev_SPO_PAYOUT_JAMMED:
            taEvents.add("Smart Payout jammed during payout\n");
            break;
        case ev_SPO_PAYOUT_HALTED:
            taEvents.add("Smart Payout halted during payout\n");
            break;
        case ev_SPO_PAYOUT_TIMEOUT:
            taEvents.add("Smart Payout timed out during payout\n");
            break;
        case ev_SCS_PAYOUT_JAMMED:
            taEvents.add("Smart Coin System jammed during payout\n");
            break;
        case ev_SCS_PAYOUT_HALTED:
            taEvents.add("Smart Coin System halted during payout\n");
            break;
        case ev_SCS_PAYOUT_TIMEOUT:
            taEvents.add("Smart Coin System timed out during payout\n");
            break;
        case ev_SCS_PAYOUT_FRAUD_ATTEMPT:
            taEvents.add("Smart Coin System fraud attempt occurred during payout\n");
            break;
        }
    }

    public void UpdateDisplay() {
        UpdateSCSDisplay();
        UpdateSPODisplay();
    }

    public void UpdateSCSDisplay() {
        listModelSCS.clear();
        for (COIN coin : scsSetup.coins) {
            String strCoin = coin.currency.toString();
            String strStored = "" + coin.stored;
            String strInhibited = "" + coin.inhibited;
            String strRoute;

            if (coin.routeToPayout) {
                strRoute = "payout";
            } else {
                strRoute = "cashbox";
            }

            listModelSCS.add(strCoin);
            listModelSCS.add(strStored);
            listModelSCS.add(strInhibited);
            listModelSCS.add(strRoute);
        }

    }

    public void UpdateSPODisplay() {
        listModelSPO.clear();
        for (BANKNOTE note : spoSetup.notes) {
            String strNote = note.currency.toString();
            String strStored = "" + note.stored;
            String strInhibited = "" + note.inhibited;
            String strRoute;

            if (note.routeToPayout) {
                strRoute = "payout";
            } else {
                strRoute = "cashbox";
            }

            listModelSPO.add(strNote);
            listModelSPO.add(strStored);
            listModelSPO.add(strInhibited);
            listModelSPO.add(strRoute);
        }

    }

    public void start() {
        scs_spo = new SCS_SPO(comport, this);
        scs_spo.setSSPLogListener(this);
        sysThread = new Thread(scs_spo);
        sysThread.start();
        listModelSPO.clear();
        listModelSCS.clear();
    }

    public void Halt() {
        haltSystem();
    }

    public void EnableSPO() {
        scs_spo.EnableNoteValidator();

    }

    public void DisableSPO() {
        scs_spo.DisableNoteValidator();

    }

    public void EnableSCS() {
        scs_spo.EnableCoinValidator();

    }

    public void DisableSCS() {
        scs_spo.DisableCoinValidator();
    }

    public void Payout(String amount) {
        CURRENCY currency = new CURRENCY();

        currency.value = Double.parseDouble(amount);
        currency.countryCode = "EUR";
        scs_spo.PayoutValue(currency);
    }

    private void haltSystem() {
        if (scs_spo != null && sysThread != null && sysThread.isAlive()) {
            scs_spo.haltSystem();
        }

    }

}

Изображение с предупреждением об экспорте

...