0

Error: Could not find or load main class Dcoder

solution

30th Sep 2017, 9:26 PM
amine
14 Answers
+ 3
Which ide do you use (or do you start your .class file from command line interface... or do you use playground here)? Have you been able to run something simple like "Hello world"?
30th Sep 2017, 10:09 PM
Andrew Harchenko (Tomsk)
Andrew Harchenko (Tomsk) - avatar
+ 3
Try to change parameters of main from "(String name[])" to classic "(String[] args)" (I don't think it's the problem... but who knows, but it looks more like classpath problem, may be because of ide configuration)
30th Sep 2017, 10:12 PM
Andrew Harchenko (Tomsk)
Andrew Harchenko (Tomsk) - avatar
+ 3
...else you can run java with an other classpath given by command line parameter, but it is not recommended (better to follow conventions)
1st Oct 2017, 2:41 PM
Andrew Harchenko (Tomsk)
Andrew Harchenko (Tomsk) - avatar
+ 2
Yep. If topicstarter trying to run this code in SL's playground it would output "...not found... Dcoder" because of "package ..." But if this error is from Eclipse/IDEA/NetBeans/CLI/any_other_local_environment then it is another case.
1st Oct 2017, 2:09 PM
Andrew Harchenko (Tomsk)
Andrew Harchenko (Tomsk) - avatar
+ 1
You should tag the language and post your code to help us, so that we can help you !
30th Sep 2017, 9:28 PM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
+ 1
I commented the "package" line, added public before the class keyword and it worked (not sure if public can be omitted or not though)
30th Sep 2017, 9:36 PM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
+ 1
Sorry, I did not understand what you said :/
30th Sep 2017, 9:46 PM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
0
pls help me
30th Sep 2017, 9:26 PM
amine
0
package user_inputs; import java.util.Scanner; class Dcoder{ public static void main(String name[]) { Scanner cni = new Scanner(System.in); String nom; String prenom; String travail; int age; try { System.out.println("entrer le nom:"); nom= cni.nextLine(); System.out.println("entrer le prenom:"); prenom=cni.nextLine(); System.out.println("entrer le travail:"); travail= cni.nextLine(); System.out.println("entrer l'age:"); age=cni.nextInt(); } catch (Exception e){ System.out.print(e.toString());} finally{ cni.close();} } }
30th Sep 2017, 9:29 PM
amine
0
not work i do but anything change the same problem
30th Sep 2017, 9:39 PM
amine
0
the same probleme
30th Sep 2017, 9:50 PM
amine