The jenkins service does not start when ever i run jenkins service start . It says
Starting Jenkins bash: /usr/bin/java: No such file or directory
[FAILED]
I have java installed at /usr/lib/jvm/jdk1.7.0_51. The JAVA_HOME variable is also set. Also tried adding this java to /etc/init.d/jenkins file. I need to use the sun jdk, not open jdk.
Tried some of the alternatives from stackoverflow as well but did not work out.
Any suggestions will be of great help.
Thanks,
Bhargav
Thanks Paul. The script inside /etc/sysconfig/jenkins needs to be edited. Else it uses the default java.
JENKINS_JAVA_CMD="path of java installation"
Along with the above script, one can make changes to /etc/init.d/jenkins file if needed to add the path of java installation in your system.
I'd guess that there's a script that has /usr/bin/java hardcoded. When you find the culprit, remove the /usr/bin so that it uses the default. Or you can change it to use the JAVA_HOME path, something like this:
JAVA_EXECUTABLE=$JAVA_HOME/bin/java
$JAVA_EXECUTABLE $JAVA_OPTS etc.. etc..
Related
Note: My OS Debian 7, Java 8, 2Gb RAM
Here is what I did:
I went this way: /etc/default/
Then: vim jenkins
Then edit: JAVA_ARGS="-Xmx1048m"
I exit from editor with saving: :wq
Now I make do: service jenkins restart
Now I go to my Jenkins and watching monitoring with plugin JavaMelody.
So, I see that no changes have occurred.
I ask for help in this case, please.
From the official guide, if you're using RedHat Linux based distributions, you should use JENKINS_JAVA_OPTIONS.
JENKINS_JAVA_OPTIONS="-Xmx1048m"
Note: For me, the file location was /etc/sysconfig/jenkins and it only had JENKINS_ARGS="". Assigning Xmx value to it did not work. You should leave that entry as is and instead, add the JENKINS_JAVA_OPTIONS entry in the file just like i specified above.
The problem is resolved and I did the following:
I went this way: /etc/default/
Then: vim jenkins
I'm add in jenkins JAVA=/usr/bin/java
and JAVA_ARGS="-Djava.awt.headless=true -Xmx1024m"
I exit from editor with saving: :wq
Then after I made: service jenkins restart
Now I go to my Jenkins and watching monitoring with plugin JavaMelody.
So, I see that this works for me.
I'm hope this helps someone.
I am trying to compile some java code on Windows 7 pc, I have installed java JDK and I am trying to use the javac command in cmd but I get output saying that
'javac' is not recognized as an internal or external command,
operable program or batch file.
What do I have to do to enable compiler in cmd or is it possible to do in Windows?
1)Go to properties by right click on icon Computer , then navigate to Advanced System Settings.
2)Click Environment Variables.
3)Click on New , set Variable name as path and Variable path as the path of java jdk installation directory which could be something like this -
C:\Program Files\Java\jdk1.6.0_23\bin;
where C:** is the drive where JDK is installed and **Program Files\java is the directory where it resides.
look out for semi-colon(;) at the last.
4)Click ok
5)Restart cmd and run javac , it should work now.
Look for Screenshots here for more help.
Regards
Anshul
you have to set a new system variable for your JAVA_HOME in windows.
See here for further information.
Add the path to bin folder of JDK in your PATH variable. For instructions to set PATH variable follow this tutorial.
Your java directory is not on the path. Here are some helpful screenshots to show how to set it up:
http://vietpad.sourceforge.net/javaonwindows.html
I'm ask/answering this question because it hung me up & it's likely someone else will have the same problem.
Install of RabbitMQ x64 v2.8.6 on Windows Server 2008 x64.
After Erlang install using default install location to C:\Program Files\erl5.9.2, I'm attempting to start the server via running the rabbitmq-service.bat. Fail:
Please either set ERLANG_HOME to point to your Erlang installation
or place the RabbitMQ server distribution in the Erlang lib folder.
Problem is the .bat file does not have the correct subpath. with 5.9.2 (R15B02) version of erlang. My ERLANG_HOME directory is set correctly, but the script does not use it correctly for this version of Erlang, which, it appears to this Erlang noob to have a new subdirectory called "erts-5.9.2" which is causing the problems. Maybe someone intimate with these scripts can describe how to make this work correctly without the hack workaround I'm about to describe?
1- Set environment variable:
Variable name : ERLANG_HOME
Variable value: C:\Program Files (x86)\erl6.4
note: don't include bin on above step.
2- Add %ERLANG_HOME%\bin to the PATH environmental variable:
Variable name : PATH
Variable value: %ERLANG_HOME%\bin
This works well.
There are several RabbitMQ control .bat files on windows. Every one you use needs to get changed to reflect the Erlang path correctly. In this example, I'm editing the rabbitmq-server.bat because it's one of the easier ones... any of the .bat files you want to run will need this hack to get them to work, with the rabbitmq_service.bat file being the most involved to adjust.
editing that rabbitmq_server.bat file, you can see on about line 48 or so there's a check to see if the erl.exe is found, but the path isn't correct:
if not exist "!ERLANG_HOME!\bin\erl.exe" (
that path does not match the file structure for the 5.9.2 version of Erlang. I fixed this by simply removing this path check from about line 48 to 58, then, where the .bat actually makes a call to the erl.exe on about line 129 which reads:
"!ERLANG_HOME!\bin\erl.exe"
I simply hardcoded the path to my erl.exe:
"C:\Program Files\erl5.9.2\erts-5.9.2\bin\erl.exe"
With the pathing correct, the rabbitmq .bat files will run.
I had the similar issue, modifying ERLANG_HOME in .bat files did not work. Then I tried echo %ERLANG_HOME% in command prompt, that did not print the environment variable value(I could see that ERLANG_HOME environment variable has been created under advance system settings), that lead me to believe that I need to restart server for 64 bit installation of Erlang. After rebooting server, It worked like a charm. I hope this helps someone.
Just to share an up-to-date answer as of 2019: On Windows Server 2019, after setting up the environment variable, a restart is required to solve the problem.
I got into same kind of problem.
I solved it by doing three changes as given below.
Update Path variable "ERLANG_HOME" : "C:\Program Files\erl8.0" in Environment Variables.
Upadte "Path" variable "Path" : ";%ERLANG_HOME%\bin;"
Give urself FULL CONTROL permissions over "Program Files" in C drive.
It worked for me in this way.
This problem still occurs in Erlang 18.3 (erl7.3) and RabbitMQ 3.6.9 on Windows when upgrading from any older version of RabbitMQ to version 3.6.9. The solution as already stated here is to manually set ERLANG_HOME with 'setx -m ERLANG_HOME "C:\Program Files\erl7.3"' before starting the service.
What happens is that the RabbitMQ 3.6.9 installer removes the environment variable ERLANG_HOME from the system while removing the older version of RabbitMQ. Then, when it proceeds to the installation step, it does not put back the ERLANG_HOME variable. Then, the batch files that start up RabbitMQ cannot find Erlang. They try to find Erlang's home directory using "where.exe" but it always fails after an upgrade.
RabbitMQ's installer also does not kill all of the Erlang background processes, causing many of its files to be undeletable due to the Windows "file in use" problem. This leaves behind "files in use" in %APPDATA%\RabbitMQ and "C:\Program Files\RabbitMQ." These processes are "erl.exe," "erlsrv.exe," and "epmd.exe." The RabbitMQ installer should taskkill these processes after shutting down the RabbitMQ Windows service.
RabbitMQ is rather clunky on Windows.
Download Erlang or OTP - Only one Version of OTP should be installed
Download RabbitMQ installer
Install both exe file as Administrator
Set class path for Erlang. (Setting classpath is a bit troublesome, so follow these steps)
Set a new path with name ERLANG_HOME and value C:\Program Files\erl-23.1 (do not copy bin folder here)
Edit System "path" and add %ERLANG_HOME%\bin
Go to Start - Open rabbitmq command promt and run
rabbitmq-plugins enable rabbitmq_management
Navigate to localhost:15672
Use guest/guest to login
Interesting that this worked for you. There is record of a two bugs in Erl5.9.2 that cause an incomplete installation where %ERLANG_HOME%\bin is not installed.
Either of
* Installed 64bit erlang on 32bit machine
* "The program can't start because MSVCR100.dll is missing from your computer."
https://groups.google.com/d/topic/erlang-programming/wGtFLzapiQ0/discussion
Try 5.9.1 or any other version. They also mention making the future versions of the installer alert you if it fails.
I just had the same problem mentioned here. I installed otp_win64_R15B02 on a Windows 7 machine and everything worked perfectly, but I used the same installer on a Windows 2008 server and the bin directory was not created. I then uninstalled otp_win64_R15B02 and downloaded the otp_win64_R15B02_with_MSVCR100_installer_fix and the bin directory was created.
I suspect the reason it worked on my Windows 7 system is that I have Visual Studio installed and the required libraries were already available which allowed the otp_win64_R15B02 installer to work correctly.
Oh, and if you're installing Erlang to run RabbitMQ the RabbitMQ install will succeed with the broken installer but installing otp_win64_R15B02_with_MSVCR100_installer_fix after RabbitMQ will not work, just un-install and re-install RabbitMQ to resolve this.
Just give C:\Program Files\erl10.6\ not C:\Program Files\erl10.6\bin\erl.exe in the environment variable. If you open the server.bat file I came to know the issueenter image description here
I think this is encoding issue on windows.I see a correct value but I write echo %ERLANG_HOME% on console the value come with question mark. These steps fix it.
1.go environment variable window
2.edit ERLANG_HOME item
3.copy the value, open notepad and paste there
4.copy again on notepad and paste to edit window
5.apply and exit window
6.close command line tools and reopen
7.run rabbitmq bat file.
I solved it in a quick and dirty way,without naming path variables
I've opened the bat file and replaced every occurrence of
!ERLANG_HOME!\bin\erl.exe
with hard coded path for example might be diffrent path for you because of diffrent version
C:\Program Files\erl10.3\erts-10.3\bin\erl.exe
and replaced
%RABBITMQ_HOME%\escript\rabbitmq-plugins
with
C:\Program Files\RabbitMQ Server\rabbitmq_server-3.7.14\escript\rabbitmq-plugins
Even I was this problem. The issue was the environment variable ERLANG_HOME=c:\Program Files\erl9.0 which was never existed.
I cross checked the path. The correct path was c:\Program Files\erl9.3.
After correcting the
ERLANG_HOME=c:\Program Files\erl9.3
the problem solved. So, definitely it is a path issue.
In my case, it should be installed erlang using admin role running
If above solutions doesn't work for you then you can try following
Find another compatible version of erlang for your rabbit mq e.g. for rabbit 3.7.x erlang version 20.3.x to 22.0.x all are compatible .
Right click newly downloaded erlang version and from properties select the option to unblock the file .
Run the erlang with admin persssion .
Re run rabbit mq exe
I have been trying to install Maven v 3.0.4 on my machine win 7 for the first time.I have a problem setting the path environment System variable I have the following 4 entries :
PATH
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files\Java\jdk1.7.0_04;C:\Program Files\apache-maven-3.0.4\bin;M2_HOME;%M2%
M2_HOME
C:\Program Files\apache-maven-3.0.4\bin
M2
%M2_HOME%\bin
JAVA_HOME
C:\Program Files\Java\jdk1.7.0_04\bin
when I do mvn --version
I get the error:
JAVA_HOME not found in your environment, please set the JAVA_HOME variable in your environment to match the location of your java installation
The java -version displays the java version fine,
what am I doing so horribly wrong? Is the PATH ok?
Help appreciated, thanks.
It is only necessary to set the path to the Maven binary and to the JDK correctly:
set PATH %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files\Java\jdk1.7.0_04\bin;C:\Program Files\apache-maven-3.0.4\bin
Furthermore you need to set the JAVA_HOME correctly which is done under windows like this:
SET JAVA_HOME=C:\Program Files\Java\jdk1.7.0_04
Be aware of setting JAVA_HOME to the root of the installed JDK and not to bin folder it.
The settings of M2 and M2_HOME is not necessary.
from command prompt run the following
set M2_HOME= C:\Program Files\apache-maven-3.0.4
set PATH=%PATH%;%M2_HOME%\bin
set JAVA_HOME=C:\Program Files\Java\jdk1.7.0_04
set PATH=%PATH%;%JAVA_HOME%\bin
cmd.exe
mvn -version
The environmental variables should point to the installation directory of each program respectively, and their corresponding bin folders should be added to the PATH:
Make sure that your JAVA_HOME points to the C:\Program Files\Java\jdk1.7.0_04 (or whatever directory you have installed your JDK to).
Add the %JAVA_HOME%\bin folder to your PATH (e.g. by replacing the part with C:\Program Files\Java\jdk1.7.0_04). Make sure that you use ; to separate different path components.
Likewise, the M2_HOME variable should be assigned Maven's installation directory, e.g. C:\Program Files\apache-maven-3.0.4 and you should add %M2_HOME%\binto the PATH (the part with C:\Program Files\apache-maven-3.0.4\bin;M2_HOME;%M2% can be removed.
The advantage of adding the environmental variables %JAVA_HOME%\bin and %M2_HOME%\bin on the path rather than the fully qualified path is that it will be easy to update Java and Maven (or to have several versions installed in parallell). All you need to do is to update the environmental variable, and the PATH variable will fallow automatically.
I ran into the same issue as the original poster. I checked, double checked, and triple checked everything to conform to what everyone has (correctly) indicated the setup needs to be. I still got the same error. In the end, I ran SET JAVA_HOME=C:\Program Files\Java\jdk1.7.0_45 from the command line and then ran the mvn command and viola.
So, for what ever reason, pss's suggestion did the trick. Obviously, this doesn't really change what everyone else said, because that's exactly what my environment variables look like...just had to hit the JAVA_HOME from the command line.
Oddness.
I followed all the steps but it was not working for me. But as soon i have set the JAVA_HOME Path, in Command prompt just type:
C:>SET JAVA_HOME=C:\Program Files (x86)\Java\jdk1.8.0_91
It is working fine in fraction of seconds. Thanks Everyone.
I faced the same problem on local installation. I tried out all the suggested methods including the SET method but that didn't work for me. In the end, I had to manually add another environment variable to the system, and then after that
mvn -v
gave the appropriate response:
Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06; 2015-04-22T04:57:37-07:00)
Maven home: C:\Program Files (x86)\apache-maven-3.3.3-bin\apache-maven-3.3.3\bin\..
Java version: 1.8.0_45, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.8.0_45\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 8", version: "6.2", arch: "amd64", family: "dos"
If, like me, you are running mvn -version from the command prompt, and then adding any missing environment variables from the GUI, it is possible that you just have to reload the command prompt after adding the environment variables.
Just exit and run cmd.exe
You need to make a variable of name JAVA_HOME in your Environment and set its value as path to jdk.
Right click on My Computer/ This PC -> Properties
Choose Advance system settings
Open Environment variables
Under System variables click on New... button and give the name
as JAVA_HOME and value as c:/path/to/jdk
Version that I always use. Double click and you get the maven up and running
#echo off
title Maven 3.0.5
set JAVA_HOME=C:\Users\hutingung\Development\jdk\jdk1.6.0_33
set MAVEN_OPTS=-Xmx1024m -Xms512m -XX:MaxPermSize=192m -Dfile.encoding=utf-8
set MAVEN_HOME=C:\Users\hutingung\Development\tools\apache-maven-3.0.5\bin
set PATH=%MAVEN_HOME%;%JAVA_HOME%\bin;%PATH%
#cmd /k
Yes, Appending that path C:\programfiles\maven\bin to path variable in system variables is enough, it will work. No need to add user variables.
I see that $JAVA_HOME is a built-in variable in IzPack. Can I assign to it in a pre-install script and have the installer use that? Currently I am stuck on a machine that defaults to an open-source JRE that runs horribly and I need to reassign it to the Sun JRE so that the installer will run properly.
In the pre-install script, can I append to the $PATH with:
${ENV[PATH]} = ${ENV[PATH]}:/usr/local/java/bin
Let me know what I can do, I cannot get access to write to the .cshrc or .cshrc.login and I cannot tell my users to set the environment variables themselves.
The answer to this for me was that I had to write a python script that set the environment variables and then called a subprocess to launch the installer. This is far from ideal, but it seems like if your machine is stuck by default with an open source JRE, then you can't fix that any other way.