Error: Could not find or load main class in java how to fix?

Here is the code of the program

import java.io.*;
import java.util.Scanner;
public class TimeCheck {
 public static void TimeCheck(String[] args) {
 //TimeCheck beta versions 0.0.0.1

System.out.print("TimeCheck-started");
 // :)
 //enter quantity of day here, not below zero!!!!!
 int day = 1;
 // --------------

 chas int = 24;
 int minute = 1440;
 int second = 86400; //by daphney
 int milisecond = 86400000;
//calculate
 int chas1 = day * chas; // days multiplied by hours
 int minute1 = minute * chas; //hours to minutes
 int second1 = minute * second; //minutes to seconds
 int milisecond1 = second * milisecond; //seconds to millisecond
//the answers
 System.out.print("chas"+ chas1); //hours
 System.out.print("minute"+ minute1); //minutes
 System.out.print("second"+ second1); //seconds
 System.out.print("milisecond"+ milisecond1); //millisecondi
 //info on the author
 System.out.print("TimeCheck beta versions 0.0.0.1 by daphney");
}
 }

what gives cmd:
C:\Users\WE\Desktop\Time_check>javac TimeCheck.java
C:\Users\WE\Desktop\Time_check>
java TimeCheck
Error: Could not find or load main class TimeCheck
April 19th 20 at 12:30
1 answer
April 19th 20 at 12:32
I think you should read about Java and about the main method.
What you have:
public static void TimeCheck(String[] args) {
That should be:
public static void main(String[] args) {
But this problem cannot lead to the described by the author the result. - josefa.Whi commented on April 19th 20 at 12:35
@josefa.Whi, I agree, at least, the code should not even compile... - Jordyn.Blick commented on April 19th 20 at 12:38
Changed no result
Error: Could not find or load main class TimeCheck - daphney commented on April 19th 20 at 12:41
@josefa.Whi,

Changed no result
Error: Could not find or load main class TimeCheck - daphney commented on April 19th 20 at 12:44
@Jordyn.Blick, compile Yes, it can, if I have not noticed any other problems in your code, but while trying to start should give "Error: Main method not found in class TimeCheck". I think the author of the question, we just nedoskazany. - josefa.Whi commented on April 19th 20 at 12:47
@josefa.Whi,
Yes I know but it just compiles
jdk-11 - daphney commented on April 19th 20 at 12:50
@daphney, after javac TimeCheck.java run dir /b *.class and show results. - josefa.Whi commented on April 19th 20 at 12:53
@josefa.Whi,
C:\Users\ПК\Desktop\Time_check>dir /b *.class
TimeCheck.class - daphney commented on April 19th 20 at 12:56
@daphney, and now javac -d . TimeCheck.java and dir /b /s - josefa.Whi commented on April 19th 20 at 12:59
@josefa.Whi, C:\Users\ПК\Desktop\Time_check>javac -d . TimeCheck.java

C:\Users\ПК\Desktop\Time_check>dir /b /s
C:\Users\ПК\Desktop\Time_check\Start.bat
C:\Users\ПК\Desktop\Time_check\TimeCheck.class
C:\Users\ПК\Desktop\Time_check\TimeCheck.java
C:\Users\ПК\Desktop\Time_check\Компилятор.bat

C:\Users\ПК\Desktop\Time_check> - daphney commented on April 19th 20 at 13:02
@daphney, you case the environment variable CLASSPATH not set? Try java -cp . TimeCheck - josefa.Whi commented on April 19th 20 at 13:05
@josefa.Whi, C:\Users\ПК\Desktop\Time_check>java -cp . TimeCheck
Error: Could not find or load main class TimeCheck - daphney commented on April 19th 20 at 13:08
@daphney, a complete mystery. It should work. - josefa.Whi commented on April 19th 20 at 13:11
@josefa.Whi, CLASSPATH
C:\Program Files\Java\jdk-11\bin - daphney commented on April 19th 20 at 13:14
@daphney, your CLASSPATH environment variable to set not worth it, especially it should not point to this directory. - josefa.Whi commented on April 19th 20 at 13:17
@josefa.Whi, maybe Windows reinstall
for your information I have is the Windows 10 home - daphney commented on April 19th 20 at 13:20
@daphney, it has no value. Normal operating JRE works equally well on any operating system. - josefa.Whi commented on April 19th 20 at 13:23
to stop the JRE I have is
jre1.8.0_51
jdk-13.0.2
jdk-11 - daphney commented on April 19th 20 at 13:26
@josefa.Whi,
stop the JRE I have is
jre1.8.0_51
jdk-13.0.2
jdk-11 - daphney commented on April 19th 20 at 13:29
@daphney, it is also important. If the problem was in the version, you would get another error. - josefa.Whi commented on April 19th 20 at 13:32
@josefa.Whi,
Hmm...
Windows 10 home runs not stable I better re-install it - daphney commented on April 19th 20 at 13:35
@daphney, it's not the OSes. But really, that's weird) - Jordyn.Blick commented on April 19th 20 at 13:38
@daphney, try on luck more of those ways:

1. java -cp C:\Users\ПК\Desktop\Time_check\TimeCheck

2. To move a file into these folders and run from there:
  • C:\Program Files\Java\jdk-11\bin
  • C:\Program Files\Java\jdk-11\lib
- hellen.Tillm commented on April 19th 20 at 13:41

Find more questions by tags Java