How to detect whether tomcat and ant are installed on linux machine - linux

I am trying to install Tomcat and Ant on my linux machine, but before installing them i just need to check whether they are already installed or not.
Regarding tomcat:
I googled a lot and searched on my machine in the following directories for tomcat
/usr/local/, /opt/, /usr/share/
but i din't find tomcat folder in any of the above path, whether it indicates that tomcat is not installed ? so actually
1. what is the path to `look/find` exactly to know/check whether tomcat is installed or not in
all linux machines
2. what will be the path the tomcat will be installed exactly after installation
3. How to find the version of tomcat on any linux machine (if tomcat already installed)
4. Whether there are any commands to look for both whether `tomcat` installed and `ant`
installed
Regarding Ant:
I googled and got the below command due to which i got the below result after executing
it
sh-4.2$ ant -v
result
sh-4.2$ ant -v
Apache Ant(TM) version 1.8.2 compiled on November 21 2011
Trying the default build file: build.xml
Buildfile: build.xml does not exist!
Build failed
so actually
1. Does the above result mean that `Ant` is installed ? or not ?
2. what is the path to `look/find` exactly to know/check whether ant is installed or not in
all linux machines
3. what will be the path the `ant` will be installed exactly after installation
4. How to find the version of `Ant` on any linux machine (if Ant already installed)

Generally, you can check whether they are on the $PATH, if they are not on the $PATH, install one.
For ant:
ant -v stands for verbose, ant -version prints out its version.
-help, -h
print help on the command line options
-projecthelp, -p
gives information on possible targets for this project
-version
prints the version number and then exits ant
-quiet, -q
be extra quiet
-verbose, -v
be extra verbose
-debug, -d
print debugging information
-emacs, -e
produce logging information without adornments
-logfile <file>, -l <file>
use the given file to output log to
-logger <classname>
the class which is to perform logging
-listener <classname>
add an instance of the given class as a project listener
-noinput
do not allow interactive input
-buildfile <file>, -file <file>, -f <file>
use the given buildfile instead of the default build.xml file.
This is the ant equivalent of Makefile
-D<property>=<value>
use value for the given property
-keep-going, -k
execute all targets that do not depend on failed target(s)
-propertyfile <file>
load all properties from file with -D properties taking prece-
dence
-inputhandler <class>
the class which will handle input requests
-find <file>, -s <file>
(s)earch for buildfile towards the root of the filesystem and
use it
-nice number
A niceness value for the main thread: 1 (lowest) to 10 (high-
est); 5 is the default
-nouserlib
Run ant without using the jar files from ${user.home}/.ant/lib
-noclasspath
Run ant without using CLASSPATH
-autoproxy
Java 1.5+ : use the OS proxies
-main <class>
override ant's normal entry point
For tomcat:
if tomcat/bin is on the $PATH variable, version.sh will print out the version.

For linux ubuntu 18.04:
Go to terminal and command:$ sudo systemctl status tomcat
This command also show is tomcat running or not (if already installed)

Related

manually executing script on cygwin works but not remote

I am trying to figure out what exactly an issue is, below is the step i am trying :
on Windows 2019, installed cygwin64, directly from cygwin terminal, executing beloow "configure" script works fine, below is the configure command :
bash configure --with-freetype=bundled --with-tools-dir=/cygdrive/c/progra~2/micros~1/2017/Enterprise/VC/Tools/ --with-boot-jdk=/cygdrive/c/jdk-10.0.2/ --with-jtreg=/cygdrive/c/jtreg-5.1-b01/ --with-version-pre=sncmid --with-version-build=$build --with-version-opt=
However when i automate using jenkins which will execute on windows slave node, it is failing with this below
configure: Found potential Boot JDK using configure arguments
configure: Potential Boot JDK found at /cygdrive/c/jdk-10.0.2/ is incorrect JDK version (Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8); ignoring
configure: (Your Boot JDK version must be one of: 10 11)
configure: error: The path given by --with-boot-jdk does not contain a valid Boot JDK
configure exiting with result code 1
Wondering why the difference between "direct execute on cygwin works fine" and "from jenkins job" where i called using "c:\cygwin64\bin\bash.exe -l script.sh" this script.sh executes configure script.
Invocation of the script
c:\cygwin64\bin\bash.exe -l '%WORKSPACE%\script.sh' %BUILD_NUMBER% /cygdrive/c/openjdk11windows
content of script.sh:
#!/bin/bash
echo $1
build=$1
source ~/.bash_profile
source ~/.bashrc
bash configure --with-freetype=bundled --with-tools-dir=/cygdrive/c/progra~2/micros~1/2017/Enterprise/VC/Tools/ --with-boot-jdk=/cygdrive/c/jdk-10.0.2/ --with-jtreg=/cygdrive/c/jtreg-5.1-b01/ --with-version-pre=sncmid --with-version-build=$build --with-version-opt=
If any one has idea about this, please share.

Running xjc command for Java 11-works in git bash but not cygwin

