I need to know how to compile these files from the command prompt. Then I need to know how to run these files from the command prompt. I keep getting the error package com.citc1318.course.chapters does not exist and error: cannot find symbol. I can not figure out how to fix this. This is in this directory c;\Code\com\CITC1318\course package com.CITC1318.course; import com.CITC1318.course.Chapters.Chapter1; import com.CITC1318.course.Chapters.Chapter2; import com.CITC1318.course.Chapters.Chapter3; public class GreetingsClass { public static void main(String[] args) { System.out.println("$ Greetings, CITC1318!"); Chapter1 c1 = new Chapter1(); Chapter2 c2 = new Chapter2(); Chapter3 c3 = new Chapter3(); } } These are in this directory c;\Code\com\CITC1318\course\chapters package com.CITC1318.course.Chapters; public class Chapter1 { public Chapter1() { System.out.println("Hello from Chapter1!"); } } package com.CITC1318.course.Chapters; public class Chapter2 { public Chapter2() { System.out.println("Hello from Chapter2!"); } } package com.CITC1318.course.Chapters; public class Chapter3 { public Chapter3() { System.out.println("Hello from Chapter3!"); } }
I need to know how to compile these files from the command prompt.
Then I need to know how to run these files from the command prompt.
I keep getting the error package com.citc1318.course.chapters does not exist and error: cannot find symbol.
I can not figure out how to fix this.
This is in this directory c;\Code\com\CITC1318\course
package com.CITC1318.course;
import com.CITC1318.course.Chapters.Chapter1;
import com.CITC1318.course.Chapters.Chapter2;
import com.CITC1318.course.Chapters.Chapter3;
public class GreetingsClass {
public static void main(String[] args) {
System.out.println("$ Greetings, CITC1318!");
Chapter1 c1 = new Chapter1();
Chapter2 c2 = new Chapter2();
Chapter3 c3 = new Chapter3();
}
}
These are in this directory c;\Code\com\CITC1318\course\chapters
package com.CITC1318.course.Chapters;
public class Chapter1 {
public Chapter1()
{
System.out.println("Hello from Chapter1!");
}
}
package com.CITC1318.course.Chapters;
public class Chapter2 {
public Chapter2()
{
System.out.println("Hello from Chapter2!");
}
}
package com.CITC1318.course.Chapters;
public class Chapter3 {
public Chapter3()
{
System.out.println("Hello from Chapter3!");
}
}

I hope you are aware of the package creation in Java.
To import the package we just need to write --> import package_name.
But in the case of making our own package and importing is a different task.
In your case, you first implement your 3 programs - Chapter1, Chapter2, and Chapter3.
Make this will work because they are not going to run with the main class.
To run the program I made a little bit change which I'll be sharing below.
Chapter1.java
package com.CITC1318.course.Chapters;
public class Chapter1 {
public static void main(String args[]){
System.out.println("Hello from Chapter1!");
}
}
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images









