karaf: JAVA_HOME is not valid: /usr/lib/jvm/java-11-openjdk-amd64/bin/java [duplicate] - apache-karaf

I am working in Ubuntu 16.04. I need to install gradle and the gradle is installed when i checked with sudo apt list --installed command but when i use gradle -version command it shows the following error,
JAVA_HOME is set to an invalid directory: /usr/lib/jvm/java-8-oracle/jre/bin/java
In sudo vim /etc/environment file,
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-amd64/"
http_proxy="http://username:password#IP:port no/"
https_proxy="https://IP:port no/"
ftp_proxy="ftp://IP:port no/"
I don't know where i made mistakes. Please help me.
Thanks.

On a 64bit openSuse 64 42.1 box;
readlink -f $(which java)
provided;
/usr/lib64/jvm/java-1.8.0-openjdk-1.8.0/jre/bin/java
But;
export JAVA_HOME=/usr/lib64/jvm/jre-1.8.0-openjdk
is the path that worked and allowed java emulator to run.
So i think we have to manually browse our file system and see what path to choose.

Today I faced this problem. I am using the default java that comes with your linux distro (so in my case, linux mint).
$ whereis java
This command gave me
java: /usr/bin/java /usr/share/java
So, I opened /user/bin. There was a link to Java. I right clicked it and selected follow original link. This lead me to /usr/lib/jvm/java-11-openjdk-amd64/bin/java.
So now that I know where this java is, I opened my .bashrc file, and edited the JAVA_HOME.
So for my case,
## My Custom variables
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
export PATH=$JAVA_HOME/bin:$PATH
This solved the problem.
Now if you are using some other java (say you downloaded from oracle and extracted the zip file ...), then you have to add that location. So for example, if your java is in /home/user/.sdkman/candidates/java/current, then
export JAVA_HOME=/home/user/.sdkman/candidates/java/current
export PATH=$JAVA_HOME/bin:$PATH

I see a mismatch. In your enviornment file the JAVA_HOME is set to "/usr/lib/jvm/java-8-openjdk-amd64/" and your mentioned that the error that you got relates to the JAVA_HOME as "/usr/lib/jvm/java-8-oracle/jre/bin/java"
If you JAVA is really installed in /usr/lib/jvm/java-8-oracle directory, then you need to ensure that the JAVA_HOME is set to that directory. And also your PATH reflects $JAVA_HOME/bin in it.
I typically install Oracle JDK/JRE separately in a separate directory such as /usr/local/jdk1.8.0 etc.

check the jvm installtion folder from Files
eg : /usr/lib/jvm/java-12-oracle
then in terminal run sudo nano /etc/environment and add the line
JAVA_HOME="/usr/lib/jvm/java-12-oracle"
Then open terminal and run
export JAVA_HOME="/usr/lib/jvm/java-12-oracle"

Related

Unable to install spark 2.2 in Cloudera Quickstart VM (5.10)