Interesting issue. I'm working on a Java 11 upgrade and ran into a problem running XJC locally. As XJC is no longer part of the JDK I've downloaded our own XJC and the needed jaxb libraries. However, when I run it locally via Cygwin it errors stating that it 'Could not find or load main class com.sun.tools.xjc.XJCFacade'. After some debugging I pulled out the command being run which produces the error, but with a minor change it works in Git Bash. I'm trying to figure out why it works in Git Bash but not Cygwin (in Windows, as it works on my Linux VM), to maybe gain some insight into what to fix.
XJC works successfully on Linux VM (so I know the script is valid)
Command (listed below) works with Git Bash on Windows 10 with Java 11
Commands (listed further below) FAIL in Cygwin on Windows 10 with Java 11
Working Git command
/c/Programs/Amazon_Corretto/jdk11.0.5_10/bin/java -cp /c/Programs/jaxb-ri/lib/jaxb-xjc.jar:/c/Programs/jaxb-ri/lib/jakarta.xml.bind-api.jar:/c/Programs/jaxb-ri/lib/jaxb-impl.jar:/c/Programs/jaxb-ri/lib/jaxb-jxc.jar:/c/Programs/jaxb-ri/lib/jakarta.activation.jar com.sun.tools.xjc.XJCFacade -xmlschema /c/Development/Project_Folder/path/to/some/code/filename.xsd -d /c/Development/Project_Folder/path/to/some/code
Failed attempts with Cygwin
/cygdrive/c/Programs/Amazon_Corretto/jdk11.0.5_10/bin/java -cp /c/Programs/jaxb-ri/lib/jaxb-xjc.jar:/c/Programs/jaxb-ri/lib/jakarta.xml.bind-api.jar:/c/Programs/jaxb-ri/lib/jaxb-impl.jar:/c/Programs/jaxb-ri/lib/jaxb-jxc.jar:/c/Programs/jaxb-ri/lib/jakarta.activation.jar com.sun.tools.xjc.XJCFacade -xmlschema /c/Development/Project_Folder/path/to/some/code/filename.xsd -d /c/Development/Project_Folder/path/to/some/code
/cygdrive/c/Programs/Amazon_Corretto/jdk11.0.5_10/bin/java -cp /cygdrive/c/Programs/jaxb-ri/lib/jaxb-xjc.jar:/cygdrive/c/Programs/jaxb-ri/lib/jakarta.xml.bind-api.jar:/cygdrive/c/Programs/jaxb-ri/lib/jaxb-impl.jar:/cygdrive/c/Programs/jaxb-ri/lib/jaxb-jxc.jar:/cygdrive/c/Programs/jaxb-ri/lib/jakarta.activation.jar com.sun.tools.xjc.XJCFacade -xmlschema /cygdrive/c/Development/Project_Folder/path/to/some/code/filename.xsd -d /cygdrive/c/Development/Project_Folder/path/to/some/code
/cygdrive/c/Programs/Amazon_Corretto/jdk11.0.5_10/bin/java -cp /c/Programs/jaxb-ri/lib/jaxb-xjc.jar:/c/Programs/jaxb-ri/lib/jakarta.xml.bind-api.jar:/c/Programs/jaxb-ri/lib/jaxb-impl.jar:/c/Programs/jaxb-ri/lib/jaxb-jxc.jar:/c/Programs/jaxb-ri/lib/jakarta.activation.jar com.sun.tools.xjc.XJCFacade -xmlschema /cygdrive/c/Development/Project_Folder/path/to/some/code/filename.xsd -d /cygdrive/c/Development/Project_Folder/path/to/some/code
So I have identified the issue being the pathing format.
After alot of trial and error and some brainstorming I figured out the path for the jar files must be in Windows format with a semi-colon delimiter. Somehow during my trials I ended up using a Windows path with ':' delimiter, and later when I correctly used both Windows format and semi-colon delimiter I was using the 'cygpath -w' which is not needed.
So
"java -cp "C:\Program File\Path\jaxb-xjc.jar;C:\Program File\Path\jaxb-impl.jar..." com.sun.tools.xjc.XJCFacade.

How to get default installation directory for IBM MQ in linux and unix?

