Summary of Java environment settings for myself [mac]

OS selection

I think many people use it on Windows, but I chose mac as a personal hobby. It's often annoying, so I'm using a mac unless I'm doing VR or graphics processing.

Java installation

There are many things to say about Java, but this time I will use openJDK. Java open source.

For example, if you want to use java11, select "11.0.2 (build 11.0.2 + 9)" and enter it. http://jdk.java.net/archive/

Install it in a suitable place like this.

mv ~/Downloads/jdk-11.0.2.jdk/ /Library/Java/JavaVirtualMachines/

Setting environment variables

Set JAVA_HOME and PATH

.bashrc


#java                                                                                                           
#export JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk-10.0.2.jdk"                                            
export JAVA_HOME=$(/usr/libexec/java_home -v 11)
export PATH="$JAVA_HOME/bin:$PATH"
source ~/.bashrc


java -version
>openjdk version "11.0.2" 2019-01-15
>OpenJDK Runtime Environment 18.9 (build 11.0.2+9)
>OpenJDK 64-Bit Server VM 18.9 (build 11.0.2+9, mixed mode)

OK if the java version changes

Insert the IDE

If you use Java IDE, you have two choices, eclipse or InteliJ.

eclipse There are many shares that are overwhelmingly used at Japanese sites. Delicate to the version Sometimes it behaves in a way that I don't understand. https://mergedoc.osdn.jp/

IntelliJ costs money, but it's easy to use. The initial loading is slow, and there are not many Japanese documents. Follow evangelist-like people and get them to lead the community.

Create a workspace for eclipse (go to buy canned coffee)

Create a workspace directory. When I open eclipse, I'm told to select a workspace, so At that time, select the created directory. Import projects into this directory and put usable projects.

Start-up スクリーンショット 2020-04-10 7.18.58.png

Select a workspace. First of all, the startup is slow from here. Sometimes it's early. Let's go buy a canned coffee here. スクリーンショット 2020-04-10 7.17.14.png

スクリーンショット 2020-04-10 7.21.47.png スクリーンショット 2020-04-10 7.24.01.png

In this case, I am trying to import by selecting the folder m ... under the Download folder. There is no project called m ... in the workspace, so I checked the copy. スクリーンショット 2020-04-10 7.25.09.png

Import. Is displayed in the project explorer on the left. スクリーンショット 2020-04-10 7.30.16.png

By the way The project can be opened and closed. It's a good idea to close it when you don't need it. スクリーンショット 2020-04-10 7.30.29.png

スクリーンショット 2020-04-10 7.30.36.png

Inspector to javaEE

スクリーンショット 2020-04-08 22.03.28.png

Build Tool Selection: A Note

Names such as Maven, Gradle, and SBT come up. Those who build java. Select when launching a java project. The format is a little different.

java version selection

First put the path in the IDE スクリーンショット 2020-04-10 7.35.28.png

1.png

スクリーンショット 2020-04-09 21.22.36.png

Project right-handed Select your favorite java スクリーンショット 2020-04-09 20.12.11.png

スクリーンショット 2020-04-09 20.27.53.png

Beautiful beautiful

Refresh if weird errors remain

スクリーンショット 2020-04-09 21.24.42.png

スクリーンショット 2020-04-09 20.09.37.png

Framework preparation

If you want to use Spring, install it around here.

スクリーンショット 2020-04-10 7.46.20.png スクリーンショット 2020-04-08 22.00.41.png スクリーンショット 2020-04-08 22.01.41.png

You should have been able to set the environment.

There are some differences in the environment, but I'll leave the rest to other articles.

[mac] [Eclipse] Run Java Spring on jdk10 https://qiita.com/miyamotok0105/items/950667b4f05ef9b03c0c

[Ubuntu18 / mac] [IntelliJ] Set up tomcat9 with jdk10 https://qiita.com/miyamotok0105/items/3f5e429d80cfe2ca3f32


Extra edition

lombok library

java tends to be redundant, such as around getter setter. It can be omitted by using Lombok. You can omit kotlin, scala, etc., but there is pressure on the site depending on who maintains it.

Press Download from here to download the jar from the installer https://projectlombok.org/

Then let's put the jar. Ochimai.

#Just check
ls /hogehoge/lombok.jar
#Installation
java -jar lombok.jar

Build with CLI

When using gradle

#Put gradle on mac
brew install gradle
#Also clean
brew cleanup

#You will be able to use gradlew. gradlew is gradle+Crawler. Download at the same time when there is no module.
gradle wrapper
gradle build

./gradlew clean bootJar

When using maven

