Compiling multiple classes (console) in Java

I have 4 classes for my project, they (titleScreen, credits, storyScreen and camapaign) respectively, since they are related to each other, I don’t know how to compile it. One more thing: when I used javac (DOS / CMD) commands, it still didn’t work, saying that the compiler cannot find other classes, but they are present as a class. How can I compile it and make it work? By the way, this is in the console or without a GUI, so Clean and Build in Netbeans do not work.

+5
source share
4 answers

Just do

javac *.java

Or, if you have separate source and binary folders:

mkdir bin
javac -d bin src/*.java

Or, if you have several source folders:

mkdir bin
shopt -s globstar # requires bash 4
javac -d bin src/**/*.java
+12
source

, javac *.java . , , , Java:

  • Apache Ant - " " "". "build.xml", , , .

  • Apache Maven . , , , , , . Maven , ""... . , ( ) .

+3

java , . "directory", javac directory/*.java .

+1

jdk7 jre7. : "classpath" "path" > computer- > properties- > advanced- > environment , : "My_Project", . () My_Project () "classes". , , : "C: > cd Users\My_Name\Project_Location\My_Project\src". javac -d../classes My_Project. . , , .class. , , java My_Project, . , / Java-.

0
source

All Articles