Thanks,
Basically I am trying to setup the serial port ready for input/output. Here’s my code
CommPortIdentifier portId = null;
try{
Enumeration portEnum = CommPortIdentifier.getPortIdentifiers();
while(portEnum.hasMoreElements()){
CommPortIdentifier currPortId = (CommPortIdentifier) portEnum.nextElement();
if(currPortId.getName().equals(portName)){
portId = currPortId; break;
}
}
} catch (Exception e){
JOptionPane.showMessageDialog(null, e.getMessage());
}
All the libraries are within the project and native libraries are linked. It will compile in command prompt but returns the following error:
Exception in thread "main" java.lang.NoClassDefFoundError: SerialCommunications
(wrong name: GreenhousePackage/SerialCommunications)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$000(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
Could not find the main class: SerialCommunications. Program will exit.