How can I create .exe
with modifiable .txt
dependencies (sources, dictionaries) from JavaFX program? I want to modify dependency's content in the future.
I tried Launch4J, but I dont find any options which help me to make .exe
with modifiable .txt
dependencies. Anyone can make it in Launch4J or in other technology?
Simple examples:
TestApplication:
public class TestApplication extends Application {
@Override
public void start(Stage stage) throws Exception {
Parent root = FXMLLoader.load(getClass().getResource("/test.fxml"));
stage.setTitle("Test");
stage.setScene(new Scene(root));
stage.show();
}
}
TestController:
public class TestController {
@FXML
public Button text1Button;
@FXML
public Button text2Button;
@FXML
public TextArea textArea;
public void printText1(ActionEvent actionEvent) {
List<String> lines=readFromFile("src/main/resources/text1");
StringBuilder sb = new StringBuilder();
lines.forEach(l->sb.append(l).append("\n"));
textArea.setText(sb.toString());
}
public void printText2(ActionEvent actionEvent) {
List<String> lines=readFromFile("src/main/resources/text2");
StringBuilder sb = new StringBuilder();
lines.forEach(l->sb.append(l).append("\n"));
textArea.setText(sb.toString());
}
private List<String> readFromFile(String filePath){
List<String> lines = new ArrayList<>();
try{
lines=Files.readAllLines(Paths.get(filePath));
}
catch (IOException ioe){
ioe.printStackTrace();
}
return lines;
}
}
test.fxml:
<AnchorPane prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/16" xmlns:fx="http://javafx.com/fxml/1" fx:controller="org.example.TestController">
<children>
<Button fx:id="text1Button" layoutX="180.0" layoutY="43.0" mnemonicParsing="false" onAction="#printText1" text="Text1" />
<Button fx:id="text2Button" layoutX="374.0" layoutY="43.0" mnemonicParsing="false" onAction="#printText2" text="Text2" />
<TextArea fx:id="textArea" layoutX="114.0" layoutY="112.0" prefHeight="200.0" prefWidth="371.0" />
</children>
</AnchorPane>