Page 1 of 1

Compile and execution w/packages involved

Posted: Sun Jun 04, 2023 12:41 pm
by aks0961
Hi, I'm on chapter 4.5.1 and learning about compiling and executing a program via the CMD when there are packages involved and I was also watching a video for this topic on youtube and just had a question.

So in the youtube video, he does it as follows:

Javac -d . Hello(this is the class he used).java

then he does

Java one(this was his package).Hello

As you can see, the first line he inputs into the CMD is exactly what you said to do in the book. But if you look at the second line, while it is similar, he doesn't add "-classpath ." before doing the package.class format... and this is what you put in the book.

Just wanted to reach out and have this question rectified!

Re: Compile and execution w/packages involved

Posted: Sun Jun 04, 2023 9:05 pm
by admin
What is the question? The book shows the right and complete way.

Re: Compile and execution w/packages involved

Posted: Mon Jun 05, 2023 11:52 am
by aks0961
In the video I watched, the person did almost the exact same steps as you, like I outlined above, but you added the "-classpath ." while he did not, and still compiled and executed the program

I know on the next page you mentioned what "-classpath ." is but I wasn't able to really grasp what it does so just wanted your help on it