我的代码中的错误问题:loadLibrary cannot find symbol

Error problem in my code: loadLibrary cannot find symbol

package mediaplayervlcj;

import com.sun.jna.NativeLibrary;
import java.awt.BorderLayout;
import java.awt.Canvas;
import java.awt.Color;
import java.lang.annotation.Native;
import javax.swing.JFrame;
import javax.swing.JPanel;
import uk.co.caprica.vlcj.binding.LibVlc;
import uk.co.caprica.vlcj.player.MediaPlayerFactory;
import uk.co.caprica.vlcj.player.embedded.EmbeddedMediaPlayer;
import uk.co.caprica.vlcj.player.embedded.windows.Win32FullScreenStrategy;
import uk.co.caprica.vlcj.runtime.RuntimeUtil;

public class MediaPlayerVlcj {

    public static void main(String[] args) {
        JFrame f = new JFrame();
        f.setLocation(100, 100);
        f.setSize(100, 600);
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        f.setVisible(true);

        Canvas c = new Canvas();

        c.setBackground(Color.black);
        JPanel p = new JPanel();
        p.setLayout(new BorderLayout());
        p.add(c);
        f.add(p);  

        NativeLibrary.addSearchPath(RuntimeUtil.getLibVlcLibraryName(), "C:\Program Files(x86)\VideoLAN\VLC");
        Native.loadLibrary(RuntimeUtil.getLibVlcLibraryName(), LibVlc.class);
        MediaPlayerFactory mpf = new MediaPlayerFactory();

        EmbeddedMediaPlayer emp = mpf.newEmbeddedMediaPlayer(new Win32FullScreenStrategy(f));
        emp.setVideoSurface(mpf.newVideoSurface(c));

        emp.toggleFullScreen();
        emp.setEnableMouseInputHandling(false);
        emp.setEnableKeyInputHandling(false);

        String file = "loltrailer.mp4";
        emp.prepareMedia(file);
        emp.play();
    }
}

我遇到了这个错误:

Exception in thread "main" java.lang.RuntimeException: Uncompilable source 
code - Erroneous sym type: java.lang.annotation.Native.loadLibrary at mediaplayervlcj.MediaPlayerVlcj.main(MediaPlayerVlcj.java:47)

我的 loadLibrary 有问题,它说找不到符号...

你输入错了Nativeclass.

    import java.lang.annotation.Native;

应该是

    import com.sun.jna.Native;

寓意:使用 IDE 建议的更正/补全时要小心。它们并不总是正确的。