Ubuntu 18.04
sudo ./teamcity-server.sh run
Java executable of version 1.8 is not found:
- Java executable is not found under the specified directories: '', '/home/alex/TeamCity/bin/../jre'
- Neither the JAVA_HOME nor the JRE_HOME environment variable is defined
- Java executable is not found in the default locations
- Java executable is not found in the directories listed in the PATH environment variable
Please make sure either JAVA_HOME or JRE_HOME environment variable is defined and is pointing to the root directory of the valid Java (JRE) installation
Environment variable FJ_DEBUG can be set to enable debug output
Java not found. Cannot start TeamCity server. Please ensure JDK or JRE is installed and JAVA_HOME environment variable points to it.
java -version
openjdk version "10.0.2" 2018-07-17
OpenJDK Runtime Environment (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.4)
OpenJDK 64-Bit Server VM (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.4, mixed mode)
alex#teamcity-server:~/TeamCity/bin$
$JAVA_HOME (tried default-java, /bin)
-bash: /usr/lib/jvm/java-11-openjdk-amd64: Is a directory
$JRE_HOME (tried default-java, /bin)
-bash: /usr/lib/jvm/java-11-openjdk-amd64: Is a directory
echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/bin:/usr/bin:/sbin:/usr/games:/usr/local/games:/usr/lib/jvm/java-11-openjdk-amd64/bin
readlink -f $(which java)
/usr/lib/jvm/java-11-openjdk-amd64/bin/java
Tried
ln -s /usr/lib/jvm/java-11-openjdk-amd64/bin /home/alex/TeamCity/jre
Is it requires SPECIFIC java version and does not work with latest?
Did i set variables incorrectly?
I guess, TeamCity is expecting a Java 1.8
Java executable of version 1.8 is not found.
But you are feeding it with a Java 10
openjdk version "10.0.2"
The I think the answer to
Is it requires SPECIFIC java version and does not work with latest?
is "Yes.", it requires Java 1.8 only, maybe.
You run server under sudo. Set $JAVA_HOME for root too - I guess, it set only for your user.
Related
How can i make java_home tool(i.e /usr/libexec/java_home) to work on my mac?I am a mac newbie.Mac Java-home tool says unable to find JVM installed but JVM is installed on my machine and the java -version return true as shown below
$ /usr/libexec/java_home -V
Unable to find any JVMs matching version "(null)".
Matching Java Virtual Machines (0):
Default Java Virtual Machines (0):
No Java runtime present, try --request to install
```$ java -version
openjdk version "11.0.2" 2019-01-15 LTS
OpenJDK Runtime Environment Zulu11.29+3-CA (build 11.0.2+7-LTS)
OpenJDK 64-Bit Server VM Zulu11.29+3-CA (build 11.0.2+7-LTS, mixed mode)
Open up Terminal.app (Applications >> Utilities >> Terminal)
Type: nano .profile
add this to the end of the .profile file:
JAVA_HOME=/Library/Java/Home
export JAVA_HOME;
Save and exit (ctrl-x and y to confirm)
--- edit
Only now I saw, you are using open jdk, try it:
Before setting the path make sure that java is installed by checking the directory
terminal > type ls /Library/Java/JavaVirtualMachines/
You will see java versions installed
Then in .bash_profile
JAVA_HOME=/Library/Java/JavaVirtualMachines/<version>.jdk/Contents/Home
export JAVA_HOME
terminal type source ~/.bash_profile to reload
I have install JDK 8 and my environment path is
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
JAVA_HOME="/usr/lib/jvm/java-8-openjdk"
PATH=$PATH:/usr/lib/jvm/java-8-openjdk/bin
Here is my Java version
openjdk version "1.8.0_171"
OpenJDK Runtime Environment (build 1.8.0_171-8u171-b11-0ubuntu0.18.04.1-b11)
OpenJDK 64-Bit Server VM (build 25.171-b11, mixed mode)
I am getting problem while installing Maven on Ubuntu
The JAVA_HOME environment variable is not defined correctly
This environment variable is needed to run this program
NB: JAVA_HOME should point to a JDK not a JRE
Just run update-alternatives --config java this should gives you the path to the java home.
After this you can set your JAVA_HOME path simply. Just edit your ~/.bashrc and add this line export JAVA_HOME=<path_given_by_the_command above>. After this reload your bashrc.
Once you have installed oracle JDK on your Ubuntu then run below command to set JDK as default
sudo apt install oracle-java8-set-default
This will set environment variable path and you don't need to change config files manually.
Try getting the path using readlink
export JAVA_HOME="$(readlink -f /etc/alternatives/java | sed -e 's/\/jre\/bin\/java$//')"
when I run cordova run android in my project I have this output
ANDROID_HOME=/home/ronaizacard/Android/Sdk/
JAVA_HOME=/usr/lib/jvm/java-7-oracle/jre/bin/java
ERROR: JAVA_HOME is set to an invalid directory: /usr/lib/jvm/java-7-oracle/jre/bin/java
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.
Error: /home/ronaizacard/work/apk/platforms/android/gradlew: Command failed with exit code
However, when I check the JAVA_HOME variable I get:
# echo $JAVA_HOME
/usr/lib/jvm/java-7-oracle/jre/bin/java
My JAVA_HOME is defined in .zshrc and I have double checked that it is set as the source.
JAVA_HOME=/usr/lib/jvm/java-7-oracle/jre/bin/java
PATH=$PATH:$HOME/bin:$JAVA_HOME/bin
export JAVA_HOME
export JRE_HOME
export PATH
Running java -version also confirms that JAVA_HOME is set correctly and is on the PATH.
➜ ~ java -version
java version "1.7.0_80"
Java(TM) SE Runtime Environment (build 1.7.0_80-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.80-b11, mixed mode)
So my question is how/why does Gradle find /usr/lib/jvm/default-java, and more importantly how do I point it to the correct directory?
I have also tried find the Gradle files and change the /usr/lib/jvm/default-java on bin but cordova dont have this
I'm running 64bit Ubuntu LTS 16
I change JAVA_HOME=/usr/lib/jvm/java-7-oracle and worked fine
I'm trying to install and use gradle 2.7
I have java installed properly:
java -version
java version "1.8.0_11"
Java(TM) SE Runtime Environment (build 1.8.0_11-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.11-b03, mixed mode)
I have my JAVA_HOME set correctly:
echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk1.8.0_11.jdk/Contents/Home
When I run gradle -v:
ERROR: JAVA_HOME is set to an invalid directory: /Library/Java/JavaVirtualMachines/jdk1.8.0_11.jdk/Contents/Home
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.
I tried to use the solution given here Gradle does not recognize the JAVA_HOME I have set and here Gradle finds wrong JAVA_HOME even though it's correctly set
but that line does not exist in my gradle file located at /usr/local/gradle/gradle-2.7/bin
Does anyone have any other suggestions?
Edit:
cat ~/.bash_profile
export JAVA_HOME=$(/usr/libexec/java_home)
export JDK_HOME=$(/usr/libexec/java_home)
export PATH=/Users/eghdk/Dev/Android/SDK/platform-tools:/Users/eghdk/Dev/Android/SDK/tools:$PATH
export ANDROID_HOME=/Users/eghdk/Dev/Android/SDK
# Adding Gradle to system path
export GRADLE_HOME=/usr/local/gradle/gradle-2.7
PATH=$GRADLE_HOME/bin:$PATH
export PATH
# Turning on the Gradle daemon by default
export GRADLE_OPTS="-Dorg.gradle.daemon=true"
I'm currently setting up a Tomcat Server under Ubuntu 14.10.
in ${CATALINA_HOME}/RUNNING.txt it says, that either JAVA_HOME or JRE_HOME need to be set. I filled the file ${CATALINA_HOME}/bin/setenv.sh with:
JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
since
sudo dpkg -L 'openjdk-7-jdk'
indicated that this is the place where my JDK is installed. To test the location, i also tried:
JAVA_HOME=/usr/lib/jvm/some-none-existing-place
which gave no error when starting tomcat using ${CATALINA_HOME}/bin/startup.sh (although the path does obviously not exist)
So, when is this variable used by Tomcat and how can I check if I set the correct path (for Tomcat)?
Type in terminal,
echo $JAVA_HOME
It will display JAVA_HOME variable path.
IF nothing appears then you can set it manually by,
export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
This will differ according to your JDK type & version
Edit: Also you just follow the below to ensure you set in tomcat configuration file.
Hit Ctrl+Alt+T to open terminal and run:
sudo gedit /etc/default/tomcat7
Find commented JAVA_HOME, uncomment and change the directory to your JDK environment. Restart now and check for the error.
Open a command prompt, type :
java -version
java version "1.8.0_60" Java(TM)
SE Runtime Environment (build > 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)
javac -version
javac 1.8.0_60
echo %JAVA_HOME%
C:\Program Files\Java\jdk1.8.0_60
So, what is your problem:
a) Tomcat does not start, or
b) it starts, but you do not know what version of Java it is using?
Check that your setenv.sh file is readable. If it is not readable, it will be ignored.
If JRE_HOME variable is set then JAVA_HOME will be ignored.
If neither one is set, then there are some defaults that are tried, including a call to which java. (The magic is in ${CATALINA_HOME}/bin/setclasspath.sh).
The ${CATALINA_HOME}/bin/version.sh script will print the versions of Tomcat and Java.
Tomcat scripts print the actual value of JRE_HOME when Tomcat starts if you have a terminal. (if [ $have_tty -eq 1 ]; block in catalina.sh).
In recent versions of Tomcat a org.apache.catalina.startup.VersionLoggerListener can be configured in server.xml and will print the path to java and other settings.
http://tomcat.apache.org/tomcat-8.0-doc/config/listeners.html