Could Not Find The Main Class Error Message
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies
Java Error Could Not Find The Main Class
of this site About Us Learn more about Stack Overflow the company java error could not find the main class program will exit Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges
Error Could Not Load Or Find Main Class
Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a could not find or load main class error in java cmd minute: Sign up Error: Could not find or load main class [duplicate] up vote 225 down vote favorite 27 This question already has an answer here: What does “Could not find or load main class” mean? 24 answers I am having trouble compiling and running my Java code, intended to allow me to interface Java with a shared object for Vensim, a could not find or load main class files simulation modeling package. The following code compiles without error: javac -d . -cp ./apache-log4j-1.2.16/log4j-1.2.16.jar:./vensim.jar SpatialModel.java VensimHelper.java VensimException.java VensimContextRepository.java However, when I try to run the following: java -cp ./apache-log4j-1.2.16/log4j-1.2.16.jar:./vensim.jar SpatialModel vars I get the following error: "Error: Could not find or load main class SpatialModel ". My SpatialModel.java code does contain a 'main' method (below), so I'm not sure what the problem is - can anyone please help me out? Thanks. import java.io.File; import java.text.NumberFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import org.apache.log4j.Logger; public class SpatialModel { private VensimHelper vh; public static final String DLL_LIBNAME_PARAM = "vensim_lib_nam"; public static final String MODEL_PATH_PARAM = "vensim_model_path"; private final static int VENSIM_CONTEXT_CREATION_MAX_FAILURE_COUNT = 10; public SpatialModel() throws SpatialException { String libName = System.getProperty(DLL_LIBNAME_PARAM); String modelPath = System.getProperty(MODEL_PATH_PARAM); if(libName == null || libName.trim().equals("")) { log.error("Vensim library name has to be set with -D" + DLL_LIBNAME_PARAM); throw new SpatialException("Vensim library name has to be set with -D" + DLL_LIBNAME_PARAM); } if(modelPath == null || modelPath.trim().equals("")) { log.error("Model path has to set with -D" + MODEL_PATH_PARAM); throw new SpatialException("Model path ahs to be set with -D" + MODEL_PATH_PARAM); } for
Google. Het beschrijft hoe wij gegevens gebruiken en welke opties je hebt. Je moet dit vandaag nog doen. Navigatie overslaan NLUploadenInloggenZoeken Laden... Kies je
Could Not Find The Main Class Jar
taal. Sluiten Meer informatie View this message in English Je gebruikt YouTube could not find the main class aclauncher in het Nederlands. Je kunt deze voorkeur hieronder wijzigen. Learn more You're viewing YouTube in Dutch. You can change
Could Not Find The Main Class Net.minecraft.client.minecraft. Program Will Exit
this preference below. Sluiten Ja, nieuwe versie behouden Ongedaan maken Sluiten Deze video is niet beschikbaar. WeergavewachtrijWachtrijWeergavewachtrijWachtrij Alles verwijderenOntkoppelen Laden... Weergavewachtrij Wachtrij __count__/__total__ error : could not find or load main http://stackoverflow.com/questions/7485670/error-could-not-find-or-load-main-class class Test.java JavaProgrammers AbonnerenGeabonneerdAfmelden103103 Laden... Laden... Bezig... Toevoegen aan Wil je hier later nog een keer naar kijken? Log in om deze video toe te voegen aan een afspeellijst. Inloggen Delen Meer Rapporteren Wil je een melding indienen over de video? Log in om ongepaste content te melden. Inloggen Statistieken 29.171 weergaven 45 Vind je dit een leuke video? Log in om https://www.youtube.com/watch?v=NJYleBcW6dw je mening te geven. Inloggen 46 77 Vind je dit geen leuke video? Log in om je mening te geven. Inloggen 78 Laden... Laden... Laden... Beoordelingen zijn beschikbaar wanneer de video is verhuurd. Deze functie is momenteel niet beschikbaar. Probeer het later opnieuw. Gepubliceerd op 2 mrt. 2016First we can successfully compile with setting path of Java program ,But wile run that simple program we will get an error : "could not find or load main class in java ".Why it happens ?Because we can compile our java programs with their paths ,but while running that program we get an error : could not find or load main class in java,because JVM could not load that .class from that directory...In my case i have written one simple java program ,I was save simple program in F:\ drive i can compile my program through its path 1.C:\Program Files 86\Java\jdk1.8.0\bin javac F:\Test.java2.It can compile successfully ,but when i am trying to run above program ,i got an error "could not find or load main class in Test.java "3.So to avoid that problem we need to change o
This Site Careers Other all forums Forum: Java in General run time error: could not find or load main class Saptaparna Dhar Greenhorn Posts: 10 posted 5 years ago Hi! I am new to Java.I tried the HelloWorld program.Using javac command,I could compile it.A .class file got https://coderanch.com/t/552833/java/java/run-time-error-find-load created.But,when I tried running the same with java command, an error-"could not find or load main class HelloWorld" is displayed. I have checked the spelling, as I know java is case sensitive. Please help me out. Saptaparna Dhar Greenhorn Posts: 10 posted 5 years ago I would like to add one more thing that I am using WINDOWS7. I have set both the user variable name and system variable name as" CLASSPATH " in Environmental variables,with path address(for could not both) as- C:\Java\jdk1.7.0\bin. Is the error related to this path setting? John Jai Rancher Posts: 1776 posted 5 years ago Welcome to the Ranch I hope you tried like below java HelloWorld and if the HelloWorld.class file is in different location say C:/MyClasses then try, java -cp C:/MyClasses HelloWorld where -cp specifies the classpath ( location of the .class files) Saptaparna Dhar Greenhorn Posts: 10 posted 5 years ago Thank you The .class file and the .java flies could not find are n the same folder. John Jai Rancher Posts: 1776 posted 5 years ago Could you please post the code of HelloWorld. Also try java -cp . HelloWorld Saptaparna Dhar Greenhorn Posts: 10 posted 5 years ago With java-cp.HelloWorld I get the following error Unrecognized option:-cp.HelloWorld Error: Could not create the java virtual machine. Error: A fatal exception has occurred.Program will exit. yah...m pasting the program.. class HelloWorld { public static void main(String[] args) { System.out.println("Hello World!"); // Display the string. } } John Jai Rancher Posts: 1776 posted 5 years ago 1 There should be a space in the command you specify. java[space]-cp[space].[space]HelloWorld and please UseCodeTags henceforth Saptaparna Dhar Greenhorn Posts: 10 posted 5 years ago Thank you. I got the output--Hello world!. Do I need to type java -cp .