0

I want to export runnable JAR file of an application that creates new files into resource folder and using them to compute other operation.

I included resource folder in build path and I exported runnable JAR, but when I run this JAR and click on a button that creates those files it does nothing, while it must show something.

I think the problem is the fact of creating the files.

Here is the button listener:

package control;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.SQLException;

import gui.FuzzyGUI;
import model.GetValues;

public class RunBtnListener implements ActionListener {

    FuzzyGUI menu;
    String logs[];
    String CSVpathname;
    String XESpathname;

    public void actionPerformed(ActionEvent e) {

        // Drop previous temp log
        GetValues.dropTempLog();

        // Recover log table names from splitting
        if(!SplitListener.tableName.equals("none")) {

            logs = GetValues.getLogsNames(SplitListener.tableName, 1);  // 1 - Split

        } else {    // recover (single) log table name from filtering

            logs = GetValues.getLogsNames(FilterListener.tableName, 0); // 0 - Filter

        }

        try {       
            for(int i = 0; i < logs.length; i++) {

                CSVpathname = "res/log" + i + ".csv";
                XESpathname = "res/log" + i + ".xes";

                GetValues.exportToCSV(logs[i], CSVpathname);
                GetValues.convertToXES(CSVpathname, XESpathname);

                menu = new FuzzyGUI(XESpathname);

            }

        } catch (SQLException e1) {
            e1.printStackTrace();
        }

    }

}

When I run on Eclipse it works, but when I export in runnable JAR it doesn't work.

jumpy
  • 73
  • 7
  • Possible duplicate of [Runnable jar exported with eclipse isn't working, in eclipse it still works](https://stackoverflow.com/questions/33331397/runnable-jar-exported-with-eclipse-isnt-working-in-eclipse-it-still-works) – Kavitha Karunakaran Aug 09 '19 at 07:30
  • 1
    Objects in a Jar are not files and you can't use file APIs to access them. You can't easily update a Jar so you will have to put the new files somewhere else. – greg-449 Aug 09 '19 at 08:36

0 Answers0