I've dealt with errors like this in Eclipse before, but I have no idea why I'm getting it this time. I have the Apache Commons IO library in my Build Path as well as in my "lib" folder.
I've given the error below. It's pretty straightforward.
[javac] Compiling 3 source files to C:\Users\Justian\workspaces\ConnectionCompiler\build
[javac] C:\Users\Justian\workspaces\ConnectionCompiler\src\jab\jm\readers\ExcelReader.java:5: package org.apache.commons.io does not exist
[javac] import org.apache.commons.io.FileUtils;
[javac] ^
[javac] C:\Users\Justian\workspaces\ConnectionCompiler\src\jab\jm\readers\FileManager.java:5: package org.apache.commons.io does not exist
[javac] import org.apache.commons.io.FileUtils;
[javac] ^
[javac] C:\Users\Justian\workspaces\ConnectionCompiler\src\jab\jm\readers\FileManager.java:12: cannot find symbol
[javac] symbol : variable FileUtils
[javac] location: class jab.jm.readers.FileManager
[javac] return FileUtils.convertFileCollectionToFileArray(FileUtils.listFiles(
[javac] ^
[javac] C:\Users\Justian\workspaces\ConnectionCompiler\src\jab\jm\readers\FileManager.java:12: cannot find symbol
[javac] symbol : variable FileUtils
[javac] location: class jab.jm.readers.FileManager
[javac] return FileUtils.convertFileCollectionToFileArray(FileUtils.listFiles(
[javac] ^
[javac] 4 errors
Why can't it import the class? It's even suggested that I add that specific one with Eclipse's auto-correct.
Many thanks!
Justian
EDIT:
Oh. Sorry. Been working on multiple things at once. Of course this would be an Ant issue.
Ok. Here's my build file. What's interesting is that this has worked in the past. Why would it not work now?
<?xml version="1.0" ?>
<project name="ServerJar" default="dist" basedir=".">
<description>
Builds client files into .jar
</description>
<!-- [build variables] -->
<property name="src" location="src" />
<property name="build" location="build" />
<property name="dist" location="dist" />
<target name="init">
<!-- makes time stamp to be used in jar name -->
<tstamp />
<!-- creates build directory structure -->
<mkdir dir="${build}" />
</target>
<target name="compile" depends="init" description="Compiles the source">
<!-- compiles the java code from ${src} into ${build} -->
<javac srcdir="${src}" destdir="${build}" />
</target>
<target name="dist" depends="compile" description="Generates distributable">
<!-- creates the distribution directory -->
<mkdir dir="${dist}/lib" />
<!-- puts everything in ${build} into the jar file -->
<jar jarfile="${dist}/lib/CC-${DSTAMP}.jar" basedir="${build}">
<manifest>
<attribute name="Main-Class" value="jab.jm.Test" />
</manifest>
</jar>
<!-- makes a jar file for quick test execution -->
<jar jarfile="${dist}/lib/CC.jar" basedir="${build}">
<manifest>
<attribute name="Main-Class" value="jab.jm.Test" />
</manifest>
</jar>
</target>
<target name="clean" description="Cleans up the extra build files">
<!-- deletes the ${build} and ${dist} directories -->
<delete dir="${build}" />
<delete dir="${dist}" />
</target>
</project>
EDIT: For anyone who has this problem in the future, here was my final build file:
<?xml version="1.0" ?>
<project name="ServerJar" default="dist" basedir=".">
<description>
Builds client files into .jar
</description>
<!-- [build variables] -->
<property name="src" location="src" />
<property name="build" location="build" />
<property name="dist" location="dist" />
<property name="lib" location="lib" />
<!-- [path to packages] -->
<path id="master-classpath">
<fileset dir="${lib}">
<include name="*.jar"/>
</fileset>
</path>
<target name="init">
<!-- makes time stamp to be used in jar name -->
<tstamp />
<!-- creates build directory structure -->
<mkdir dir="${build}" />
</target>
<target name="compile" depends="init" description="Compiles the source">
<!-- compiles the java code from ${src} into ${build} -->
<!-- <javac srcdir="${src}" destdir="${build}" /> -->
<javac destdir= "${build}">
<src path="${src}"/>
<classpath refid="master-classpath"/>
</javac>
</target>
<target name="dist" depends="compile" description="Generates distributable">
<!-- creates the distribution directory -->
<mkdir dir="${dist}/lib" />
<!-- puts everything in ${build} into the jar file -->
<jar jarfile="${dist}/lib/CC-${DSTAMP}.jar" basedir="${build}">
<manifest>
<attribute name="Main-Class" value="jab.jm.Test" />
</manifest>
</jar>
<!-- makes a jar file for quick test execution -->
<jar jarfile="${dist}/lib/CC.jar" basedir="${build}">
<manifest>
<attribute name="Main-Class" value="jab.jm.Test" />
</manifest>
</jar>
</target>
<target name="clean" description="Cleans up the extra build files">
<!-- deletes the ${build} and ${dist} directories -->
<delete dir="${build}" />
<delete dir="${dist}" />
</target>
</project>