`I have used MQ_INSTALLATION_PATH in linux
when i execute above in the path /opt/mqm/bin via root it cannot display nothing but when i execute it in the path /opt/mqm/samp/bin it displays MQ_INSTALLATION_PATH .. before i should execute crtmqenv -p command
So what a solution to get installation path of IBM MQ?
MQ v7.1 and higher support multiple installations on the same server. The command setmqenv when sourced will setup some environment variables to allow you to use a specific installation. One of the variables that is set by setmqenv is $MQ_INSTALLATION_PATH. You can display the value of this variable with the command echo $MQ_INSTALLATION_PATH.
$ echo $MQ_INSTALLATION_PATH
/opt/mqm
If the installation has been setup as default using the setmqinst command, then various symlinks will be created under /usr/bin pointed back to the mq installation directory. You can display the installation directory by running the /usr/bin/dspmqver command and looking for InstPath in the output.
You can also directly call the command dspmqver -f 128 to have it return just the installation path:
InstPath: /opt/mqm
If the install is not setup as the default install and you do not know which directory MQ is installed in you can look at the /etc/opt/mqm/mqinst.ini file which will have a stanza for each installation on the server. The installation path is listed after FilePath= under each Installation stanza.
$ cat /etc/opt/mqm/mqinst.ini
Installation:
Name=Installation1
Description=
Identifier=1
FilePath=/opt/mqm

start-all.sh, start-dfs.sh command not found

I am using Ubuntu 16.04 LTS and installed hadoop 2.7.2. The Output of
hadoop version
is
Hadoop 2.7.2
Subversion https://git-wip-us.apache.org/repos/asf/hadoop.git -r b165c4fe8a74265c792ce23f546c64604acf0e41
Compiled by jenkins on 2016-01-26T00:08Z
Compiled with protoc 2.5.0
From source with checksum d0fda26633fa762bff87ec759ebe689c
This command was run using /usr/local/hadoop-2.7.2/share/hadoop/common/hadoop-common-2.7.2.jar
and when i run
whereis hadoop
it gives output as
hadoop: /usr/local/hadoop /usr/local/hadoop-2.7.2/bin/hadoop.cmd /usr/local/hadoop-2.7.2/bin/hadoop
But when i run command
start-all.sh
it says command not found.
also when i run
start-dfs.sh
it gives output as command not found.
I am able to run these command when i navigate to hadoop directory but i want to run these command without navigating into hadoop directory.
Your problem is that bash doesn't know where to look for ./start-all.sh.
You can fix this by opening $HOME/.bashrc and adding a line that looks like this:
PATH=$PATH:/usr/local/hadoop/sbin
This tells bash that it should look in '/usr/local/hadoop/sbin' for start-all.sh.
Note:
Changes to $HOME/.bashrc will not take affect in any terminals that are currently open.
If you need the changes to take affect in a terminal that is currently open, run
source $HOME/.bashrc
I had to search for it with find.
find / -iname start-all.sh 2> /dev/null
It found:
/usr/local/sbin/start-all.sh
/usr/local/Cellar/hadoop/3.3.4/libexec/sbin/start-all.sh
/usr/local/Cellar/hadoop/3.3.4/sbin/start-all.sh
So in addition to the previous answer, the variable in $HOME/.bashrc looks like this:
PATH=$PATH:/usr/local/sbin/
Note: I'm not sure which one should be set as PATH

ERROR: executing command 'ant' - After installation and setting ANT_HOME

After wrestling with my environment variables to get the proper directory set, I can now get the version with:
C:\Projects\TestProj>ant -version
Apache Ant(TM) version 1.8.4 compiled on May 22 2012
Ant appears to be working:
C:\Projects\TestProj>ant
Buildfile: build.xml does not exist!
Build failed
I still get the error when I try:
C:\Projects\TestProj>cordova -d platform add android
cordova library for "android" already exists. No need to download. Continuing.
Checking if platform "android" passes minimum requirements...
Creating android project...
Running command: C:\Users\Administrator\.cordova\lib\android\cordova\3.4.0\bin\c
reate.bat --cli C:\Projects\TestProj\platforms\android com.company.testproj
TestProj
C:\Users\Administrator\.cordova\lib\android\cordova\3.4.0\bin\node_modules\q\q.j
s:126
throw e;
^
Error: ERROR : executing command 'ant', make sure you have ant installed and add
ed to your path.
From all of the posts that I have read, this is an issue with ANT_HOME, but it appears I have that part of it tackled. Edit I've installed ant 1.9.3 to program files, and bin resides in:
EDIT Changed to just ant, instead of apache-ant-1.9.3-bin\apache-ant-1.9.3
C:\Program Files\ant
Echo home:
C:\Projects\TestProj>echo %ANT_HOME%
C:\Program Files\ant
And of course I have %ANT_HOME%\bin in my path. Any help identifying the issue would be appreciated.
I think the path you use for ANT_HOME is wrong. C:\Users\Administrator\AppData\Roaming\npm\node_modules\ant\ant seems to be the path to the ant npm module but not the ant command.
Ant command more probably is somewhere in program files. In a cmd, run where ant to know where in your path ant is found and use this path for ANT_HOME. (in the folder you should see ant, ant.cmd and ant.bat)
After further investigation, I think your problem is caused half by cordova not correctly checking node errors and half because of registry setting in your computer (a cmd autorun parameter).
You can check answers in those posts for more info:
nodejs child_process exec 'java -version'
Windows CMD.exe "The system cannot find the path specified."
Check if you have a registry key HKCU\Software\Microsoft\Command Processor\AutoRun
after setting the variables, restart your machine. Closing command prompt etc will not help.
Even I was stuck for quite a long time and next day when I started my system, it was working fine :P

Resources