I have four java files in my folder. They are all in the same package. Here’s the package declaration
package com.osama.GHide
All of these classes are in the same package. I want to know how can I compile them using javac (i mean i do not know how to compile multiple files that are using each other). And once that is done how do I launch then using java command in the CLI? here are the file names.
EnteringPoint.java
HidingProcess.java
ListFiles.java
From the project’s root directory:
To run, assuming no other dependencies:
(Assuming
EnteringPointhas the normalmainfunction.)The
javaccommand compiles all the.javafiles in the package’s directory. Since they’re all in the same package/directory, this works. It also puts the generated.classfiles in the same directory, which may or may not be what you want.To put them in a different directory, use the
-doption and supply a path.Then to run: