linux编译多个java文件 [英] linux to compile multiple java file
问题描述
这是我的目录结构.
/用户/a/用户/乙/用户/b
/user/a /user/b /user/b
文件夹a,b,c里面有一个文件person.java(是同一个文件,只是一行修改.
inside folder a,b,c there is a file person.java (it is the Same file, just a one line modification.
现在,在我的 shell 上,我在我的/user/目录上,我尝试做
now, on my shell, im on my /user/ directory and i try to do
javac */person.java
shell 返回以下错误,
the shell returns the following error,
person.java:14:重复类:person
person.java:14: duplicate class: person
有什么办法可以解决这个问题吗?
Is there anything to resolve this?
推荐答案
我认为这里的问题可能是,javac 试图一次性编译所有内容,这自然会导致重复的类定义.
I think the problem here might be, that javac tries to compile everything in one go, which naturally results in duplicated class definitions.
解决这个问题的简单方法是
A simple way to resolve this would be
找到.-name '*.java' -exec javac {} ;
或者更准确地说 find .-name 'person.java' -maxdepth 2 -exec javac {} ;
这篇关于linux编译多个java文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!