Invalid JAVA_HOME While Running Android sdkmanager - android-sdk-manager

I'm using Linux and I was trying to run this command
sudo /home/username/Android/Sdk/tools/bin/sdkmanager --update
But I got the following error
ERROR: JAVA_HOME is set to an invalid directory: /usr/lib/jvm/java-8-oraclexxx
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.
But when I tried echo $JAVA_HOME, the output is /usr/lib/jvm/java-1.8.0-openjdk-amd64/. I also have added JAVA_HOME in ~/.bashrc and reload it, but still not worked.
How to set the JAVA_HOME variable for Android SDK Manager?

Is the directory /usr/lib/jvm/java-8-oraclexxx the root directory of your JRE? If not you need to set JAVA_HOME to your JRE. Check out this article on how to set JAVA_HOME https://docs.opsgenie.com/docs/setting-java_home

Related

How to fix diesel_cli link libpq.lib error with Postgres tools installed in Docker?

I'm trying (for hours now) to install the cargo crate diesel_cli for postgres. However, every time I run the recommended cargo command:
cargo install diesel_cli --no-default-features --features postgres
I wait a few minutes just to see the same build fail with this message:
note: LINK : fatal error LNK1181: cannot open input file 'libpq.lib'
error: aborting due to previous error
error: failed to compile `diesel_cli v1.4.1`, intermediate artifacts can be found at `C:\Users\<user name here>\AppData\Local\Temp\cargo-installUU2DtT`
Caused by:
could not compile `diesel_cli`.
I'm running postgres in a docker container and have the binaries on my C:\pgsql with the lib and bin directories both on the PATH so I can't figure out why it's not linking. What else could be required they didn't mention in the docs?
In my case the installation was successful but when I tried to run it this error occured.
maybe this would work for others who have the same problem:
open PowerShell
type in setx PQ_LIB_DIR "C:\Program Files\PostgreSQL\13\lib" (or any other path to your PostgreSQL lib)
restart your PC
run again
I had the same issue with WSL, if you're on Linux probably you could find PostgreSQL lib location and add it to your environment variables.
Update:
The answer below is a work around for older versions. Please check the possibility to execute cargo clean first
Original Version
Adding the folder to the PATH variable didn't help, at least in my case, as by some reason it is not used in the /LIBPATH parameter passed to link.exe.
In my case it was C:\Users\<username>\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib
You can see it in the beginning of the error message.
Copy libpq.lib in there and it will be used from there.
After installation diesel would require some other assemblies. Copy libcrypto-1_1-x64.dll, libiconv-2.dll and libssl-1_1-x64.dll into the folder showed after where diesel command execution
I had the same error on Ubuntu and for me the following install fixed the issue:
sudo apt install libpq-dev
No need to move files around, just add C:\Program Files\PostgreSQL\14\lib and C:\Program Files\PostgreSQL\14\bin to your PATH. Installing and running diesel should have no problems.
Note: your paths may be different, and remember to close/reopen your terminal so the PATH variable is updated.
(Tested on Windows 10)
To give clear steps for windows:
Add C:\Users<username>.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib in the path in environment variables
Copy libpq.lib that is in C:\Program Files\PostgreSQL\14\lib (obviously this is with version 14) and paste it in C:\Users<username>.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib
If you've attempted to cargo build (or anything that runs the build scripts for libpq rust crate) when your environment was invalid, then you need to do a cargo clean after fixing your environment otherwise you'll still get the libpq.lib not found error even when it's in your PATH. The other answers where you copy the file into another directory are just hacks
You can instead add the path to .../lib to the compilers' library search paths, using RUSTFLAGS environment variable. It works both for installing diesel_cli and for building your projects.
RUSTFLAGS='-L /usr/local/pgsql/lib' cargo build
On Windows with EDB installer, the path contains a space, so use CARGO_ENCODED_RUSTFLAGS instead. For PowerShell:
$env:CARGO_ENCODED_RUSTFLAGS = "-L`u{1f}C:\Program Files\PostgreSQL\14\lib"

Cpplint could not find executable

I am trying to activate cpplint within vs code. I have installed it in Anacanda environment where executable
/home/ubuntu/anaconda3/bin/cpplint
I have a link to it
ls -l /home/ubuntu/anaconda3/bin/cpplint
Unfortunately per visual code cpplint extension still getting error of "Cpplint could not find executable"
Please, advice to configure it correctly.
Download and install
sudo apt-get install python-pip
pip install --user cpplint
Verify install result
ls -l /usr/local/bin/cpplint
If you still have issues check cpplint.cpplintPath and verify the execution path is set correctly.
Also, if you installed cpplint into ~/.local/ directories, by default ~/.local/bin is not included in PATH. So to fix just that add:
export PATH=$PATH:~/.local/bin/
to your ~/.bashrc

sbt command not found

