Skip to content

Instantly share code, notes, and snippets.

@nroduit
Last active May 27, 2020
Embed
What would you like to do?
Test case for showing issue of diacritic characters
Add FooClient.java into src/main/java/org/test
Add module-info.java src/main/java
Add pom.xml in root folder
1) from root folder: $ mvn clean package
2) copy target/app.jar into root folder
3) change value of "-p": jdk-14.0.1\bin>$ jpackage --type app-image -n app -p "path of root folder" -m app/org.test.FooClient
4) $ cd app
5) $ app.exe testé testç testà
package org.test;
import java.awt.BorderLayout;
import javax.swing.*;
public class FooClient {
public static void main(String[] args) {
javax.swing.SwingUtilities.invokeLater(() -> {
JFrame frame = new JFrame("Test non ascii chars through args");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel panel = new JPanel();
BoxLayout boxLayout = new BoxLayout(panel, BoxLayout.Y_AXIS);
panel.setLayout(boxLayout);
for (int i = 0; i < args.length; i++) {
JLabel jLabel = new JLabel(args[i]);
panel.add(jLabel);
}
frame.getContentPane().add(panel, BorderLayout.CENTER);
frame.pack();
frame.toFront();
frame.setVisible(true);
});
}
}
module app {
requires java.desktop;
}
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.test</groupId>
<artifactId>app</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<release>14</release>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<archive>
<manifestEntries>
<Main-Class>org.test.FooClient</Main-Class>
</manifestEntries>
</archive>
<finalName>app</finalName>
</configuration>
</plugin>
</plugins>
</build>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment