문제

So I have the following structure:

HelloWorld
  -> Package1
      -> Class1.java
  -> Package2
      -> Class2.java 

I am trying to complile Class2.java from the command line using:

javac -classpath ../equinox.jar Package2/Class2.java

But i keep on getting the error : package Package1 does not exist

How can I fix this?

도움이 되었습니까?

해결책

Include the current directory in the compilation path

javac -classpath ../equinox.jar:. Package2/Class2.java

Explanation: because the -classpath argument is used the current directory is no longer automatically used in the classpath so needs to be added explicitly.

See the Java programming language compiler for a full description of all command line options

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top