У меня небольшие проблемы с моей первой сборкой муравья в eclipse, вот мой файл сборки build.xml.
<project name="Rutherford" default="dist" basedir=".">
<description>
simple example build file
</description>
<!-- set global properties for this build -->
<property name="src" location="src"/>
<property name="build" location="build"/>
<property name="dist" location="dist"/>
<property name="libs" value="libs"/>
<path id="classpath">
<fileset dir="${libs}" includes="**/*.jar"/>
</path>
<target name="init">
<!-- Create the time stamp -->
<tstamp/>
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build}"/>
</target>
<target name="compile" depends="init"
description="compile the source " >
<!-- Compile the java code from ${src} into ${build} -->
<javac srcdir="${src}" destdir="${build}" classpathref="classpath">
<compilerarg line="-encoding utf-8"/>
</javac>
</target>
<target name="dist" depends="compile"
description="generate the distribution" >
<!-- Create the distribution directory -->
<mkdir dir="${dist}/lib"/>
<!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar file -->
<jar jarfile="${dist}/MyProject-${DSTAMP}.jar" basedir="${build}">
<manifest>
<attribute name="Main-Class" value="nat.rutherford.DesktopStarter"/>
</manifest>
</jar>
</target>
<target name="run">
<java jar="${dist}/MyProject-${DSTAMP}.jar" fork="true"/>
</target>
<target name="clean"
description="clean up" >
<!-- Delete the ${build} and ${dist} directory trees -->
<delete dir="${build}"/>
<delete dir="${dist}"/>
</target>
</project>
Он компилируется нормально без предупреждений или ошибок, но когда я пытаюсьзапустите .jar, он говорит: «Не удалось найти основной класс: nat.rutherford.DesktopStarter.Теперь программа завершит работу '= (
Я прочитал тонну страниц по этому вопросу, но пока что нет ничего окончательного.
Мне удалось скомпилировать его с помощью Eclipse -> File -> Export -> Java -> Runnable Jar File. Но я использую некоторые TXT-файлы в кодировке UTF-8, которые, кажется, не в состоянии справиться с этим, и мне они нужны! Т.е. у меня есть греческие символы, которые должны читать ... dσ / dΩ... но сейчас читаю ... dà / d © ... что не сработает ^^
Так что, в принципе, мне нужно, чтобы моя сборка Ant работала, учитывая, что она должна бытьвозможность обрабатывать мои .txt файлы в кодировке UTF-8.