Ant installation [duplicate] - ant

This question already has answers here:
Error installing Ant: ANT_HOME is set incorrectly
(31 answers)
Closed 8 years ago.
When I am running ant command its showing the following output:
ANT_HOME is set incorrectly or ant could not be located. Please set ANT_HOME.

ANT_HOME is is an environment variable which can be set temporary for a command line instance (window) by calling SET. Example:
SET ANT_HOME="C:\Program Files\Apache-Ant"
For permanently setting an environment variable open the Control Panel and open System. On the tab Advanced you should find a button named Environment Variables

Related

EJBCA on Docker: use environmental variables in .properties files

I am trying to configure EJBCA 6.15.2.1 on Wildfly 12.0.0.Final inside a Docker container with the help of EJBCA .properties files. In $EJBCA_HOME/conf/externalra-gui.properties.sample there is a comment showing that one of the default settings is: appserver.home=${env.APPSRV_HOME}. I tried to set other options in a similar way, e. g. in database.properties: database.datasource=${env.WF_DATASRC}.
I run ant clean deployear and it didn't deploy my EJBCA instance properly at first - server.log showed that there is no datasource under the name "${env.WF_DATASRC}". It proceeded correctly after I'd changed the line to: database.datasource=ejbcads, which is the exact value of the variable and the name of the data source inside the WildFly server.
I get similar errors during further installation steps. Is there another way of setting EJBCA configuration using environment variables?

can't set path for javac

I've put in an embarrassing amount of time reading threads here and elsewhere, I cannot compile HelloWorldApp.java
Using Windows 7
the location of the script is C:\Users\Phil\Desktop
the location of javac is C:\Program Files\Java\jdk1.8.0_77\bin
In Environment Variables, in both User and System Variables, I have clicked NEW, and given the "Variable Name" as javac and "Variable Value" as `
C:\Program Files\Java\jdk1.8.0_77\bin;
`
I have tried to make this work based on the 2 different ways here (to no avail): https://docs.oracle.com/javase/tutorial/getStarted/problems/
I am failing to set a path, or tell computer where to find it from within cmd. What am I doing wrong?
just you have to do set temporary path set path=C:\Program Files\Java\jdk1.7.0_45;
or
change your Environment variable path
to
variable name=%path%
variable value:\Program Files\Java\jdk1.7.0_45;
then open cmd and run javac command to check
Okay, so I have solved my problem:
In Environment Variables, the "Variable Name" must be: PATH
The Variable value is: C:\Program Files\Java\jdk1.8.0_77\bin
Now It works!

Apache-ant not compiling [duplicate]

This question already has answers here:
Error installing Ant: ANT_HOME is set incorrectly
(31 answers)
Closed 8 years ago.
I have set my ANT_HOME to appropriate path but while doing an Ant Compile it says ANT_HOME is set incorrectly or cannot be located.
I was able to do an Ant Compile before with the same system variables
can anyone suggest to set ANT_HOME through command line
Got it,I was setting ANT_HOME to the parent directory \bin. I corrected it and it's working now.
In ANT_HOME variable set the path till c:/apache
and in path environment variable set the path=c:/apache/bin
This has solved the issue.

MacBook OS X 10.8.2 ant unable to find custom environment variables

When I run targets on ant it says it is unable to locate the variable I passed to it.
Config for environment variables :
in build.xml
<property environment="Env"/>
but I am unable to find the parameter defined parameter with
${Env.CATALINA_HOME}
where in the .bash_profile
export CATALINA_HOME=/Users/olgunkaya/development/apache-tomcat-7.0.34
and export PATH=${PATH}:$CATALINA_HOME
What can I do to achive this ?
Before you run ant, check to see if CATALINA_HOME is actually defined as an environment variable. I bet you'll find it isn't. Ant doesn't read your .profile or .bash_profile before starting, so if it's not already defined in your environment, Ant won't see it.
As you've seen opening a terminal window on a Mac doesn't necessarily guarantee that the .bash_profile file is executed. Try setting up these environment variables in .bashrc file instead.
Or, you can force .bash_profile to run by setting it as the Startup file in Terminal. Select File->Preferences from the menu, go to the Shell tab, select your default shell, and then click the Run Command checkbox and put .bash_profile in there. That will guarantee that .bash_profile is executed with each new terminal window.
I had a similar problem when referencing a custom variable, which was definitely defined in the shell spawning ant.
The solution was to EXPORT the variable when defined (in ~/.profile), so the shell would pass it to its children.

How to set Environment variables using Ant

It looks like this question has been asked many times. I searched but I could not get the answer
I am looking for techniques on how to set environment variables in Windows system using Ant
I have around 10 environment variables that needs to be set before I can start the compile using Ant
I am running on Windows system.
any help would be appreciated
Thank you,
Karthik
There is no way to set environment variables through Ant.
The property task can only be used for getting the value of an already set environment variable.
You would need to call Ant's exec task and pass the command line (for your operating system) to set the value of an environment variable.

Resources