[JAVA] Introducing Eclipse IoT-Part2: Install Eclipse Neon.2 on macOS Sierra

A framework for the OSGi -based IoT Gateway in Eclipse Kura. The app deploys and uses the packaged OSGi bundle by adding the manifest and resource files to the jar file. This time, it is easy to install Eclipse IDE for Java Developers on macOS Sierra as a programming environment for Eclipse Kura's application. Make the initial settings.

Java 8

Install Java 8 from the macOS package management tools Homebrew (http://brew.sh/) and Homebrew Cask (https://caskroom.github.io/). You can also download the package directly from Oracle's Download Site (http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html).

If you haven't used Homebrew yet, install it.

$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

If installed, update the old Hombrew and packages to bring them up to date.

$ brew update && brew cleanup

Install Homebrew Cask.

$ brew install caskroom/cask/brew-cask

Add versions and search for java.

$ brew tap caskroom/versions
$ brew search java

The current version of the java package is 1.8.0_112.

$ brew cask info java
java: 1.8.0_112-b16
https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
Not installed

Install Java 8.

$ brew cask install java

The version 1.8.0_112 has been installed.

$ java -version
java version "1.8.0_112"
Java(TM) SE Runtime Environment (build 1.8.0_112-b16)
Java HotSpot(TM) 64-Bit Server VM (build 25.112-b16, mixed mode)

You can check the location of JAVA_HOME by executing the following command.

$ /usr/libexec/java_home -v 1.8
/Library/Java/JavaVirtualMachines/jdk1.8.0_112.jdk/Contents/Home

Set the environment variable JAVA_HOME to ~ / .bashrc.

$ echo 'export JAVA_HOME=`/usr/libexec/java_home -v 1.8`' >> ~/.bashrc
$ source ~/.bashrc
$ echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk1.8.0_112.jdk/Contents/Home

Maven

Install the Java app build tool Maven. SDKMAN! is convenient when installing VM development tools such as Maven, Gradle, and stb.

Install SDKMAN !.

$ curl -s get.sdkman.io | /bin/bash

Install Maven from the sdk command.

$ sdk install maven 

The version 3.3.9 has been installed.

$ mvn --version
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-11T01:41:47+09:00)

Eclipse Neon.2 (4.6.2)

Get the installer for macOS from the Download Site (http://www.eclipse.org/downloads/eclipse-packages/).

eclipse-downloads.png

Run the ʻEclipse Installer unzipped from the ʻeclipse-inst-mac64.tar.gz file. Start ʻEclipse` in the following directory.

~/eclipse/java-neon/Eclipse

Initial setting

When developing with multiple people, if you unify the Eclipse settings, you can get the diff accurately by version control. Please check the settings according to the team rules as it is my preference below.

Leave the file tab blank

Create a new profile in Java's Formatter from the Eclipse Preferences menu. I made it appropriately ʻEclise [my project]`.

Eclipse ->Environmental setting-> Java -> Code Style -> Formatter -> New -> Eclipse [myproject] 
java-formatter.png

Set the ʻIndentation` tab to the following settings.

java-formatter-indent.png

Set the XM file such as pom.xml used by Maven in the same way.

Eclipse ->Environmental setting-> XML -> XML Files -> Editor
xml-formatter.png

Remove whitespace at the end of the file

Create a new profile in Clean Up in Java Code Style.

Eclipse ->Environmental setting-> Java -> Code Style -> Clean Up -> New -> Eclipse [myproject]
java-cleanup.png java-cleanup-tailtrail.png

Run this Clean UP to remove trailing whitespace from existing source files.

src ->right click-> Source -> Clean UP

Use Save Actions to remove trailing whitespace when saving a file.

Eclipse ->Environmental setting-> Java -> Editor -> Save Actions
java-save-actions.png

Change the settings for Additional actions.

Additional actions -> Configure
java-save-actions-configure.png

theme

If you want to change the appearance of Eclipse with the Dark theme, make the following settings.

Eclipse ->Environmental setting-> General -> Appearance
appearance-theme.png

Plugin

Eclipse plugins are also distributed as OSGi bundles. I also like plugins, but for now, install some of the plugins you need first.

EGit plugin

The EGit plugin can operate Git from Eclipse. Add the EGit download site.

Help -> Install New Software... -> Add

Check and install the package you want to use.

egit.png

When using the Git repository from Eclipse via SSH, set the private key.

Eclipse ->Environmental setting-> General -> Network Connections -> SSH2
general-ssh2.png

Open the Git perspective.

Window -> Persepective -> Open Persepective -> Other -> Git

M2Eclipse (m2e) plugin

M2Eclipse can execute Maven commands from Eclipse. The plugin is already installed, but I will add a download site.

Help -> Install New Software... -> Add

Maven SCM Handler for EGit

Maven SCM Handler for EGit will resolve the pom.xml dependency by git clone directly from m2e.

Install from the m2e Marketplace in the dialog when importing a project into Package Explorer.

Package Explorer > Import > Maven > Check out Maven Projects from SCM > m2e Marketplace > m2e-egit
m2e-marketplace.png

Restart Eclipse and the installation is complete.

mToolkit plugin

From now on, I will build a simple OSGi application in Eclipse while reading Eclipse Kura Documentation. As a preparation, install the mToolkit plugin that can remotely connect to the OSGi container running on Eclipse Kura. .. OSGi management tools provided by ProSyst in the Bosch group It is included in the mBS SDK.

Help -> Install New Software... -> Add

Plug-in Development Environment (PDE) plug-in

Plug-in Development Environment (PDE) is a tool for developing Eclipse plug-ins. OSGi project development uses a wizard to create a Component Definition (component.xml).

Help -> Install New Software...

Enter ʻEclipse plug-in in the type filter text` field to search.

plugin-install.png

This completes the Eclipse Neon.2 setup for developing the Eclipse Kura OSGi bundle. Next time, I will build a sample project and run it.

Recommended Posts

Introducing Eclipse IoT-Part2: Install Eclipse Neon.2 on macOS Sierra
Install OpenJDK on macOS
Install Rails on macOS Catalina
Install tomcat + eclipse on mac
Install imagick on macOS Catalina + php 7.4 Note
How to install Eclipse (Photon) on Mac
Install Java 11 (OpenJDK: AdoptOpenJDK) on macOS with Homebrew
Install Java 14 (OpenJDK: AdoptOpenJDK) on macOS with Homebrew
Install Java 8 (OpenJDK: AdoptOpenJDK) on macOS with Homebrew
Install Java 8 (OpenJDK: Amazon Corretto) on macOS with Homebrew
Install Eclipse on Mac and translate it into Japanese
Install Java 8 (OpenJDK: Zulu Community) on macOS with Homebrew