简体   繁体   English

导入Java外部库时出错

[英]Error on importing a java external library

here is my .java file and the directory which contains the external .jar files. 这是我的.java文件和包含外部.jar文件的目录。

这是目录

这是lib文件夹

Now,on compilation on terminal(Ubuntu 16.04) 现在,在终端上进行编译(Ubuntu 16.04)

I get this error:- 我收到此错误:

package uk.co.caprica.vlcj.binding does not exist 软件包uk.co.caprica.vlcj.binding不存在

here are my two import statements 这是我的两个进口声明

import uk.co.caprica.vlcj.binding.LibVlc;
import uk.co.caprica.vlcj.runtime.RuntimeUtil;

I tried entering the folder name(full path) on my import statement ,but is still doesn't work. 我尝试在导入语句中输入文件夹名称(完整路径),但仍然无法正常工作。

I successfully compiled ,buit when I try to run the file I get main class not found error. 我成功地编译了文件,但是当我尝试运行文件时却找不到主类错误。

Compile command javac -cp ".:./lib/jna-3.5.2.jar/:lib/platform-3.5.2.jar/:lib/vlcj-3.8.0.jar" main.java 编译命令javac -cp“ ... / lib / jna-3.5.2.jar /:lib / platform-3.5.2.jar /:lib / vlcj-3.8.0.jar” main.java

Run Command java -cp ".:./lib/jna-3.5.2.jar/:lib/platform-3.5.2.jar/:lib/vlcj-3.8.0.jar" main 运行命令java -cp“。:./ lib / jna-3.5.2.jar /:lib / platform-3.5.2.jar /:lib / vlcj-3.8.0.jar” main

If your command is the one you commented in Andres' answer, then your path is wrong. 如果您的命令是您在Andres的答案中注释的命令,那么您的路径是错误的。 Try: 尝试:

javac -cp ".:./lib/*" main.java

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM