Reputation: 339
I have a structure code like this :
I want to run my program using mcd using javac, like this : javac ListenerZipFile.java. The result like :
Why i can't run my program?
Upvotes: 0
Views: 142
Reputation: 2155
There are 2 problems here.
Consider you have, source_dir = D:\~\~\src, jar_location = D:\~\~\lib and package is com.example then your steps to compile are:
As per path shared, command to compile should be :
cd C:\ListenerZipfile\src
javac -cp .;C:\ListenerZipfile\lib\*.jar com\sigma\main\ListenerZipFile.java
Command to run java program with above path:
java -cp .;C:\ListenerZipfile\lib\*.jar com.sigma.main.ListenerZipFile
Upvotes: 1
Reputation: 1068
if you are using eclipse (from the screen shot i think you do) then
right click on your project->Properties->Java Build Path, click on Libraries tab->click on "Add External JARs" button-> pick your jar and click OK to close all windows.
This should solve your problem, if your problem is jar dependencies
Upvotes: 0
Reputation: 655
you are using a package without telling javac where it is located (jnotify for example).
you'd have to use it like:
javac -classpath "path/to/jnotify-0.94.jar" test.java
Upvotes: 2