0

here is my .java file and the directory which contains the external .jar files.

here is the directory

here is the lib folder

Now,on compilation on terminal(Ubuntu 16.04)

I get this error:-

package uk.co.caprica.vlcj.binding does not exist

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

Run Command java -cp ".:./lib/jna-3.5.2.jar/:lib/platform-3.5.2.jar/:lib/vlcj-3.8.0.jar" main

NR4276
  • 83
  • 8
  • Possible duplicate of [how to include libraries in java without using an IDE](https://stackoverflow.com/questions/5112607/how-to-include-libraries-in-java-without-using-an-ide) – NikNik Jul 05 '17 at 15:11
  • tried this command for compilation (Thanks Nim) javac -cp ".:./lib/*" main.java ,still getting same error on running the class. my directory contains 6 class files ,named main ,main$1,main$2......main$5 – NR4276 Jul 05 '17 at 15:39

1 Answers1

0

If your command is the one you commented in Andres' answer, then your path is wrong. Try:

javac -cp ".:./lib/*" main.java
Kraylog
  • 7,383
  • 1
  • 24
  • 35
  • thanks ,it successfully compiled, on compilation ,I get this ,I get main not found error java -cp ".:./lib/jna-3.5.2.jar/:lib/platform-3.5.2.jar/:lib/vlcj-3.8.0.jar" main – NR4276 Jul 05 '17 at 15:29
  • tried this command for compilation (Thanks Nim) javac -cp ".:./lib/*" main.java ,still getting same error on running the class. my directory contains 6 class files ,named main ,main$1,main$2......main$5 – NR4276 Jul 05 '17 at 15:42
  • Just to understand - Compilation succeeded and when using `java` to run you're having problems? If so, you need the same `-cp` – Kraylog Jul 05 '17 at 15:51
  • The error you're getting is main class not found, right? What is the name of the class in the file `main.java`? – Kraylog Jul 05 '17 at 15:59
  • It's main itself. The file name should match with classname. Don't know why am I still getting that error lol – NR4276 Jul 05 '17 at 19:00
  • Make sure the class is public, and has a valid main method `public static void main(String... args){` – Kraylog Jul 05 '17 at 19:41
  • I know Java lol. Double checked thrice,Nvm ,will go for an IDE. Thanks for yout time Nim! – NR4276 Jul 06 '17 at 18:26