installing Apache Ant 1.8.4 on centos - java

I want to install apache ant1.8.4 on my centos machine. I've read in the apache website but i didn't really understand how should i do tha. I didn't find the package on their website.
Is there any option to use the yum install command?

There may be a way of installing Ant as a package. On the Apache Ant website, you do it manually. The tarball or zip provided has the entire Ant package installed. It's not that difficult:
Unzip or untar it to a special directory like /opt. I install all third party stuff in /opt on my system. Everything in the zip or tarball will be under the apache-ant-1.8.4 directory, so Ant will be under /opt/apache-ant-1.8.4.
In your .profile, set $ANT_HOME to where Ant was installed (/opt/apache-ant-1.8.4 in the above example. Then, add $ANT_HOME/bin to your $PATH.
Or, my preference, symbolically link all programs under /opt/apache-ant-1.8.4/bin to the /usr/local/bin directory and put that directory in the front of your PATH. This allows you to put all specially installed executables in one directory that can be placed in your $PATH.
That's about it. If you have the Ant executable (It's a shell script on Unix/Linux/Mac, and a batch script called ant.bat on Windows) in your PATH, it should work.
You mentioned you didn't have the Java Development Kit (JDK) installed. This must be installed first since Ant is a Java program. There must be a CENTOS package for Java. If not, you can try http://java.com/en/download/manual.jsp to download Java on your system.

Assuming you already have jdk installed, you could do the following:
cd $HOME
wget http://archive.apache.org/dist/ant/binaries/apache-ant-1.9.2-bin.tar.gz
tar xvfvz apache-ant-1.9.2-bin.tar.gz
In .bash_profile, add the following line
ANT_HOME=$HOME/apache-ant-1.9.2
PATH=$PATH:$ANT_HOME/bin
. ./.bashrc_profile
ant -version ##you should see version of ant.
(updated to 1.9.2 for wget)

Related

Installer File in Maven Plugin that puts exe and jdk to C:\\Program Files

I need to execute a Java exe file. But this exe needs jdk. I want to create an installer that locates this exe and jdk to under C:\Program Files and creates shortcut for this exe.
installer:
|
---jdk-11
---exe
Note 1: I want to use a spesific version of JDK and users should not install a JRE in their own computer. Exe shoud use the one that located by installer.
Note 2: The tools that I can use are very districted since I want to achieve this in pom.xml by using Maven Plugins
I tried javapackager for creating msi but javapackager plugin expects a wix tool which is not avaiable in maven plugins.

elastic search + jdk

I am trying to write one web app with Ruby on Rails and using elasticsearch there for searching. I know that elastic search internally calls java api's and for that matter of the fact, it needs jdk to be installed on the machine. So, I downloaded java from official oracle website. File 'jdk-8u101-linux-x64.tar.gz' from "http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html".
After the completion of download, I extracted the files from the gz package as suggested by the official documentation but java is still not installed on my machine. I am sure that I am missing something but what?
Installation of the 64-bit JDK on Linux Platforms
This procedure installs the Java Development Kit (JDK) for 64-bit Linux, using an archive binary file (.tar.gz).
These instructions use the following file:
jdk-8uversion-linux-x64.tar.gz
Download the file.
Before the file can be downloaded, you must accept the license agreement. The archive binary can be installed by anyone (not only root users), in any location that you can write to. However, only the root user can install the JDK into the system location.
Change directory to the location where you would like the JDK to be installed, then move the .tar.gz archive binary to the current directory.
Unpack the tarball and install the JDK.
% tar zxvf jdk-8uversion-linux-x64.tar.gz
The Java Development Kit files are installed in a directory called jdk1.8.0_version in the current directory.
Delete the .tar.gz file if you want to save disk space.
Copy the full path to jdk1.8.0_version
Edit /etc/profile
Add export JAVA_HOME="paste there the path that you copied"
Add export PATH=$JAVA_HOME/bin:$PATH
Restart your terminal and rerun
You need to set the path where you have untar the jdk-8uversion-linux-x64.tar.gz file

New to java 1.8.0_73 - Javac command not recognized

When I try to compile a .java file, it says "Command javac not found."
I've done a fresh install of Java using an installer downloaded from their website. I've tried the solution on all of the other posts that says to check my path, but it already includes "C:\Program Files (x86)\Java\jre1.8.0_73\bin;" which contains which looks like a ton of utilities - except, there's no javac executable.
I searched my C drive with File Explorer, and couldn't find it anywhere. I've installed and reinstalled, so I think I might just be looking for the wrong thing to compile my programs. Please help!
You have installed the java jre. You need to install the jdk.
The jre (java runtime environment) contains the files needed to run java.
The jdk (java development kit) includes the jre and also all the development utilities.
Go to the download page, and select the jdk.
I had the same problem and with jdk-8u73-windows-i586.exe from the Oracle downloads page - it installed a JRE and no JDK. Solved the issue by downloading jdk-8u74-windows-x64.exe, which installed both a JRE and a JDK.

Open jar file using JRE on Mac

I have a jar file that is meant to be ran through the command line.
I am not planning to do any java development on the machines where the application will run and my thought process is that therefore I should only need the JRE and not the JDK. In addition, the JDK is like 4x as big as the JRE and I would like to not have to download it.
When installing the JRE on a Mac, it does not set the path for the java command and if I try to run it, osx prompts me to install the JDK.
I wonder if anyone could provide some insight as to how to use the java command in a mac without having the download the bigger sized JDK?
Thanks a lot.
Have you tried running this in terminal?
java -jar MyJarName.jar
However, you can also try and make a runnable application of the jar file. Take a look at Packaging a Java App for Distribution on a Mac
EDIT:
You can also try running your starter class from the terminal. cd to the bin folder of your project, then java packageName.className. For example, java my.package.Starter.

JAR file does not load class files from ext

I installed JDK 1.6 on my Linux system, the $JAVA _HOME directory is /usr/java/jdk1.6.0_07.
I built the path on Eclipse to $JAVA_HOME. It runs smoothly through Eclipse and loads all third party JAR files from /usr/java/jdk1.6.0_07/jre/lib/ext/, but when I export the JAR file and run it, it throws ClassNotFoundExecption.
Why?
Did you install Java properly? Here are some instruction for installing Java 7 or Java 6
Are you sure that the version of Java you are using is correct one since there can be several versions of java on linux? Try java -version on terminal where you run it to check.
Do you use any third party library? If so, did you specify the class path when you run the jar file or bundle them inside your jar file?
What does java -version return? Are you using the same JRE for execution?

Categories