'Compiling multiple packages
I'm building a small Java project and must compile it from the command line and can't figure out how. The packages of the project are the following :
Project
+ src
+ area
- area.java
+ classroom
- classroom.java
+ yard
- yard.java
+ floor
- floor.java
+ stairs
- stairs.java
+ corridor
- corridor.java
+ school
- school.java
+ person
- pesron.java
+ student
- student.java
+ junior
- junior.java
+ senior
- senior.java
+ teacher
- teacher.java
+ main
- main.java
The main.java is the main program of the project I want the *.class files in a separete folder at the end of the compilation
Solution 1:[1]
According to Oracle says, you have to follow few steps to build a simple java application.
Firstly, before building and running an application from the command line, verify that your java version is higher than 1.5 of the Java SE software JDK version since the jar command is not available under it. But not supported since JDK 11 also. You can run the java -version command to confirm it.
After verifying the java version, then Compile Class Files. Use the javac compiler from the Java SE development kit to compile Java source files.
Command :javac -target 1.3 -source 1.3 -bootclasspath ../../lib/cldc_10.jar;../../lib/midp2.0.jar -d tmpclasses src/*.java
- Preverify Class Files using the Java ME Platform SDK pre-verify utility.
Command : preverify.exe -classpath ..\..\lib\cldcapi10.jar;..\..\lib\midpapi20.jar -d classes tmpclasses
Please Refer Oracle Official Website link for further details.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |