Please provide a way to pass variable value defined in build.xml to Java class
2 Answers
Your build process is one thing, your app running is another. You can't pass a build parameter to a class at runtime.
Perhaps a solution to your problem would be to write your parameter found in build.xml to manifest.mf, and then read it from there at runtime.
You can do it like this:
build.xml
<manifest file="MANIFEST.MF">
<attribute name="MyParameter" value="123"/>
</manifest>
And in your java file, take a look at the answer Reading my own Jar's Manifest.
1 Comment
user1201896
Thanks Marcelo, can you please elaborate your solution suggested
You will have to use an XML parser to do that. Read this for more info http://www.java-samples.com/showtutorial.php?tutorialid=152