![]() JVM: OpenJDK 64-Bit Server VM by JetBrains s.r. ![]() Subscription is active until December 2, 2018 usr/lib/jvm/java-8-oracle/bin/java -javaagent:/mnt/Data/lindev/ideaIU/lib/idea_rt.jar=43819:/mnt/Data/lindev/ideaIU/bin -Dfile.encoding=UTF-8 -classpath /usr/lib/jvm/java-8-oracle/jre/lib/charsets.jar:/usr/lib/jvm/java-8-oracle/jre/lib/deploy.jar:/usr/lib/jvm/java-8-oracle/jre/lib/ext/cldrdata.jar:/usr/lib/jvm/java-8-oracle/jre/lib/ext/dnsns.jar:/usr/lib/jvm/java-8-oracle/jre/lib/ext/jaccess.jar:/usr/lib/jvm/java-8-oracle/jre/lib/ext/jfxrt.jar:/usr/lib/jvm/java-8-oracle/jre/lib/ext/localedata.jar:/usr/lib/jvm/java-8-oracle/jre/lib/ext/nashorn.jar:/usr/lib/jvm/java-8-oracle/jre/lib/ext/sunec.jar:/usr/lib/jvm/java-8-oracle/jre/lib/ext/sunjce_provider.jar:/usr/lib/jvm/java-8-oracle/jre/lib/ext/sunpkcs11.jar:/usr/lib/jvm/java-8-oracle/jre/lib/ext/zipfs.jar:/usr/lib/jvm/java-8-oracle/jre/lib/javaws.jar:/usr/lib/jvm/java-8-oracle/jre/lib/jce.jar:/usr/lib/jvm/java-8-oracle/jre/lib/jfr.jar:/usr/lib/jvm/java-8-oracle/jre/lib/jfxswt.jar:/usr/lib/jvm/java-8-oracle/jre/lib/jsse.jar:/usr/lib/jvm/java-8-oracle/jre/lib/management-agent.jar:/usr/lib/jvm/java-8-oracle/jre/lib/plugin.jar:/usr/lib/jvm/java-8-oracle/jre/lib/resources.jar:/usr/lib/jvm/java-8-oracle/jre/lib/rt.jar Įrror: Could not find or load main class īuild #IU-181.4203.550, built on March 26, 2018 For example, if the FQN of your classes is, Java would try to find an Howtoremove.class in the com/acme/example directory.I am having the same problem even when I create a simple java project like a command line app or a java hello world. Remember that you will also need to check the subdirectory as it needs to match the FQN. In this case, the looked for class will have /usr/local/acme/classes/com/acme/example/Appuals.class as a pathname.īasically, if you use this address /usr/local/acme/classes/com/acme/example as classpath, the class will not be found by Java. When launching from the 'Start Menu' getting a popup window with the following error: Could not find main class com/intellij/idea/Main Seems like a possible classpath issue. Luckily, you can correctly set the classpath with either of the following commands so make sure to use them:Ĭ:> sdkTool -classpath classpath1 classpath2…Ī directory would always correspond to namespace’s root when it is declared as a classpath and so if, for instance, on the classpath is /usr/local/acme/classes, Java’s search will be for . Intellij launch error in a Windows Environment. the classname has been correctly declared) and if the error still seems to persists, then the likely reason for it to keep on showing is that the entered command is unable to find the classname path which, in turn, results in the Java could not find or load main class error. For example, the following entry is incorrect and would thus not allow the main class to load:Īs said above, using a filename will not lead to the desired result. java com/acme/example/ListHowtoremove.classĬasing is also important in this case – even a slight error such as a single incorrect letter could cause the Java could not find or load main class problem.Here are several examples of how you can do that: Īlso, remember that a classname must be declared and not a pathname (or filename). Type j ava rather than just java howtoremove. If you write a simple class name – for instance, if the declared class is in a package such as, you should use the full classname and also include the package when typing the command. Here are the possible ways you can get this wrong: Usually, the mistake that users make which leads to the Java could not find or load main class is the class name that they give as an argument is wrong or, if the class name is correct, the form is wrong. ![]() How to Fix “Could not find or load main class” in Java Below, we will cover the most common instances when this error is likely to show up and we will also help you deal with it. Sometimes, what’s required is for the user to provide the correct path to the needed file. Toward the bottom middle will be where the manifest file and the main class are defined. In such a case, the command is unable to locate the directory where the class is located. Assuming you are building the JAR with IntelliJ IDEA via an artifact configuration, go to File > Project Structure > Project Settings > Artifacts. If you get an error message that reads Could not find or load main class while trying to launch a Java program through a command in the command prompt then the reason behind the issue is likely a mistake on your side and most probably has to do with a wrongly declared class. ![]()
0 Comments
Leave a Reply. |