java - Package not found; javac -
This is upset.
I have such a directory structure
-lib - some jar files -PackageName - .Java - some other package - some other Java class. Java
main.Java import some other popup
. And both Java files use jar in Libre.
What I do, JR files independently adds to CLASSPATH and then run in this form: javac packageName / main.java
but gives the error that the package is not Found SomeOtherPackage
. Should it not be a realization of dependence and should also prepare some other package ? What will be the classpath for the Javak command and the above case?
Thank you
The usual practice is to add package root to the classpath.
When you are already in the package root, then -cp. Use
. E.g.
cd / path / per / all / package javac -cp package name / main.java
if you also want to include JAR files , Then ; Use
(or * symbol, :
) as a path path separator:
javac -cp .; Libre / file.jar packageName / main.java
To save time by repeating all the shell command typing, a .bat
(or * nix one .sh
) file. Or just an IDE if you are already familiar with java / javac and so on.
Comments
Post a Comment