I am using the machine image available here to host an RStudio server off of EC2 on which I will want to run analysis, in part using xlsx and rvest, both of which require Java and R to cooperate which they do not out of the box. I searched for a few solutions and tried to implement them, but got pretty much nowhere.
I SSH'd into the machine, and entered java -version and got this:
The program 'java' can be found in the following packages:
* default-jre
* gcj-5-jre-headless
* openjdk-8-jre-headless
* gcj-4.8-jre-headless
* gcj-4.9-jre-headless
* openjdk-9-jre-headless
Try: sudo apt install <selected package>
so I'm not sure what to do with that. I tried running sudo apt-get install r-cran-rjava which was also recommend on StackOverflow, and got this error:
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package r-cran-rjava
and likewise when I try to run sudo R CMD javareconf this is what I get:
*** JAVA_HOME is not a valid path, ignoring
*** Cannot find any Java interpreter
*** Please make sure 'java' is on your PATH or set JAVA_HOME correspondingly
I searched for Java it's stored here: java: /usr/share/java and I'm not sure how to set JAVA_HOME correctly, or how to set Java correctly.
What should I do?
Installing RJava (Ubuntu)
First, we need Java itself, check if it's installed
Write in Terminal: java -version
but you already checked it, so you need to install it.
If it returns The program java can be found in the following packages, then Java hasn't been installed yet, so execute the following command: sudo apt-get install default-jre. This will install the Java Runtime Environment (JRE).
Then Install JDK
Write in Terminal: sudo apt-get install default-jdk
Then assotiate the JDK installed with R
Run in Terminal: sudo R CMD javareconf
Install RJava and Rgdal
Execute: sudo apt-get install r-cran-rjava
Then: sudo apt-get install libgdal1-dev libproj-dev
Install package in RStudio
Run in RStudio: install.packages("rJava")
Done!
Related
im trying to install psycopg2 to use postgres on my django app. Seems like the first step is to run the
sudo apt install python3-dev libpq-dev
, but when i do it hits me with this funky error -
Unable to locate an executable at "/Library/Java/JavaVirtualMachines/jdk-15.jdk/Contents/Home/bin/apt" (-1)
I'm confused as to why its showing me a java error when i'm installing python-dev. Any help would be greatly appreciated!
Install pip by typing:
python3 -m pip install --user --upgrade pip
It is often a good idea to use virtual environments when doing projects, otherwise packages are installed system wide.
Type in the following to start a virtual environment in your project directory:
python3 -m pip install --user virtualenv
python3 -m venv .
Afterwards, this command should install psycopg2
pip install psycopg2-binary==2.8.4
I have to run Django CRM in my local machine. I followed all commands and tried to install every dependency.
I got stuck in the following command.
sudo apt-get install oracle-java8-installer -y java -version
I got the following error when I tried above command.
E: Command line option 'e' [from -version] is not understood in combination with the other options.
The link of Github CRM Django CRM
Documentation
Please someone help me.
Looking to Django-CRM documentation, seems like the command to install java (required by elasticsearch dependency) it's not the correct one for ubuntu 18.04
To install it you need to run:
apt-get install openjdk-8-jre-headless
Then you can follow the instructions as in the documentation
wget -qO - https://packages.elastic.co/GPG-KEY-elasticsearch > key.elastic
apt-key add key.elastic
echo "deb https://packages.elastic.co/elasticsearch/2.x/debian stable main" | tee -a /etc/apt/sources.list.d/elasticsearch-2.x.list
apt-get update && apt-get install elasticsearch -y
Also, remember to add sudo on the commands if you are not running the commands as root
I'm on windows 10 and running the bash shell (ubuntu), by turning the Windows Subsystem for linux on. Anyways, I'm trying to run some Java programs through the command prompt. I have already set the PATH variables and I can successfully run the java and javac commands in the windows command prompt. However, when I run the javac or java command using Ubuntu shell it says those commands are not found? So it lists some options that I can enter and one of those is
sudo apt install openjdk-8-jdk-headless
But when I run this command it says:
E: Unable to locate package openjdk-8-jdk-headless
I don't get it. I already have Java-8 installed and the PATH variables set, it works fine for the windows command prompt but fails to work with ubuntu. What am I doing wrong?
Thanks.
Do you have to use the OpenJDK version? Try this
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
See this link and this issue
I get an error on Core.NATIVE_LIBRARY_NAME like so:
Stacktrace:
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
NATIVE_LIBRARY_NAME cannot be resolved or is not a field
at MyVideoCap.main(MyVideoCap.java:7)
I had settled the NativLibrary path at the following location.
/home/.../OpenCV/opencv-2.4.5/build/lib
I had followed the instruction on https://www.openshift.com/blogs/day-12-opencv-face-detection-for-java-developers but it doesn't creates any opencv2.4.9.jar file I am working on ubuntu 12 and eclipse with opencv api suppoert.
so help me if you can to generating and building the jar file in the build directory in ubuntu. thanks in advance...
Here I found the full Installing progress of the OpenCV...
# install basic development environment
sudo apt-get install build-essential cmake pkg-config
# install opencv dependencies. ubuntu 13.04 ships with opencv which is close enough to 2.4.6 to pull in most of the needed dependencies.
sudo apt-get build-dep libopencv-dev
# additional dependencies for java support
sudo apt-get install default-jdk ant
# compile opencv
tar xzvf opencv-2.4.6.1.tar.gz
cd opencv-2.4.6.1
mkdir build; cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON ..
make
sudo make install
And in last don't forget to set Native library path to the
/home/.../opencv-2.4.6.1/build/lib
Thats it...
I did these steps without error:
JDK path :
Downloads/jdk-6u37-linux-x64.bin
Commands in Terminal:
mkdir Programs
cd Programs
bash ../Downloads/jdk-6u37-linux-x64.bin
ln -s jdk-6u37-linux-x64 jdk
Set JAVA_HOME and Path:
I added the following lines to the end of the .bashrc file:
export JAVA_HOME=$Home/Programs/jdk
export PATH=:$JAVA_HOME/bin:$PATH
This is the result of executing the command echo $JAVA_HOME:
/Programs/jdk
This is the result of executing the command echo $PATH:
:/Programs/jdk/bin:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games1
And the problem is:
This is the result of executing the command
$ java -version
The program 'java' can be found in the following packages:
* default-jre
* gcj-4.6-jre-headless
* gcj-4.7-jre-headless
* openjdk-7-jre-headless
* openjdk-6-jre-headless
Try: sudo apt-get install
I think the problem is that environment variables are case sensitive in linux, so your
export JAVA_HOME=$Home/Programs/jdk
Should be
export JAVA_HOME=$HOME/Programs/jdk
In your echo $JAVA_HOME output you can see that you don't get your /home/yourname prepended...
Hope that helps.
Cheers,
The scripts located here will help you install sun's jdk on Ubuntu. Really useful stuff.
try this command
sudo update-alternatives --config java
This will list all the Java versions installed and configured.
If you see one or more installs, it will give you a list each element starting with a number. Just choose the number that corresponds to the version you want to use by default.