Note that there are some explanatory texts on larger screens.

plurals
  1. POJava - Ant build (Eclipse) - Could not find the main class: nat.rutherford.DesktopStarter
    primarykey
    data
    text
    <p>I am having a little trouble with my first ever ant build in eclipse, here is my build.xml build file.</p> <pre><code>&lt;project name="Rutherford" default="dist" basedir="."&gt; &lt;description&gt; simple example build file &lt;/description&gt; &lt;!-- set global properties for this build --&gt; &lt;property name="src" location="src"/&gt; &lt;property name="build" location="build"/&gt; &lt;property name="dist" location="dist"/&gt; &lt;property name="libs" value="libs"/&gt; &lt;path id="classpath"&gt; &lt;fileset dir="${libs}" includes="**/*.jar"/&gt; &lt;/path&gt; &lt;target name="init"&gt; &lt;!-- Create the time stamp --&gt; &lt;tstamp/&gt; &lt;!-- Create the build directory structure used by compile --&gt; &lt;mkdir dir="${build}"/&gt; &lt;/target&gt; &lt;target name="compile" depends="init" description="compile the source " &gt; &lt;!-- Compile the java code from ${src} into ${build} --&gt; &lt;javac srcdir="${src}" destdir="${build}" classpathref="classpath"&gt; &lt;compilerarg line="-encoding utf-8"/&gt; &lt;/javac&gt; &lt;/target&gt; &lt;target name="dist" depends="compile" description="generate the distribution" &gt; &lt;!-- Create the distribution directory --&gt; &lt;mkdir dir="${dist}/lib"/&gt; &lt;!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar file --&gt; &lt;jar jarfile="${dist}/MyProject-${DSTAMP}.jar" basedir="${build}"&gt; &lt;manifest&gt; &lt;attribute name="Main-Class" value="nat.rutherford.DesktopStarter"/&gt; &lt;/manifest&gt; &lt;/jar&gt; &lt;/target&gt; &lt;target name="run"&gt; &lt;java jar="${dist}/MyProject-${DSTAMP}.jar" fork="true"/&gt; &lt;/target&gt; &lt;target name="clean" description="clean up" &gt; &lt;!-- Delete the ${build} and ${dist} directory trees --&gt; &lt;delete dir="${build}"/&gt; &lt;delete dir="${dist}"/&gt; &lt;/target&gt; &lt;/project&gt; </code></pre> <p>It compiles ok with no warnings or errors, but when I try to run the .jar it says 'Could not find the main class: nat.rutherford.DesktopStarter. Program will now exit' =(</p> <p>I have read a ton of pages on the matter but so far nothing conclusive.</p> <p>I was able to compile it using Eclipse -> File -> Export ->Java -> Runnable Jar File. But I use some UTF-8 encoded .txt files that it seems not to be able to deal with that way and I need them! ie I have greek characters that should read...dσ/dΩ... but currently read... dÃ/d©... which isn't going to work ^^</p> <p>So basically I need to make my Ant build work, baring in mind that it needs to be able to handle my UTF-8 encoded .txt files too.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload