You need BCEL.  See here for details:

        http://ant.apache.org/manual/install.html


On Jan 21, 2005, at 1:48 PM, michael sorens wrote:

The errors I showed are from -debug. Without it it just says "IOException". Everything else looks reasonable.
Yes, ${javabin} is set. I get a different error if the file is not found.


On Fri, 21 Jan 2005 17:47:53 +0100, <[EMAIL PROTECTED]> wrote:

- what does "-debug" say?
- is ${javabin} set?

Jan

-----Ursprüngliche Nachricht-----
Von: michael sorens [mailto:[EMAIL PROTECTED]
Gesendet am: Freitag, 21. Januar 2005 17:45
An: Ant Users List
Betreff: Re: ant access of java constants

I tried adding this chunk of code:
<loadproperties
srcfile="${javabin}/com/cleancode/data/Diagnostic.class">
   <filterchain>
     <classconstants/>
   </filterchain>
</loadproperties>

but received this error:

C:\usr\ms\devel\cleancode-support\build.xml:100: Unable to
load file: java.io.IOException
         at
org.apache.tools.ant.taskdefs.LoadProperties.execute(LoadPrope
rties.java:225)
         at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
         at org.apache.tools.ant.Task.perform(Task.java:364)
         at org.apache.tools.ant.Target.execute(Target.java:341)
         at org.apache.tools.ant.Target.performTasks(Target.java:369)
         at
org.apache.tools.ant.Project.executeTarget(Project.java:1214)
         at
org.apache.tools.ant.Project.executeTargets(Project.java:1062)
         . . .
--- Nested Exception ---
java.io.IOException
         at
org.apache.tools.ant.filters.ClassConstants.read(ClassConstant
s.java:136)
         at
org.apache.tools.ant.filters.BaseFilterReader.read(BaseFilterR
eader.java:86)
         at java.io.Reader.read(Reader.java:100)
         at
org.apache.tools.ant.util.FileUtils.readFully(FileUtils.java:1126)
         at
org.apache.tools.ant.filters.util.ChainReaderHelper.readFully(
ChainReaderHelper.java:231)
         at
org.apache.tools.ant.taskdefs.LoadProperties.execute(LoadPrope
rties.java:202)
         at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
         . . .

Any thoughts?


On Fri, 21 Jan 2005 05:16:27 -0500, Erik Hatcher <[EMAIL PROTECTED]> wrote:

> And even easier, you can do it with the ClassConstants
FilterReader! :)
>
>
http://ant.apache.org/manual/CoreTypes/ filterchain.html#classconstants
>
>
> On Jan 21, 2005, at 2:53 AM, [EMAIL PROTECTED] wrote:
>
>> You can do that via API calls
>> - your own task
>> - <script>
>> But you have to ensure that the class can be found.
>>
>> Example:
>> --------
>> public class MyClass {
>> public static final String TEXT = "MyClass sais: Hello World";
>> }
>>
>> <project>
>> <script language="javascript">
>> importClass(Packages.MyClass);
>> project.setNewProperty("out", MyClass.TEXT);
>> </script>
>> <echo>OUTPUT: ${out}</echo>
>> </project>
>>
>> $ ant -lib .
>>
>>
>> Jan
>>
>>
>>> -----Ursprüngliche Nachricht-----
>>> Von: michael sorens [mailto:[EMAIL PROTECTED]
>>> Gesendet am: Freitag, 21. Januar 2005 02:24
>>> An: user@ant.apache.org
>>> Betreff: ant access of java constants
>>>
>>> Is it possible to set an ant property to a value that is a
>>> static constant from a Java class file?
>>> Example:
>>>
>>> public class Stuff {
>>> . . .
>>> static final int FOOBAR=42;
>>> . . .
>>> }
>>>
>>> Access with something like this...?
>>>
>>> <property name="foobar" value=???? Stuff.FOOBAR />
>>>
>>> Or more generally, could one set a property to the value of a
>>> static method?
>>>
>>>
---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to