brew install maven
#Also clean
brew cleanup

mysql memo

mysql -uroot -p

create database hoge default character set utf8 collate utf8_general_ci;

docker sample

It works
https://github.com/spring-guides/gs-spring-boot-docker/tree/master/complete
https://github.com/codefresh-contrib/gradle-sample-app

wget https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh

To be honest, I can't move it.

callicoder/spring-security-react-ant-design-polls-app
https://github.com/callicoder/spring-security-react-ant-design-polls-app
wangenyong/spring-boot-deploy
https://github.com/wangenyong/spring-boot-deploy
gosutesu/study-java
https://github.com/gosutesu/study-java
SpringBoot + Kotlin +Try using Docker
https://qiita.com/qphsmt/items/10520fa92c06df022ef7
I can't find the eclipse plugin.
https://www.ksakae1216.com/entry/2017/02/24/063000

https://github.com/andrew-boutin/spring-rest-hello-world
https://github.com/bingqiao/spring-boot-example
https://github.com/tokuhirom/java-handbook
https://github.com/fishey2/java-component-template
https://github.com/yosuke0517/spring-boot-docker

I'm addicted to docker + eclipse environment

Conclusion: It's not working in my environment, but can I use remote debugging? https://qiita.com/cyclon2joker/items/71c481fe08c961f3acec

https://github.com/IdeaUJetBrains/SpringBootDockerDemoDebug

Prepare the development environment for Spring Boot and PostgreSQL with just docker-compose! → Isn't this sample strange? I haven't really enjoyed using docker. https://qiita.com/gosutesu/items/f45150cbde3f035c54dd

Refresh gradle with eclipse

スクリーンショット 2020-05-13 3.04.16.png

reference

https://qiita.com/seri_k/items/e978c1339ce51f13e297 https://qiita.com/takayamag/items/1469c59370df348240f8 https://qiita.com/spaciba_h_t/items/c96e96be99596b0a9fe4 https://qiita.com/niwasawa/items/fed67553845f8d1b72bc

Recommended Posts

Summary of Java environment settings for myself [mac]
[Java] Summary of for statements
[For beginners] Summary of java constructor
[OpenCV3.2.0] Eclipse (Java) settings (for Mac)
Build Java development environment (for Mac)
[Java & SpringBoot] Environment Construction for Mac
[Summary] Java environment preparation
Summary of Java support 2018
[Eclipse] Summary of environment settings * Updated from time to time
Summary of file reading method for each Java file format
[Java11] Stream Summary -Advantages of Stream-
[Java] Summary of regular expressions
[Java] Summary of operators (operator)
Java development environment (Mac, Eclipse)
Summary of Java language basics
Summary of Java Math class
Java installation location for mac
[Java] Summary of control syntax
Summary of java error processing
[Java] Summary of design patterns
[Java] Summary of mathematical operations
Ruby environment construction summary ~ mac version ~
Summary of [Java silver study] package
Initial settings of Netbeans (for JavaEE)
Enable OpenCV with java8. (For myself)
Java environment variable settings (Windows, AdoptOpenJDK11)
Settings for SSL debugging in Java
Java development environment (Mac, VS Code)
Generics of Kotlin for Java developers
Summary of object-oriented programming using Java
Install Java development environment on Mac
Implementation of clone method for Java Record
Summary of in-house newcomer study session [Java]
[Processing x Java] Construction of development environment
Settings for running CGI programs locally (for myself)
[java] Summary of how to handle char
Summary of changes other than JEP of Java10
Java development environment construction memo on Mac
[Java] Personal summary of conditional statements (basic)
Creating a java web application development environment with docker for mac part1
[For myself] Transfer of Servlet class processing
What is Java and Development Environment (MAC)
Build a Java development environment on Mac
List of download destinations for oracle java
[Java] [Maven3] Summary of how to use Maven3
Features of spring framework for java developers
Java Summary of frequently searched type conversions
Modern Java environment for Windows using Chocolatey
Create a java web application development environment with docker for mac part2
Summary of Java Math.random and import (Calendar)
[java] Summary of how to handle character strings
Links & memos for getting started with Java (for myself)
Java Development Basics ~ Development Environment Settings and Project Creation ~
[Java] Personal summary of classes and methods (basic)
[Java] Summary of how to abbreviate lambda expressions
Building a Ruby environment for classes on Mac
Solution for NetBeans 8.2 not working in Java 9 environment
Initial settings for rewriting Java projects to Kotlin
Install an older version of Docker for Mac
Switch between multiple versions of Java on Mac
Pre-introduction notes for JavaScript experienced learners of Java