Since the company was closed, I tried to prepare the Java environment with Visual Stuido Code (hereinafter VS Code), which has been evolving all the time recently. The platform is Ubuntu 18.04. Try using Gradle as well.
You can download it from the official website, but if you use Ubuntu, you can use Ubuntu Make, so you can use it. Now version 1.28.2 is installed.
umake ide visual-studio-code
umake --version
> 16.11.1
If you enter "java" in the plugin search, a lot of it will appear, but if you include "Java Extension Pack", it seems that the following plugins are included together, so I will include this.
Reboot to reload and you're done.
The latest is Java 11, but this time Java 8 that was originally included is used instead.
The installation procedure will be omitted here as it will hit as many times as you like if you google.
Check about $ JAVA_HOME
.
echo $JAVA_HOME
> /usr/lib/jvm/java-8-oracle
Official currently says 4.10.2, but I used 3.4.1 installed with apt.
apt install gradle
If you have gradle, you can easily make it, so I left it to you.
The point is to specify --type java-application
.
mkdir project_name_dir
cd project_name_dir
gradle init --type java-application
tree
.
├── build.gradle
├── gradle
│ └── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── settings.gradle
└── src
├── main
│ └── java
│ └── App.java
└── test
└── java
└── AppTest.java
By the way, the contents of build.gradle look like this (comment line deleted)
build.gradle
apply plugin: 'java'
apply plugin: 'application'
repositories {
jcenter()
}
dependencies {
compile 'com.google.guava:guava:20.0'
testCompile 'junit:junit:4.12'
}
mainClassName = 'App'
Try using gradle to perform tasks that you might use. It's still a template, so everything should work fine.
gradle build
gradle run
gradle check
gradle clean
Select the created project directory and work.
Set the value of $ JAVA_HOME
in" java.home "of settings.json
.
You can edit the file directly or set it in the GUI.
grep java.home ~/.config/Code/User/settings.json
> "java.home": "/usr/lib/jvm/java-8-oracle"
Set .vscode/tasks.json
to execute the gradle command.
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"type": "shell",
"command": "./gradlew build"
},
{
"label": "run",
"type": "shell",
"command": "./gradlew run",
"group": {
"kind": "build",
"isDefault": true
}
},
{
"label": "clean",
"type": "shell",
"command": "./gradlew clean"
},
{
"label": "check",
"type": "shell",
"command": "./gradlew check"
}
]
}
F1
key →" run task "→ Select the task set in tasks.json.
You can use Ctrl
+ Shift
+ B
to execute the default task run
.
If you set a breakpoint, it will stop at that point, so you could debug without being aware of it.
I can't say anything yet because I just touched it,
--It was not possible to refactor including the directory name such as the package name. --Shortcut keys such as code jumps are similar to Visual Studio (eclipse users may be confused) ――I want you to do your best to complement the documentation comment out.
I would like to expect future growth.
Recommended Posts