my program is in C:\Users\Programs\x.java
X.java is using some files that are in y.jar, z.jar.
y.jar and z.jar are in C:\Users\Programs folder.
(1)
C:Users\Programs> javac x.java
(2)
C:Users\Programs> javac -classpath y.jar:z.jar x.java
I am not getting any errors when I do (2) but when I do (1) I am getting errors. Isn’t that classpath is set to current folder. If so why is it not seeing y.jar and z.jar.
The classpath includes the current folder.
However, it does not include subfolders of the current folder.
If you try to use
com.example.MyClass, Java will look for a file namedcom/example/MyClass.classdirectly inside of each folder in the classpath.It does not look in subfolders or JARs inside of folders in the classpath.