I am required to call a method called query1 from the command line using java ser322.JdbcLab <url> <user> <pwd> <driver> query1. However, when I call the method, I get an error: Error: Could not find or load main class ser322.JdbcLab
Caused by: java.lang.ClassNotFoundException: ser322.JdbcLab
The project file structure is the attached JdbcLab/src/main/java/ser322/JdbcLab.java. JdbcLab is in package ser322.
I tried using the command from each folder starting with the root folder and ending with the package folder. I read other posts with the same issue and I do not have any typos. I tried using .java and .class. I am using IntelliJ. The file compiles correctly. I am able to go to the package folder and use the command java JdbcLab.java query1. But I am required to use ser322.JdbcLab command instead.
Probably you need to set up your classpath variable that should solve the problem.
Link for the same
https://www.google.com/amp/s/www.geeksforgeeks.org/how-to-set-classpath-in-java/amp/