Please show us the path and the contents of the directory you are in, also whether you have a package declaration in that class, and the results of the following two instructions:-It is incorrect that Java11 doesn't supply a JRE. The JRE is part of the JVM you downloaded. Java11 no longer supplies a separate JRE; that is something different.
Don't say you are running a class. You cannot run classes, only methods.
Rupa Kondapalli wrote:Okay, I thought classpath should point to the directory having .class files. . . .
How much of that CLASSPATH was added automatically when you installed SSH or PowerShell and how much did you add by hand? Remove everything you added yourself, but leave whatever SSH and PowerShell added for you. Add “.;” to the start of the CLASSPATH, since you will usually be running from the . directory (=current working directory) at the command line.
If you need a different CLASSPATH it is better to use the -cp option because the changes will be different for every program you run.
P.S: After compiling my java program, by default it gave the class file name as 'A'. I ran it w/o renaming to see the output.
You mean you wrote a class called A and you then got a file called A.class?
I like you because you always keep good, crunchy cereal in your pantry. This tiny ad agrees: