linux编译多个java文件 [英] linux to compile multiple java file

查看:79
本文介绍了linux编译多个java文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的目录结构.

/用户/a /用户/b /user/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.

现在,在我的外壳上,我在/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.java:14: duplicate class: person

有什么要解决的吗?

推荐答案

我认为这里的问题可能是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

find . -name '*.java' -exec javac {} \;

或更准确地说find . -name 'person.java' -maxdepth 2 -exec javac {} \;

这篇关于linux编译多个java文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