javac : Compiling a .java file which uses other classes in it

后端 未结 2 689
梦谈多话
梦谈多话 2020-11-28 12:43

HI i have 3 java files

a.java  
b.java  
c.java  

I managed to generate .class files for both a and b using

javac example/a         


        
2条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-28 13:43

    Presumably you're not in the example/ directory when you run javac. Try

    javac -cp example c.java
    

    Or just cd into that directory. The classpath is not automatically resolved for the classes c.java depends on.

提交回复
热议问题