0

I need help!!!!! So I just started learning java but whenever i try to compile and execute my code on cmd it doesn't work

It shows Error:Could not find find or load main class MyClass Caused by: java.lang ClassNotFoundException: MyClass

12th Jan 2020, 7:17 PM
opemipo olagoke
opemipo olagoke - avatar
14 ответов
+ 6
Did u install jvm and jdk on your device..
12th Jan 2020, 7:37 PM
Dheeraj
Dheeraj - avatar
+ 4
In this example, let say the name of your file is something.java opemipo olagoke first, you need to compile java using javac command and not java: javac something.java After that, a new file will be created: something.class Then you can run this command: java something
12th Jan 2020, 7:40 PM
Aymane Boukrouh
Aymane Boukrouh - avatar
+ 2
opemipo olagoke post your code here, so people can read an identify where the problem is.
12th Jan 2020, 7:42 PM
Aymane Boukrouh
Aymane Boukrouh - avatar
+ 2
opemipo olagoke are going to send your code or not ?
12th Jan 2020, 7:59 PM
Aymane Boukrouh
Aymane Boukrouh - avatar
+ 2
you should instal ellipse neon
13th Jan 2020, 6:35 AM
Lelouch Vi Britannia
Lelouch Vi Britannia - avatar
+ 1
I think the problem is with the file location and environment variables.wait for some time I'll send u some web help...
12th Jan 2020, 7:45 PM
Dheeraj
Dheeraj - avatar
+ 1
I also have problem like this in IntelIJ yesterday, all was good but its said problems with Class name and Document where I create it. I just create new one project correctly with and problem was solved. I think you juat create some in project, then try rewrite in same project main Class and system dont give do it to you.
12th Jan 2020, 9:12 PM
cxvowevski
cxvowevski - avatar
+ 1
Could you please remove the URL in the question tags? Just put 'Java' in tags. FYI URLs are inaccessible in tags.
14th Jan 2020, 2:45 PM
Ipang
0
I suggest you install eclipse and it is the best ide for java instead of using cmd
12th Jan 2020, 7:34 PM
Dheeraj
Dheeraj - avatar
12th Jan 2020, 7:41 PM
opemipo olagoke
opemipo olagoke - avatar
0
I just downloaded jdk Dheeraj
12th Jan 2020, 7:42 PM
opemipo olagoke
opemipo olagoke - avatar
0
Thank u so much Dheeraj Contact me on gmail... Kngjuvenile@gmail.com
12th Jan 2020, 7:49 PM
opemipo olagoke
opemipo olagoke - avatar
0
And on cmd I wrote java (directory of file)\MyClass.java and then: java MyClass Then it showed the error Aymane Boukrouh [INACTIVE]
12th Jan 2020, 8:14 PM
opemipo olagoke
opemipo olagoke - avatar
- 1
Ok Aymane Boukrouh [INACTIVE] public class MyClass { public static void main (String[]args) { System.out.println("Hello world"); } }
12th Jan 2020, 8:14 PM
opemipo olagoke
opemipo olagoke - avatar