0

My code run, compiler is printing this error

    Exception in thread "main" java.lang.NoClassDefFoundError: uk/co/caprica/vlcj/player/component/EmbeddedMediaPlayerComponent
    at main.test.main(test.java:10)
Caused by: java.lang.ClassNotFoundException: uk.co.caprica.vlcj.player.component.EmbeddedMediaPlayerComponent
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
    ... 1 more

My Code is very simple

package main;

import uk.co.caprica.vlcj.player.component.EmbeddedMediaPlayerComponent;

public class test 
{
    public static void main(String[] args)
    {
        System.out.print("Test run\n");
        EmbeddedMediaPlayerComponent player = new EmbeddedMediaPlayerComponent();
    }

}

Project Lib is

  1. JNA-5.2.0.jar
  2. JNA-Platform-5.2.0.jar
  3. vlcj-4.7.1.jar
  4. vlcj-natives-4.1.0.jar

I don't know why occur this problem.

  • How are you running your code? Are you running it via Maven or Gradle? Are you running it from Eclipse? – Abra Dec 02 '21 at 05:10
  • Thx ask my Question! i running now eclipse 2021-09 Build! –  Dec 02 '21 at 05:22
  • Make sure that all the JAR files are included in your _Runtime configuration_. – Abra Dec 02 '21 at 05:38
  • I Checked My Project>Properties>JAVA Build Path>Order and Export to jar files, JRE System Library. It is All Checked. –  Dec 02 '21 at 06:03
  • NOT _Build Path_ (in _Project properties_). Check the **Runtime configuration**. – Abra Dec 02 '21 at 06:09
  • Thx Abra! i think can solv this! –  Dec 02 '21 at 07:00
  • Note ... it is **not** the compiler printing that. What you showed us is an exception stacktrace. It happens when you **run** the code. – Stephen C Jan 12 '22 at 07:09

1 Answers1

-1

It's saying that the class EmbeddedMediaPlayerComponent is not found. Did you define the class?

John Doe
  • 2,225
  • 6
  • 16
  • 44
  • 1
    `NoClassDefFoundError` means that the class was defined when the java code referencing it was compiled but the class was not found when the compiled java code was run. Also obvious that the missing class is not one that the OP wrote but rather in one of the JAR files listed in the question. – Abra Dec 02 '21 at 05:42