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
14 Respuestas
+ 6
Did u install jvm and jdk on your device..
+ 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
+ 2
opemipo olagoke post your code here, so people can read an identify where the problem is.
+ 2
opemipo olagoke are going to send your code or not ?
+ 2
you should instal ellipse neon
+ 1
I think the problem is with the file location and environment variables.wait for some time I'll send u some web help...
+ 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.
+ 1
Could you please remove the URL in the question tags? Just put 'Java' in tags. FYI URLs are inaccessible in tags.
0
I suggest you install eclipse and it is the best ide for java instead of using cmd
0
Thats wat I did
Aymane Boukrouh [INACTIVE]
0
I just downloaded jdk Dheeraj
0
Thank u so much Dheeraj
Contact me on gmail...
Kngjuvenile@gmail.com
0
And on cmd I wrote
java (directory of file)\MyClass.java
and then:
java MyClass
Then it showed the error Aymane Boukrouh [INACTIVE]
- 1
Ok Aymane Boukrouh [INACTIVE]
public class MyClass {
public static void main (String[]args) {
System.out.println("Hello world");
}
}