How to compile multiple class files in Java on LINUX shell?

Hello, I'm on campus trying to compile a simple binary program. Our campus has only a shell, and I use Linux over eclipse ..

I have 2 class files in my current directory bintree.java and treetest.java

javac bintree.java treetest.java

this code creates several classes, but what is my next step? ive searched everywhere where there is not much information about the java Linux shell. thank

+3
source share
3 answers

If all the java files needed for compilation are in your directory, you can

javac *.java 

And then

java NameOfClassWithMainMethod

, IDE, Maven Gradle. , , Maven.

+6
$ find -name "*.java" > sources.txt
$ javac @sources.txt
+2

http://www.dummies.com/how-to/content/how-to-use-the-javac-command.html

javac xxx.java xxy.java xxz.java .class. javac ?

, questoverflow.

Basically use java -cp classname for the class with your "static Main ()" in it

0
source

All Articles