简体   繁体   中英

Debugging Project in IntelliJ error: “could not find or load main class”

I can build my project fine but my debug configuration doesn't work. I've created a debug configuration with main class "edu.mit.csail.sdg.alloy4whole.SimpleGUI" and ant target "all" with the correct ant file. whenever the build completes I get the "Error: Could not find or load main class edu.mit.csail.sdg.alloy4whole.SimpleGUI"

build.xml

<project default="all">
  <target name="clean">
    <delete>
      <fileset dir="edu" includes="**/*.class"/>
    </delete>
    <delete dir="dist"/>
  </target>

  <target name="build">
    <javac srcdir="edu" debug="true" includeAntRuntime="false"/>
  </target>

  <target name="dist" depends="build">
    <mkdir dir="dist"/>
    <jar destfile="dist/alloy4.2.jar" basedir="." excludes="dist/**" manifest="META-INF/MANIFEST.MF"/>
    <jar destfile="dist/alloy4.2tests.jar" basedir="." excludes="dist/**" manifest="META-INF/MANIFESTTESTS.MF"/>
  </target>

  <target name="all" depends="dist"/>
</project>

META-INF/MANIFEST.MF:

Manifest-Version: 1.0
Created-By: 1.5.0 (Sun Microsystems Inc.)
Main-Class: edu.mit.csail.sdg.alloy4whole.SimpleGUI

Any ideas? Thanks!

Generally, the srcdir in ant is pointing to something like 'src' which is the root of the source folder, which then has the java packages. Your srcdir is pointing to the edu which may be part of your package structure. See if the compiled classes include 'edu' as part of the full name - instead of starting with mit.csail...

Plus check that the jars are being creating correctly, using the full package name for the class files.

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