I am installing sbt in my cloudera distribution.
I have downloaded sbt.0.13.15
Moved file to /usr/local
Then I had updated profile
sudo nano profile
Added export PATH=$PATH:/usr/local/sbt/bin
Saved file and exited.
But now if I issue "sbt about" command, I am getting sbt: command not found.
Could you please help to resolve this issue.
Some suggestions:
Check your PATH variable: echo $PATH
The PATH variable is not updated automatically by writing into .profile, either open a new shell or do source .profile
The file is called .profile, not profile

Error from Zookeper 3.4.6 version

I downloaded zookeeper-3.4.6.tar.gz and while executing zkServer.sh start , I am getting below error.I did google but couldn't find a solution, Please let me kno if you see similar issues.
CLASSPATH=/home/spanda20/zookeeper/bin/../src/java/lib/*.jar:/home/spanda20/zookeeper/bin/../conf:
zkServer.sh: 81: /home/spanda20/zookeeper/bin/zkEnv.sh: Syntax error: "(" unexpected (expecting "fi")
Finally I am able to see storm UI and its running.
Below changes I did in the .bashrc file. Please make sure that You add bin path in the PATH VARIABLE.
I did add the below variables in the .bashrc file.
export JAVA_HOME =JDK Path
export ZOOKEPER_HOME =Zookeper install path
Then add them in the variable path.
PATH= $PATH:$JAVA_HOME/bin:$ZOOKEPER_HOME/bin
Thanks
Sanjeeb
I'm using zookeeper version 3.4.9 on ubuntu 14.04 and installed openjdk 7. I have added below lines to ~/.bashrc
export JAVA_HOME="/usr/lib/jvm/java-7-openjdk-amd64"
export ZOOKEEPER_HOME ="/path/to/zookeeper"
PATH=$PATH:$JAVA_HOME/bin:$ZOOKEEPER_HOME/bin.
First I ran sh /path-to-zookeeper/bin/zkServer.sh start but didn't not work I got the same error.
I ran it with sudo /bin/bash /path-to-zookeeper/bin/zkServer.sh start it worked.
./zkServer.sh start
This should work.
Edit /etc/environment, and paste the following:
JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64/jre"
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:$JAVA_HOME/bin"
modify the JAVA_HOME as per your local Java version.

Unable to upload app to iTunes Connect

I've been trying to submit my app to iTunes connect, but I've been getting the error An error occured uploading to the iTunes store. I've tried this using Xcode and the Application Loader.
I checked the system log and I found these errors:
Application Loader[820]: Error:
/Applications/Xcode.app/Contents/Applications/Application Loader.app/Contents/MacOS/itms/bin/iTMSTransporter: line 14: **awk: command not found**
/Applications/Xcode.app/Contents/Applications/Application Loader.app/Contents/MacOS/itms/bin/iTMSTransporter: line 18: ../share/iTMSTransporter.woa/**iTMSTransporter: No such file or directory**
May 29 11:09:38 Ahmad-MacBook.local Application Loader[820]: Out:*
Here's what I tried to solve this problem:
some sites suggested that the problem is with Java, so I tried rolling back to Java 1.6 and Java 1.5 and it didn't work, I also installed Java 1.7 from Oracle's website but it didn't work either;
deleted Xcode and reinstalled it with no success.
Did anyone manage to solve this problem?
I'm running OSX 10.8.3. The current Java version is:
java version "1.6.0_45"
Java(TM) SE Runtime Environment (build 1.6.0_45-b06-451-11M4406)
Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01-451, mixed mode)
i had exactly the same issue and was able to fix it by slightly adapting the file
/Applications/Xcode.app/Contents/Applications/Application Loader.app/Contents/MacOS/itms/bin/iTMSTransporter
change the path to the awk to absolute (and i also uncommented the echo of the script path, which probably isn't necessary). Here my changed file:
#!/bin/sh
# if the user has the run script in their PATH
# then we can get the path to the script from
# 'which'. otherwise, we have to get the path
# from $0
if [ "$0" = "iTMSTransporter" ] ; then
SCRIPT_PATH=`which iTMSTransporter`
else
SCRIPT_PATH=$0
fi
# get the script's directory
SCRIPT_DIR=`echo $SCRIPT_PATH | /usr/bin/awk -F"/" '{print substr($0,1,length($0)-length($NF))}'`
# call the transporter relative to the script's directory
echo Calling: ${SCRIPT_DIR}../share/iTMSTransporter.woa/iTMSTransporter "$#"
"${SCRIPT_DIR}../share/iTMSTransporter.woa/iTMSTransporter" "$#"
i guess this behavior is caused by inproper classpath setup which i wasn't able to resolve though. After fixing the script, i managed to upload my app through the XCode Organiser.
Good luck!
try this (type in terminal)
cd /System/Library/Frameworks/JavaVM.framework/Versions
sudo ln -s CurrentJDK /System/Library/Frameworks/JavaVM.framework/Versions/1.5
sudo ln -s CurrentJDK /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0