Fazecast / jSerialComm

Platform-independent serial port access for Java
GNU Lesser General Public License v3.0
1.35k stars 287 forks source link

java.lang.NoClassDefFoundError: Issues #322

Closed WarHammer71 closed 4 years ago

WarHammer71 commented 4 years ago

New to Java and IntelliJ IDEA.

I'm working on a simple R&D serial project.

I'm trying to include a jar (jSerialComm-2.6.2.jar) file with my artifacts. When I run locally obviously it works. However, when I run from the artifact I get, "java.lang.NoClassDefFoundError: com/fazecast/jSerialComm/SerialPort".

I have looked at just about every post out there and I still do not understand what I'm doing wrong. Can someone please enlighten me?

breiler commented 4 years ago

How are you including the library, are you adding it manually to the IntelliJ project or are you using some sort of build system such as Maven or Gradle?

WarHammer71 commented 4 years ago

I'm currently adding it manually via project settings, modules and libraries.

WarHammer71 commented 4 years ago

I seem to have fixed my issue.

I created a libs directory. Moved my jar external jar file there than referenced it from there.

That also created the dependency under modules.

However, I also added my jar file to SDKx Classpath and my problem was solved.

I'm not sure if that was the correct way, however it got the job done locally and on the Pi Target.