How to create a package in Java? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to create a package in Java?

If I do not use any IDE like Eclipse, I only use a simple text editor, how can I put my classes into the same package? (Do I have to put all classes into one folder? If it does not necessary, how to structure my folders?)

16th Nov 2016, 2:05 PM
Marcell Juhasz
1 Answer
+ 2
yes you are right you have to put them in a folder using os's explorer but remember while compiling in CMD you have to use -d keyword there to compile javac -d packagefolderpath javacode. java
16th Nov 2016, 5:01 PM
Sandeep Chatterjee