# Check installed Java version
java -version
# chcek package name
sudo dpkg --list | grep -i jdk
# uninstall packages
sudo apt remove openjdk-8-jre-headless openjdk-8-jre
sudo apt search openjdk-\(\.\)\+-jdk$
sudo apt-get install openjdk-8-jdk
sudo apt remove openjdk-11-jre-headless
$ java -version
openjdk version "1.8.0_191"
OpenJDK Runtime Environment (build 1.8.0_191-8u191-b12-2ubuntu0.18.04.1-b12)
OpenJDK 64-Bit Server VM (build 25.191-b12, mixed mode)
sudo apt install maven
$ mvn -v
Apache Maven 3.6.0
Maven home: /usr/share/maven
Java version: 1.8.0_191, vendor: Oracle Corporation, runtime: /usr/lib/jvm/java-8-openjdk-amd64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.15.0-47-generic", arch: "amd64", family: "unix"
vim ~/.bashrc
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
export PATH="$PATH:$JAVA_HOME/bin:/usr/share/maven/bin"
echo $JAVA_HOME
echo $PATH
# input user and password after "cf login"
cf login
# check mongo db service plan name
cf marketplace -s mongodb
# create mongoDB service
cf create-service mongodb v3.0-dev mongo-service
mvn archetype:generate -DgroupId=hcp-cf-mongodb-tutorial -DartifactId=hcp-cf-mongodb-tutorial -DinteractiveMode=false
# change directory to somewhere
cd <directory>
git clone https://github.com/SAP/hcp-cloud-foundry-tutorials.git
cd hcp-cloud-foundry-tutorials/hcp-cf-mongodb-tutorial
mvn package
---
applications:
- name: hcp-cf-mongodb-tutorial
memory: 768M
path: target/hcp-cf-mongodb-tutorial-1.0-SNAPSHOT.jar
services:
- mongo-service
cf push
{"status":"Successfully accessed Mongodb service. Retrieving the data object inserted in test collection.","dbObjects":[{"key":"hello","value":"world"}]}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
18 | |
13 | |
13 | |
8 | |
7 | |
5 | |
4 | |
4 | |
4 | |
4 |