I am developing a chat application in J2SE that can also send emoticons to another user.
The application uses https://github.com/vdurmont/emoji-java (Vdurmont Emoji-java-2.1 jar),
I followed everything that was described in this link: everything works fine during the development environment, but when I do jar for the same thing , when I send emoticons to another user on the Internet, it shows the code (ðŸ ~ ¡and?) .
Firstly, I think that the problem with downloading files from a folder was used by ClassLoader in such a way to get the correct image, but is it displayed during jar creation? (question mark). So I deleted this code to understand you better.
The code is written below:
public ChatUI() { initComponents(); this.setLayout(new WrapLayout(FlowLayout.LEFT, 5, 5)); for (int i = 0; i < imageHexaCode.length; i++) { final javax.swing.JLabel imogis = new javax.swing.JLabel("&#x" + imageHexaCode[i] + ";"); imogis.setCursor(new Cursor(Cursor.HAND_CURSOR)); imogis.setIcon(new javax.swing.ImageIcon(getClass().getResource("emoji_" + imageHexaCode[i] + ".png"))); imogis.setHorizontalTextPosition(JLabel.CENTER); imogis.setVerticalTextPosition(JLabel.BOTTOM); imogis.setFont(new Font(null, Font.PLAIN, 1)); imogis.setForeground(Color.white); final int aa = i; imogis.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { JLabel jl = new JLabel("&#x" + imageHexaCode[aa] + ";"); jl.setName("&#x" + imageHexaCode[aa] + ";"); jl.setFont(new Font(null, Font.PLAIN, 1)); jl.setHorizontalTextPosition(JLabel.CENTER); jl.setVerticalTextPosition(JLabel.BOTTOM); jl.setIcon(new javax.swing.ImageIcon(getClass().getResource("emoji_" + imageHexaCode[aa] + ".png"))); jl.setForeground(Color.white); ChatPaneWrite.jtp.insertComponent(jl); System.out.println("" + imogis.getText());
Where imageHexaCode is an array of strings of icons.
static String[] imageHexaCode = { "1f621", "1f608", "2764", "1f494" };
& jtp is a JTextPane, where we insert the component of emotions when clicking on the shortcut
ChatPaneWrite.jtp.insertComponent(jl);
Emoticons are stored in the same package where I write, why I did not use ClassLoader in the line
jl.setIcon(new javax.swing.ImageIcon(getClass().getResource("emoji_" + imageHexaCode[aa] + ".png")));
or he can also write as for ChatUI package
jl.setIcon(new javax.swing.ImageIcon(getClass().ClassLoader.getResource("ChatUI/emoji_" + imageHexaCode[aa] + ".png")));
here are the pictures:
The bank at the end of the reception shows that emoticons like this

Please help me sort it out.
Very grateful to everyone in advance