ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hungry Snail <centuri...@hotmail.com>
Subject Re: cannot find symbol
Date Mon, 15 Jun 2009 17:03:31 GMT

Hi David,

Many thanks for the reply.

I am using a script that someone sent me, this is the first time I have ever
attempted to compile anything :).

<path id="classpath">
	<fileset dir="${lib_dir}">
		<include name="*.jar" />
	</fileset>
	<pathelement path="${java.class.path}" />
 </path>	

This is what is in the build.xml

by looking at that I am guessing that the class path isnt actually defined?

Regards


David Weintraub wrote:
> 
> This isn't an Ant error as much as a "javac" command error. What you're
> being told is that a particular program is trying to resolve a symbol, but
> can't find the reference to that symbol. For example, these particular
> classes are defined in a jarfile called something like
> org.eclipse.swt.<shell>.<OS>_<version>.jar which lives in your Eclipse
> installation. On my system it is called
> org.eclipse.swt.gtk.linux.x86_64_3.4.1.v3449c.jar. On a Windows system, it
> might be org.eclipse.swt.win32.win32.x86_3.3.0.v3346.jar.
> 
> When you run the <javac> task, you must make sure this jarfile is in the
> classpath.
> 
> There are multiple ways of setting the classpath when you compile using
> the
> <javac> command. One is to set the "classpath" parameter itself. Another
> is
> to use a "reference" to set the classpath, and then use the classpathref
> parameter. This is nicer since it gives you a bit more flexibility. Here
> I'm
> defining a classpath called "class.path":
> 
> <path id="class.path">
>    <fileset dir="${basedir}/lib">
>        <include name="**/*.jar"/>
>    </fileset>
>    <pathelement file="${some.other.jar.file.I.need"/>
> </path>
> 
> Now, you can add and subtract jarfiles your build depends upon by simply
> adding them to the ${basedir}/lib directory. You no longer have to modify
> your build.xml file every time someone adds a new jarfile dependency. You
> can compile like this:
> 
> <javac
>   srcdir="${src.dir}"
>   dest="${target.dir}/classes"
>   *classpathref="class.path"*/>
> 
> Now, you're referencing the path "class.path" as your classpath for your
> "javac" command.
> 
> Another way is to use a sub-task:
> 
> <javac
>   srcdir="${src.dir}"
>   destdir="${target.dir}/classes">
> * <classpath>**
>     <fileset dir="${basedir}/lib">
>          <include name="**/*.jar"/>
>     </fileset>
>      <path refid="class.path2"/>
>      <pathelement file="${some.other.jar.file.I.need"/>
>   </classpath>*
> </javac>
> 
> This allows you to build more complex classpaths that might be possible
> with
> a single reference. Notice that I am using fileset, pathelement, and even
> a
> reference to a previously defined path called "class.path2".
> 
> How do you compile  your code now? Are you using a script? If so, what is
> the classpath used by the javac command in your script? That'll help you
> understand what should be in your classpath when you run <javac>.
> 
> On Mon, Jun 15, 2009 at 7:44 AM, Hungry Snail <centurion3@hotmail.com>
> wrote:
>>
>> Hi People.
>>
>> I am trying to compile some files with ant but am getting the following
>> errors.
>>
>>  [javac] D:\Stats\src\org\selectbf\gui\ConfigurationDialog.java:32:
> package
>> org.eclipse.swt.widgets does not exist
>>  [javac] import org.eclipse.swt.widgets.Text;
>>  [javac]                                ^
>>  [javac] D:\Stats\src\org\selectbf\gui\ConfigurationDialog.java:50:
> package
>> org.eclipse.swt.widgets does not exist
>>  [javac] public class ConfigurationDialog extends
>> org.eclipse.swt.widgets.Dialog
>>  [javac]                                                                
>> ^
>>  [javac] D:\Stats\src\org\selectbf\gui\ConfigurationDialog.java:53:
>> cannot
>> find symbol
>>  [javac] symbol  : class Shell
>>  [javac] location: class org.selectbf.gui.ConfigurationDialog
>>  [javac]     private Shell dialogShell;
>>  [javac]             ^
>>  [javac] D:\Stats\src\org\selectbf\gui\ConfigurationDialog.java:54:
>> cannot
>> find symbol
>>  [javac] symbol  : class TabItem
>>  [javac] location: class org.selectbf.gui.ConfigurationDialog
>>  [javac]     private TabItem generalTabItem;
>>
>> In total there are 100 of these errors :-o.
>>
>> As I have never used ant before, is there anything I can do to fix this?
>>
>> Thanks in advance.
>> --
>> View this message in context:
> http://www.nabble.com/cannot-find-symbol-tp24033173p24033173.html
>> Sent from the Ant - Users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>> For additional commands, e-mail: user-help@ant.apache.org
>>
> 
> 
> 
> --
> David Weintraub
> qazwart@gmail.com
> 
> 

-- 
View this message in context: http://www.nabble.com/cannot-find-symbol-tp24033173p24038655.html
Sent from the Ant - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message