简体   繁体   中英

Could not find or load main

Googling for hours now and no solution seems to hint at what the problem might be, I have tried them all and they do not work. The problem is that I have a project (Eclipse project) up on github, I am on another computer right now trying to work on my project. I imported it, got the branch, but when I run the project I get a Error: Could not find or load main class engine.Game

No idea what could be wrong, aside from this computer lacking JRE7, but I just downloaded that to a folder and added it to the library of this build. Another library I had added used a fixed file reference C:/... but I fixed that by making it point to the jar inside the eclipse project.

I always up .classpath and .project to git and it has always worked before, except for today.

I think the problem is that the JVM tries to run the file from inside the folder that contains JRE7, but that is not where my project is. I just noticed the console header reads:

<terminated> Game [Java Application] /home/USER/Desktop/jre1.7.0_17/bin/java

For the request below of posting classpath and about the bin folder: The bin is completely empty but no wonder since main cannot be found.

classpath

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="info"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="libs"/>
<classpathentry kind="src" path="res"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="lib" path="/home/aryann/git/KLT/libs/JOrbis.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>

project

  <?xml version="1.0" encoding="UTF-8"?>
  <projectDescription>
<name>KLT</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
    <buildCommand>
        <name>org.eclipse.jdt.core.javabuilder</name>
        <arguments>
        </arguments>
    </buildCommand>
</buildSpec>
<natures>
    <nature>org.eclipse.jdt.core.javanature</nature>
</natures>
    </projectDescription> 

There are many possibilities for what's wrong. First make sure that there is actually a .class file in your bin folder. And then make sure that the bin folder is really on your runtime classpath.

If this doesn't work, please attach your .classpath and .project files here.

I should have posted this earlier. Apparently the problem was that I had used an external jar library which the code could not find, fixed by adding it, this time as a relative path library (internal).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM