Search code examples
javajavafxtableview

The language of the day is changed when executing the program in my .exe javafx


My program runs everything correctly within the IDE with the language I chose, but when installing the program and running it on the computer, the language of the days changes to English, all this within the column

The method to change the format of the column is: `

public void Formato_fecha_y_hora(){
    Locale locale = new Locale("es", "ES");
    DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd/MM/yyyy E").withLocale(locale);
    Col_FEentrega.setCellFactory(tc -> new TableCell<>() {
        @Override
        protected void updateItem(LocalDate date, boolean empty) {
            super.updateItem(date, empty);
            if (empty) {
                setText(null);
            } else {
                setText(formatter.format(date));
            }
        }
    });

    DateTimeFormatter formato_hora = DateTimeFormatter.ofPattern("h:mm a");
    Col_Hora_entrega.setCellFactory(tc -> new TableCell<>() {
        @Override
        protected void updateItem(LocalTime Time, boolean empty) {
            super.updateItem(Time, empty);
            if (empty) {
                setText(null);
            } else {
                setText(formato_hora.format(Time));
            }
        }
    });
}

To make the installer use the following jpackage:

jpackage --type exe --input . --dest . --main-jar .\Dulceria.jar --main-class com.example.dulceria.HelloApplication --module-path "D:\Program Files\Java\javafx-jmods-18" --add-modules javafx.controls,javafx.fxml,java.sql,java.sql.rowset --win-shortcut --win-menu

I get the following form in the .exe

I want the names of the days to look like this


Solution

  • The answer was provided to me in the comments, as mentioned by mr mcwolf I needed to add the jdk.localedata module in the image