I have followed the blog (Below mentioned) here and downloaded the parcel and put as per required.
Please let me know if any one has installed and the steps.
(https://www.cloudera.com/documentation/spark2/latest/topics/spark2_installing.html)
/opt/cloudera/csd/SPARK2-2.1.0.cloudera2-1.cdh5.7.0.p0.171658-el5.parcel
But service cloudera-scm-server restart is not executing.
To use Cloudera Express (free), run:
sudo /home/cloudera/cloudera-manager --express
This requires at least 8 GB of RAM and at least 2 virtual CPUs.
SPARK 2.2 Installation Setup on Cloudera VM
Step 1: Download a quickstart_vm from the link:
Prefer a vmware platform as it is easy to use, anyways all the options are viable.
Size is around 5.4gb of the entire tar file. We need to provide the business email id as it won’t accept personal email ids.
Step 2: The virtual environment requires around 8gb of RAM, please allocate sufficient memory to avoid performance glitches.
Step 3: Please open the terminal and switch to root user as:
su root
password: cloudera
Step 4: Cloudera provides java –version 1.7.0_67 which is old and does not match with our needs. To avoid java related exceptions, please install java with the following commands:
(a). Downloading Java:
wget -c --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.tar.gz
(b). Switch to /usr/java/ directory with “cd /usr/java/” command.
(c). cp the java download tar file to the /usr/java/ directory.
(d). Untar the directory with “tar –zxvf jdk-8u31-linux-x64.tar.gz”
(e). Open the profile file with the command “vi ~/.bash_profile”
(f). export JAVA_HOME to the new java directory.
“export JAVA_HOME=/usr/java/jdk1.8.0_131”
Save and Exit.
(g). In order to reflect the above change, following command needs to be executed on the shell:
source ~/.bash_profile
Step 5: The Cloudera VM provides spark 1.6 version by default. However, 1.6 API’s are old and do not match with production environments. In that case, we need to download and manually install Spark 2.2.
(a). Switch to /opt/ directory with the command:
“cd /opt/”
(b). Download spark with the command:
wget https://d3kbcqa49mib13.cloudfront.net/spark-2.2.0-bin-hadoop2.7.tgz
(c). Untar the spark tar with the following command:
tar -zxvf spark-2.2.0-bin-hadoop2.7.tgz
(d). We need to define some environment variables as default settings:
Please open a file with the following command:
vi /opt/spark-2.2.0-bin-hadoop2.7/conf/spark-env.sh
Paste the following configurations in the file:
SPARK_MASTER_IP=192.168.50.1
SPARK_EXECUTOR_MEMORY=512m
SPARK_DRIVER_MEMORY=512m
SPARK_WORKER_MEMORY=512m
SPARK_DAEMON_MEMORY=512m
Save and exit
(e). We need to start spark with the following command:
/opt/spark-2.2.0-bin-hadoop2.7/sbin/start-all.sh
Export spark_home :
export SPARK_HOME=/opt/spark-2.2.0-bin-hadoop2.7/
(f). Change the permissions of the directory:
chmod 777 -R /tmp/hive
(g). Try “spark-shell”, it should work.
Please follow below video it has all the necessary step required in order to install Sprak2 in Clouedra VM.
youtubue link - https://www.youtube.com/watch?v=lQxlO3coMxM
Also for for starting Cloudera Express (free) your VM should have at-least 8Gb RAM allocated or if you have default 4GB RAM allocated then you can forcefullly start ysing below command and then follow the above video.
sudo /home/cloudera/cloudera-manager --force --express
Try this command
sudo /home/cloudera/cloudera-manager --express --force
I gave up on this, nothing works well with parcel and non-parcel installation.
As soon as cloudera express is started numerous errors and Java 7 instead of Java 8.
I got a mapr VM install with Spark 2.x. No issues. Works first time.
That works well. This is my advice # 1.
If you want KUDU, then I would install centos and install things oneself. This is advice # 2. OK, you may miss Impala, but if for pure research and development then not so much of an issue.
With following two command my spark2.2 was automatically updated to spark 2.4:
(i) sudo yum update
It might be that your java, home path is screwed, in that case please export the java home path in bash file.
(a) vi ~/.bash_profile
(b)
(c) source ~/.bash_profile
Just download the right version of spark that you need say 'spark-2.2.0-bin-hadoop2.6'
open bashrc_profile through vi editor
vi ~/.bash_profile. Paste the below 2 lines
SPARK_HOME=/home/cloudera/Downloads/spark-2.2.0-bin-hadoop2.6
PATH=$PATH:$HOME/bin:$SPARK_HOME/bin
Save it
Then run the command : source ~/.bash_profile
Now start spark-shell .
Note : Make sure you have JDK 1.8 installed
SnPARK 2.2 Installation Setup on Cloudera VM
Step 1: Download a quickstart_vm from the link:
Prefer a vmware platform as it is easy to use, anyways all the options are viable.
Size is around 5.4gb of the entire tar file. We need to provide the business email id as it won’t accept personal email ids.
Step 2: The virtual environment requires around 8gb of RAM, please allocate sufficient memory to avoid performance glitches.
Step 3: Please open the terminal and switch to root user as:
su root
password: cloudera
Step 4: Cloudera provides java –version 1.7.0_67 which is old and does not match with our needs. To avoid java related exceptions, please install java with the following commands:
(a). Downloading Java:
wget -c --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.tar.gz
(b). Switch to /usr/java/ directory with “cd /usr/java/” command.
(c). cp the java download tar file to the /usr/java/ directory.
(d). Untar the directory with “tar –xvzf jdk-8u31-linux-x64.tar.gz”
(e). Open the profile file with the command “vi ~/.bash_profile”
(f). export JAVA_HOME to the new java directory.
“export JAVA_HOME=/usr/java/jdk1.8.0_131”
Save and Exit.
(g). In order to reflect the above change, following command needs to be executed on the shell:
source ~/.bash_profile
Step 5: The Cloudera VM provides spark 1.6 version by default. However, 1.6 API’s are old and do not match with production environments. In that case, we need to download and manually install Spark 2.2.
(a). Switch to /opt/ directory with the command:
“cd /opt/”
(b). Download spark with the command:
wget https://d3kbcqa49mib13.cloudfront.net/spark-2.2.0-bin-hadoop2.7.tgz
(c). Untar the spark tar with the following command:
tar -xvzf spark-2.2.0-bin-hadoop2.7.tgz
(d). We need to define some environment variables as default settings:
Please open a file with the following command:
vi /opt/spark-2.2.0-bin-hadoop2.7/conf/spark-env.sh
Paste the following configurations in the file:
SPARK_MASTER_IP=192.168.50.1
SPARK_EXECUTOR_MEMORY=512m
SPARK_DRIVER_MEMORY=512m
SPARK_WORKER_MEMORY=512m
SPARK_DAEMON_MEMORY=512m
SPARK_LOCAL_IP=127.0.0.1
Save and exit
(e). We need to start spark with the following command:
/opt/spark-2.2.0-bin-hadoop2.7/sbin/start-all.sh
Export spark_home :
export SPARK_HOME=/opt/spark-2.2.0-bin-hadoop2.7/
(f). Change the permissions of the directory:
chmod 777 -R /tmp/hive
(g). Try “spark-shell”, it should work.
Same answeras swapnil shashank with small modification below
SPARK_LOCAL_IP=127.0.0.1
tar -xvzf spark-2.2.0-bin-hadoop2.7.tgz

Change terminal in Atom-editor's Platformio-Ide-Terminal on Windows

On Windows, default terminal for Atom's Platformio-Ide-Terminal is Powershell (at least, that is what I get without any configuration).
I would prefer a terminal using unix-type commands. I already have MINGW and CYGWIN installed.
How can I avoid opening a Powershell and opening another terminal type instead?
Set the default shell in:
Edit>>Settings>>Packages>>Platformio Ide Terminal>>Settings>>Shell Override
You can use the git's bash as proposed here as you probably already have git installed.
C:\Program Files\Git\bin\bash.exe
Step by Step Solution
Go the Setting-> Packages -> In Search Bar, search for the platformio.
Open platformio and go to Shell Override Option.
Put the following line as per as your Terminal Requirement
For cmd- C:\\WINDOWS\\System32\\cmd.exe
For Power Shell- C:\\WINDOWS\\Sysnative\\WndowsPowerShell\\v1.0\\powershell.exe
For bash- C:\\Program Files\\Git\\bin\\bash.exe or C:\\Windows\\System32\\bash.exe (depending on how you install the bash). Be Sure, that you have already install the bash into your computer.
Now, you can integrate bash, cmd, git bash, Power Shell into Atom using platformio as terminal.
For CYGWIN users, the bash executable from the following location has proved useful for setting the shell override Settings >> Packages >> Platformio Ide Terminal >> Settings >> Shell Override
C:\cygwin64\bin\bash.exe
If you are now using Ubuntu for Windows 10 (downloaded from the app store), you can change it to that as well.
Ubuntu gets installed in Windows' PATH by default, so just change the default shell to:
ubuntu.exe
That's it. Just remember that to get to your code, cd to /mnt/(driveletter)/wherever/your/files/sit.
For someone who still can't get this to work because your git bash is installed in AppData. This worked for me.
C:\Users\saurabh\AppData\Local\Programs\Git\bin\bash.exe

libsqlplus.so: connot open shared object file : No such file or directory even though PATH contain the path

I downloaded Instant Oracle Client Version 11.2.0.4.0(basic, sqlplus, devel .rpm file) by Oracle website in Ubuntu.
After converting .rpm into .deb using alien, I installed it, basic first and sqlplus and last devel.
And then I tried to run sqlplus.
But It is saying sqlplus64: error while loading shared libraries: libsqlplus.so: cannot open shared object file: No such file or directory
Even though my PATH contains the PATH.
The below shows my PATH and the location of libsqlplus.so.
A#ubuntu:~$ sudo find / -name libsqlplus.so
/usr/lib/oracle/11.2/client64/lib/libsqlplus.so
A#ubuntu:~$ echo $PATH
/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/sangmin/eclipse:/usr/lib/oracle/11.2/client64/lib:/usr/lib/oracle/11.2/client64
Test your Oracle client. User either sqlplus either sqlplus64 depending on your platform. In my case, I used:
$ sqlplus64 username/password#//dbhost:1521/SID
If you get the next message, then you need to instruct sqlplus to use the proper libray:
sqlplus64: error while loading shared libraries: libsqlplus.so: cannot open shared object file: No such file or directory.
To do so, first find the location of Oracle libraries. The path should be something like /usr/lib/oracle/<version>/client(64)/lib/. In my case (Ubuntu 14.04 LTS, Intel on 64-bit), it was /usr/lib/oracle/11.2/client64/lib/.
Now, add this path to the system library list. Create and edit a new file:
$ sudo nano /etc/ld.so.conf.d/oracle.conf
Add inside the path:
/usr/lib/oracle/11.2/client64/lib/
Run now the dynamic linker run-time bindings utility:
$ sudo ldconfig
If sqlplus yields of a missing libaio.so.1 file, run:
$ sudo apt-get install libaio1
For other errors when trying to run sqlplus, please consult the Ubuntu help page.
Might worth checking the permissions issue:
sqlplus: error while loading shared libraries
PERMISSIONS:
I want to stress the importance of permissions for "sqlplus".
For any "Other" UNIX user other than the Owner/Group to be able to run sqlplus and access an ORACLE database , read/execute permissions are required (rx) for these 4 directories :
$ORACLE_HOME/bin , $ORACLE_HOME/lib, $ORACLE_HOME/oracore, $ORACLE_HOME/sqlplus
Environment. Set those properly:
A. ORACLE_HOME
(example: ORACLE_HOME=/u01/app/oranpgm/product/12.1.0/PRMNRDEV/)
B. LD_LIBRARY_PATH
(example: ORACLE_HOME=/u01/app/oranpgm/product/12.1.0/PRMNRDEV/lib)
C. ORACLE_SID
D. PATH
export PATH="$ORACLE_HOME/bin:$PATH"

phpDocumentor - Unable to find the dot command of the GraphViz package

I would like ask some help about my next problem:
I am working on a Symfony2 project. We installed Symfony2 via composer.
Now I would like to generate phpDocument used by phpDocumentor.
A did the following steps:
update composer: sudo php composer.phar self-update
add the following property to Symfony2/compose.json file:
"require-dev": {
"phpdocumentor/phpdocumentor": "2.*#dev"
},
Run composer command
sudo php composer.phar update
Result was success! The installed GraphViz version is: 1.0.2
When I try to generate phpDoc from source code finally I got a message:
Unable to find the dot command of the GraphViz package. Is GraphViz correctly installed and present in your path?
(Document generated as right...)
I tried to found a soulution about this problem but I couldn't.
Is anybody can help me to resolve this problem?
Environment is: Ubuntu release 12.04
Graphviz is a nice software that creates graphs, but PHP software can only provide wrappers that create Graphviz source files that then get parsed and morphed into pictures.
Phpdocumentor comes with it's own wrapper, but you still have to install the Graphviz software package.
On Ubuntu just run
sudo apt-get install graphviz
rerun phpdoc, at the end you will see the line
Execute transformation using writer "Graph"
that's all!
The error says that : GraphViz tool (needed for making charts and graphs in the documentation) is not installed, in that scenario you will have to download the suitable version and configure it ! And if you are sure that it is installed on your system, then you should check whether the command dot is available or not. On windows path environment variable needs to be set which makes the dot command execution to be available from any path. Fixing this may get your things working !
For Windows
Follow the steps below to resolve this error are:
download Windows Packages from https://graphviz.gitlab.io/_pages/Download/Download_windows.html
Just install it
add c:\Program Files\Graphviz*\dot.exe or c:\Program Files (x86)\Graphviz*\dot.exe to your environment variable PATH
run phpdoc
Re-start your machine & run phpdoc (if still shows the same error message)
For windows 7/10 just install https://graphviz.gitlab.io/download/ select the Stable install packages. Then add
C:\Program Files (x86)\Graphviz2.38\bin
to your system environment variables. Make sure to change the version to the one you downloaded.
To check if it works open a new instance of cmd or git bash and run dot. If it says dot is not a valid command then make sure the path to Graphviz bin folder is correct.

IOException: Cannot run program "javac" when "sudo ./sbt/sbt compile" in Spark?

I'm installing Apache Spark which uses its own copy of SBT to set things up.
I'm using Linux Mint in a VirtualBox VM.
Here's a snippet from the error when I run sudo ./sbt/sbt compile from the Spark directory spark-0.9.0-incubating:
[error] (core/compile:compile) java.io.IOException: Cannot run program "javac": error=2, No such file or directory
[error] Total time: 181 s, completed Mar 9, 2014 12:48:03 PM
I can run java and javac from the command line just fine: e.g. javac -version gives javac 1.6.0_31
The correct jdk1.6.0_31/bin is in my PATH.
I read that the error might be due to the 64-bit JDK that I had installed, but I get the same error with the 32 bit JDK.
How can I sort out the issue?
edit: Using bash shell.
DISCLAIMER I'm mostly guessing now and still am unsure I should've responding here rather than adding a comment. Until it's clear, the DISCLAIMER remains.
When you execute java and javac from the command line, what user are you at that moment? I'm pretty sure your problems surface because the users you operate are different.
Please notice that you're executing sudo ./sbt/sbt compile as root (due to the way sudo works), but you say nothing about what user(s) you've been using to execute javac and java commands.
Add jdk1.6.0_31/bin to PATH for root and you'll be all set (as far as the configuration of Java's concerned).
I'd also recommend setting JAVA_HOME to point to jdk1.6.0_31 as it may help at times -- many applications are using it as the way to find the location of Java.
As a workaround, you may edit ./sbt/sbt and add PATH and JAVA_HOME appropriately.
You need to include the javac executable. To do this in Ubuntu please run the following command:
sudo apt-get install openjdk-7-jdk
It also places it within your path variable.

Resources