Skip to content

JavaSerial lib can't be used in Eclipse equinox OSGi plug-in #11

@trigchen

Description

@trigchen
  1. Create a simple Eclipse 3.x RCP application with the wizard of new plug-in project. Name it as app plugin.
  2. Run app plugin and make sure the simple view defined in the plug-in appear.
  3. Create a plug-in project with the wizard of "Plug-in from existing JAR archives", choose JavaSerial-0.7.jar as external JAR. Name this plug-in as JavaSerial-3rd-lib.
  4. Turn to app plugin, open plugin.xml file and add JavaSerial-3rd-lib plugin as required plug-ins.
  5. Open the View.java file in app plugin, replace the return statement of createInitialDataModel() method with: return Arrays.asList(SerialPort.getSerialPorts());
  6. In the Run configurations -> plug-ins tab, check JavaSerial-3rd-lib plug-in, run it.
  7. Errors occured:

org.eclipse.e4.core.di.InjectionException: java.lang.NoClassDefFoundError: com/rm5248/serial/SerialPort
Caused by: java.lang.NoClassDefFoundError: com/rm5248/serial/SerialPort
at javaserialportosgitest.View.createInitialDataModel(View.java:70)
at javaserialportosgitest.View.createPartControl(View.java:57)

  1. create another plug-in project with the wizard of "Plug-in from existing JAR archives", choose jssc-2.8.0.jar (https://github.com/scream3r/java-simple-serial-connector) as external JAR. Name this plug-in as jssc-3rd-lib.
  2. Add jssc-3rd-lib plugin to the required plugins of app plugin project.
  3. Open the View.java file in app plugin, replace the return statement of createInitialDataModel() method with: return Arrays.asList(SerialPortList.getPortNames());
  4. In the Run configurations -> plug-ins tab, checkjssc-3rd-lib plug-in, run it. The available serial ports list in the view and no error occured.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions