Doesn't it hurt? Hey Javin,Thanks a lot. In accordance with the law of 8th December 1992, you can access the database containing your personal data and modify this information at any time by contacting Link to Media … Subham Mittal has worked in Oracle for 3 years . * The Appplication compiles and runs as expected with BlueJ. roll(); } public void mouseReleased(MouseEvent evt) { } public void mouseClicked(MouseEvent evt) { } public void mouseEntered(MouseEvent evt) { } public void mouseExited(MouseEvent evt) { } } // end class ClickableDiceCan you solve this errors in my program. Server is the main class, contains main() method but somehow Eclipse is not able to find it. while the second command worked fine. This worked. Also set a light blue // background color. HelloHPMy first program in Java, HelloWorld !! It's on default package, and I have tried everything from cleaning the project, building the project and build automatically. Within Eclipse, no problem running my Java with Package. I debug it by debug as Java program and found that it was one of the dependent JAR which was available in classpath but Eclipse was not seeing it. if package is com then run the command outside of the com directory with full classname i.e. I have tried every possible thing from setting the path and classpath to using dto but the result is the same. [Onff-turn it on!]. Please Note that both the above paths have "java" command while one is from "jre" the other is from "jdk" Other global variables are as following in ".bash_profile" Helped my solve my first Java issue. I then went to the parent directory and tried again. It worked! Great Explanation. It started working in 32bit java, did foll: Thanks for taking the time to share the solution with us! while the second command worked fine. Our program runs perfectly if you just double click on it, but it doesn't as a scheduled task. @dArch, thanks! die1 = (int)(Math.random()*6) + 1; die2 = (int)(Math.random()*6) + 1; play(getCodeBase(), ""); repaint(); } public void mousePressed(MouseEvent evt) { // When the user clicks the applet, roll the dice. Please Note that both the above paths have "java" command while one is from "jre" the other is from "jdk" Other global variables are as following in ".bash_profile" @Javin: Thank you for replying. Hello Mahek,try changing the name of your program to the name of the project class .It worked for me. I added dll of the c program in java build path. Hello @Nikita, did you able to run the program from command line or you still have some error? g.setColor(Color.white); g.fillRect(x, y, 35, 35); g.setColor(; g.drawRect(x, y, 34, 34); if (val > 1) // upper left dot g.fillOval(x+3, y+3, 9, 9); if (val > 3) // upper right dot g.fillOval(x+23, y+3, 9, 9); if (val == 6) // middle left dot g.fillOval(x+3, y+13, 9, 9); if (val % 2 == 1) // middle dot (for odd-numbered val's) g.fillOval(x+13, y+13, 9, 9); if (val == 6) // middle right dot g.fillOval(x+23, y+13, 9, 9); if (val > 3) // bottom left dot g.fillOval(x+3, y+23, 9, 9); if (val > 1) // bottom right dot g.fillOval(x+23, y+23, 9,9); } void roll() { // Roll the dice by randomizing their values. I get an error could not find or load main class in my code how to fix it can anyone help me. I completely forgot about the "right click" and "Run As" Java Application! For more java articles ,Click here to Subscribe JavaHungry I tried to run java program from command line but i am still getting the same issue. I don't know how I didn't know this as an expert java developer, Thanks, this article is really problem-solving for me, class exceptionDeom2{ public static void main(String args[]) { try{ System.out.println(3/0); System.out.println("in try"); } catch(ArithmeticException e){ System.out.println("Exception"+e.getMessage()); } /* finally{ System.out.println("learning Exception Handeling"); }*/ }}Error:- E:\java\Java_Programs\Exception handling> java exceptionDemo2Error: Could not find or load main class exceptionDemo2PS E:\java\Java_Programs\Exception handling>. I have included the compile below with the error from not having the classpath from version "1.8.0_121"Java(TM) SE Runtime Environment (build 1.8.0_121-b13)Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)# javac error: package does not exist DriverManager.registerDriver(new; ^# javac -classpath /usr/lib/jvm/java-8-oracle/jre/lib/jt400.jar java JDBCQuery PSPF PRICEException in thread "main" java.lang.NoClassDefFoundError: com/ibm/as400/access/AS400JDBCDriver at JDBCQuery.main( by: java.lang.ClassNotFoundException: at at java.lang.ClassLoader.loadClass( at sun.misc.Launcher$AppClassLoader.loadClass( at java.lang.ClassLoader.loadClass( ... 1 more# java -cp /root JDBCQuery PSPF PRICEException in thread "main" java.lang.NoClassDefFoundError: com/ibm/as400/…. "); rno = sc.nextInt(); }}class Test extends Student{ int mrk1,mrk2; public void mrks() { Scanner m = new Scanner(; System.out.println("Enter the marks of 1st subject "); int m1 = m.nextInt(); System.out.println("Enter the marks of 2nd subject "); int m2 = m.nextInt(); mrk1 = m1; mrk2 = m2; } public void display() { System.out.println("Name of the student:- " + name); System.out.println("Roll no. while Running it, I get the following error: run: Error: Could not find or load main class Java Result: 1 BUILD SUCCESSFUL (total time: 0 seconds) I am frustrated I have spent a week trying to figure this out. I am trying to run a java program via notepad and i am using window 7 32 bit. What was wrong with the original code?Here is some output:vince@Vince2 sample]$ cat HelloHP.javapackage HelloHP;/** * Simple Java program to demonstrate following error * Error :Could not find or load main class * * @author Javin Paul */public class HelloHP { public static void main(String args[]) { System.out.println("My first program in Java, HelloWorld !! Can you please describe your problem in little more detail? My error was resolved after deleting existing run configuration where User entry was not pointing to default classpath. 3 Ways to Prevent Method Overriding in Java - Priv... How to get current stack trace in Java for a Threa... How to Convert Map to JSON to HashMap in Java? Sadly not. Any suggestion for me to be able to run my jar file as java -jar test.jar, Thanks Man, You saved my day. I copied your source for HelloHP and saved it as Still failed. Any help would be GREATLY appreciate.# ls -lh /usr/lib/jvm/java-8-oracle/jre/lib/jt400.jar-rwx------ 1 root root 4.6M Feb 12 18:28 /usr/lib/jvm/java-8-oracle/jre/lib/jt400.jar. I commented out the package statement in the source and added "-cp ." Yo lo resolví así y con la siguiente configuración de CLASS_PATH y path.W10 64Open Java jdk-13.0.1Apache Netbeans 11.2JAVA_PATH = C:\JavaOpen\jdk-13.0.1\PATH = %JAVA_PATH%\bin\En el CMD, entrar a la carpeta ...\target\classesy ahí llamar a la clase main del programa, ejemplo : ...\target\classes>java openjava.holamundo.inicio(En mi proyecto la ruta de salida es: C:\Users\Usuario\Documents\NetBeansProjects\holaMundo\target\classes\openjava\holamundo)Y listo! The program is unable to run saying "Could not find or load main class". Error: Could not find or load main class org.codehaus.plexus.classworlds.launcher.Launcher. java -cp . What am I doing wrong? hey. @mithilesh, you need to run the program outside of the directory e.g. Using your help above was able to run my Java classes without a Package from the command line, but not Java classes with Package. To avoid this error, you need to specify the absolute (including packages) name of the .class file (just name) which is in the current directory. Error: Could not find or load main class org.codehaus.plexus.classworlds.launcher.Launcher. import java.awt. *;class Student{ int rno; String name; void info() { Scanner sc = new Scanner(; System.out.println("Enter the name of the student "); name =; System.out.println("Enter the Roll no. still not able to overcome with this problem. i still get the same error, the app runs in netbeans but not in dist folder. A big thank you Javin Paul :). Re: jnlp failure "Could not find the main class". // Also, play a clicking sound to give the user more feedback. Contact Information #3940 Sector 23, Gurgaon, Haryana (India) Pin :- 122015. -- New 编译HelloWorld.java生成字节码文件HelloWorld.class,运行HelloWorld.class报错:Error: Could not find or load main class。 【原因分析】 当前目录是.class文件所在目录,要运行.class字节码文件,需要将当前目录加入系统变量CLASSPATH,系统才能找到当前目录下的Java类。 【解决方案】 On opening and examining the downloaded jnlp file, it seems to be OK to me. you're awesome my friend! All that thinking. I Created a JavaFX Application with BlueJ. The val parameter gives the // value showing on the die (that is, the number of dots). } System.exit (0); }}If I don't include any of the connection information the script outputs the error messages correctly (removed due to char limit) so it looks to me that it has an issue with the JTOpen driver. if you use winrar or winzip, you can see class files inside JAR on Windows. int die2 = 3; public void init() { // To initialize the applet, register the applet to listen // for mouse events on itself. давала ошибку "Could not find or load main class" решилось таким образом. your welcome @Ganesh, glad you find this tutorial useful. Difference between State and Strategy Design Patte... Recursive Binary Search Algorithm in Java - Exampl... What is String args[] Argument in Java Main method, How to Create, Update and Remove Soft link in UNIX. Difference Between java.util.Date and java.sql.Dat... How to Convert JSON array to String array in Java ... UNIX Command Tutorial, Tips and Examples for Begin... 10 JDK 7 Features to Revisit, Before You Welcome J... How to Convert Local Time to GMT in Java - Example... 10 Examples of CUT command in UNIX and Linux. However, When I create a Jar File of the application and try to run it by double clicking, Nothing Happens. Hello,thank you for your help. com.jni.JniJavaSidePgm, Running from outside the package did the job for me, thanks! ).