Finding JDK after installing Java via PPA repository - java-8

Where do I find the java JDK after installing it via PPA repository in Linux Mint? I followed this to install it:
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
sudo update-java-alternatives -s java-8-oracle
Running java and javac work, showing version java version "1.8.0_101". Running whereis shows both binaries at /usr/bin/ folder. Running printenv JAVA_HOME shows me the /usr/ directory (I set it by hand, I assumed that was the proper folder).
When I run NetBeans, though, it cant find the jdkhome. I've changed netbeans.conf to have netbeans_jdkhome="/usr/", and I also tried running with the --jdkhome /usr/ option, but to no avail.
What directory should be the JDK home after installing Java the way I have? Or how do I find it?

Checkout ls -l /usr/bin/java to see where does the symbolic link point to.
Or you can also try:
update-alternatives --all | grep java

Related

How to install maven with brew but without openjdk?

I already have Java HotSpot JDK 11 on my machine that I'm using for everything.
When I typed brew install maven it tried to install openjdk as a dependency. I don't want that and want maven to use my JDK, not its own openjdk.
So, how can I tell it to not install openjdk?
After installing java, I have installed Maven with command
brew install --ignore-dependencies maven
It worked for me, for Gradle also.
The way I solved it was installing the openjdk with brew (in my case openjdk#8). Mine was different from the default one that brew requires by default. So after that I created a symlink to my openjdk where maven is expecting to find the SDK. And finally installed maven without dependencies.
brew install openjdk#8
cd /usr/local/opt
ln -s ../Cellar/openjdk#8/1.8.0+275 openjdk
brew install --ignore-dependencies maven
I don't think there is a supported way to not install a dependency from the command line. However, you can configure the installed mvn to use another JDK. It requires two steps:
Add /usr/local/opt/maven/libexec/bin to your $PATH before /usr/local/bin to pick up the mvn script that does not override $JAVA_HOME
Set $JAVA_HOME in your environment or .mavenrc to pick up the your preferred version of Java
or (building on what Enrique Cordero said above) to re-use an already installed AdoptOpenJDK 8:
brew install adoptopenjdk8
cd /usr/local/opt
ln -s ../Caskroom/adoptopenjdk8/8,275:b01 ./openjdk
brew install maven --ignore-dependencies
and then remove the symlink
rm /usr/local/opt/openjdk
Not exactly the answer for the asked question, but if someone wants to change the JDK path from the default openjdk to the system defined JDK, one can do the following:
First, brew install maven - this will install maven (and openjdk) on the mac and point the default JDK used by maven to be this openjdk
Second, set JAVA_HOME in your ~/.bashrc or ~/.zshrc to point to sytem installed JDK
# set JAVA_HOME for mvn
export JAVA_HOME=`/usr/libexec/java_home`

How to update golang on codeanywhere.com with Ubuntu

How to update golang on codeanywhere.com with Ubuntu 14.04?
The default container uses the version from Ubuntu repos, instead of golang PPA.
As of writing it's 1.6 and the newest version is 1.9.
(can't comment yet) Just an additional information, the steps in Paweł Prażak's answer work when you run on a Blank Container. If you run them on a Go predefined stack it won't update.
I also recommend to change the GOPATH value to your workspace, running
export GOPATH=$HOME/go
Then run go env to check if the values are correctly updated.
Thanks for the answer by the way, Paweł!
You can easily install the latest golang release in the container by using this script:
git clone https://github.com/udhos/update-golang
cd update-golang
sudo ./update-golang.sh
Full details: https://github.com/udhos/update-golang
Create and new Blank Container with Ubuntu:
Connect to the container with SSH.
Follow the instructions on the official wiki.
First install the add-apt-repository support:
sudo apt-get update
sudo apt-get install -y software-properties-common
Now install the recent version of golang (refer to the wiki for up to date instructions):
sudo add-apt-repository ppa:gophers/archive
sudo apt-get update
sudo apt-get install golang-1.9-go
Make sure to put the binary on PATH, e.g.:
sudo ln -s /usr/lib/go-1.9/bin/go /usr/local/bin/go
Now the newer version should be available:
$ go version
go version go1.9.2 linux/amd64
Add $GOPATH pointing to the workspace and add $GOPATH/bin to $PATH in ~/.profile:
cat << EOF >> ~/.profile
export GOPATH="\$HOME/workspace"
export PATH="\$GOPATH/bin:\$PATH"
EOF
Apply the new ~/.profile:
. ~/.profile
Also make is missing, if you need it:
sudo apt-get install build-essential

can not install mvn 3.3.3 on ubuntu 14.04

I am using Ubuntu 14.04. I need to run mvn 3.3.3. Currently, the installed mvn version 3.0.5. When I enter
sudo apt-get install maven
it says
maven is already the newest version
is there a way to force install mvn 3.3.3?
Add a ppa containing maven 3.3.3, for example this one by executing these instructions on the command-line:
sudo apt-get purge maven maven2 maven3
sudo add-apt-repository ppa:andrei-pozolotin/maven3
sudo apt-get update
sudo apt-get install maven3
If you are not comfortable with a PPA (personal package archive) where you have no assurance of the provenance this is an alternative.
From a security perspective if you don't know where it came from don't install it.
In my linked article I retrieve the latest file from apache which is a known and trusted source. You can get the latest version
\#identify the latest version of maven
latest=$(curl http://www-us.apache.org/dist/maven/maven-3/ | tac | sed -ne 's/[^0-9]*\(\([0-9]\.\)\{0,3\}[0-9]\).*/\1/p' | head -1)
\#download it
wget http://www-us.apache.org/dist/maven/maven-3/$latest/binaries/apache-maven-$latest-bin.tar.gz
then install it from
\#Unpack it
sudo tar -zxf apache-maven-$latest-bin.tar.gz -C /usr/local/
\#create a sym link to it
sudo ln -s /usr/local/apache-maven-$latest/bin/mvn /usr/bin/mvn
as outlined in the link above.
I just installed maven 3.2.5.
To do that I downloaded the version I wanted as noted.
Unzipped using: tar -xvf apache-maven-3.2.5-bin.tar.gz
to: /opt/ and let p7zip do its thing.
Then in the terminal I did the following:
Check environment variable value:
echo $JAVA_HOME
Adding to PATH:
export PATH=/opt/apache-maven-3.2.5/bin:$PATH
typed: mvn -v
reviewed the output
For me the above worked fine.

Different version of pip installed when using sudo

Somehow, I've managed to install two versions of pip -- an older one (I assume installed using apt-get) when using:
pip --version
and a brand new version (I'm not sure how it got there) when using:
sudo pip --version
I have no idea how to get the new one uninstalled. Apt-get autoremove will get rid of the old one. Can somebody shed some light on what I've done wrong, and how to fix it?
When confronted with this mysteries you should always search the absolute path of what you're executing. You obviously are executing two different commands, and in order for that to happen the PATH environment variable of your user is different than the one of your root user. You can compare them by executing:
$ echo $PATH
$ sudo su
# echo $PATH
You can search through those directories and find the different pip scripts. My bet is that you have a local pip installation that lives in one of the directories mentioned in root's $PATH.
If you want to know the version of the pip installed by your package management tool, just issue the following command:
$ dpkg -l | grep python-pip
Run the following command if you want to know what files where installed by this package.
$ dpkg -L python-pip
Having found the culprit using this methods, you can now uninstall the version you don't need.

How can I install Apache Ant on Mac OS X?

I tried to install Apache Ant on my Mac and I followed the next steps :
I downloaded apache-ant-1.8.1-bin.tar.gz into my Downloads folder.
I moved the file to /usr/local/ using this commands : sudo sh and mv apache-ant-1.8.1-bin.tar.gz /usr/local/
Now I want to use cd /usr/local/ but it's not working, I get back "No such file or directory".
Then I used cd /usr/ and ls commands and it seems that the local folder is there. If I try to access it I get the same error.
Since I already used sudo su why I can't access it? Any ideas?
Ant is already installed on some older versions of Mac OS X, so you should run ant -version to test if it is installed before attempting to install it.
If it is not already installed, then your best bet is to install Homebrew (brew install ant) or MacPorts (sudo port install apache-ant), and use those tools to install Apache Ant.
Alternatively, though I would highly advise using Homebrew or MacPorts instead, you can install Apache Ant manually. To do so, you would need to:
Decompress the .tar.gz file.
Optionally put it somewhere.
Put the "bin" subdirectory in your path.
The commands that you would need, assuming apache-ant-1.8.1-bin.tar.gz (replace 1.8.1 with the actual version) were still in your Downloads directory, would be the following (explanatory comments included):
cd ~/Downloads # Let's get into your downloads folder.
tar -xvzf apache-ant-1.8.1-bin.tar.gz # Extract the folder
sudo mkdir -p /usr/local # Ensure that /usr/local exists
sudo cp -rf apache-ant-1.8.1-bin /usr/local/apache-ant # Copy it into /usr/local
# Add the new version of Ant to current terminal session
export PATH=/usr/local/apache-ant/bin:"$PATH"
# Add the new version of Ant to future terminal sessions
echo 'export PATH=/usr/local/apache-ant/bin:"$PATH"' >> ~/.profile
# Verify new version of ant
ant -version
For MacOS Maveriks (10.9 and perhaps later versions too), Apache Ant does not come bundled with the operating system and so must be installed manually. You can use brew to easily install ant. Simply execute the following command in a terminal window to install brew:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
It's a medium sized download which took me 10min to download and install. Just follow the process which involves installing various components. If you already have brew installed, make sure it's up to date by executing:
brew update
Once installed you can simply type:
brew install ant
Ant is now installed and available through the "ant" command in the terminal.
To test the installation, just type "ant -version" into a terminal window. You should get the following output:
Apache Ant(TM) version X.X.X compiled on MONTH DAY YEAR
Source: Error executing command 'ant' on Mac OS X 10.9 Mavericks when building for Android with PhoneGap/Cordova
If you are getting errors installing Brew, try uninstalling first using the command:
rm -rf /usr/local/Cellar /usr/local/.git && brew cleanup
Thanks to OrangeDog and other users for providing additional information.
If you have MacPorts installed (https://www.macports.org/), do this:
sudo port install apache-ant
If you're a homebrew user instead of macports, homebrew has an ant recipe.
brew install ant
To get Ant running on your Mac in 5 minutes, follow these steps.
Open up your terminal.
Perform these commands in order:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install ant
If you don't have Java installed yet, you will get the following error: "Error: An unsatisfied requirement failed this build."
Run this command next: brew cask install java to fix this.
The installation will resume.
Check your version of by running this command:
ant -version
And you're ready to go!
Use Brew is always good way to install ANT and other needs.
To install type below command on terminal.
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
after Brew installation , type
brew install ant
This will install Ant on your system. Also you will not need to worry about setting up the path.
Also i have documented on the same - How to Install ANT on Mac OS?
The only way i could get my ant version updated on the mac from 1.8.2 to 1.9.1 was by following instructions here
http://wiki.eclipse.org/Ant/User_Guide
MacPorts will install ant for you in MacOSX 10.9. Just use
$ sudo port install apache-ant
and it will install.

Resources