Jar export: external library not working

So I am working on a medium sized project. I have done everything and tested everything and it turned out fine. I then decied to export the project in jar file, turn out there are some problems
I have isolated the problems and concluded that the external library (in extracted form)
Untitled.png
did not work as expected. I then created another project with all the external lib shown here and use a snippet using RXTX lib

JFrame x= new JFrame();
String a= System.getProperty("user.dir");
x.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
x.setVisible(true);
String cwd = System.getProperty("user.dir");
Enumeration portlistEnum = CommPortIdentifier.getPortIdentifiers();
String port = "";
java.util.List<String> serialPorts = new ArrayList<String>();
while (portlistEnum.hasMoreElements())
{
    CommPortIdentifier xxx = (CommPortIdentifier)portlistEnum.nextElement();
    if(xxx.getPortType()==CommPortIdentifier.PORT_SERIAL)
        serialPorts.add(xxx.getName());
}
if(serialPorts.size()!=0)a+=serialPorts.get(0);
x.add(new JLabel(a));

Interesting enough, the label contains nothing. absolutely nothing. Note that I get path followed by 1 (I am using 1 usb port) in Intellij.
What is going on and what can I do to fix it.

1 comment
Comment actions Permalink

It's hard to say what's the problem without having a complete isolated project that will illustrate it.

Did you inspec the final jar file? Does it contain all the classes?

There could be some native dependency that is not loading. Any exceptions?

0

Please sign in to leave a comment.