Prepare Java development environment with Atom

This is the article on the 13th day of Tokyo University of Science Advent Calendar.

Ah. Children. Nice to meet you.

I'm a 4th year college student who usually makes games.

I am a young person for about 1 to 2 years for the first time to learn about the program in earnest.

When I was looking at the Advent calendar casually, there was a calendar of Tokyo University of Science, so I registered it.

I usually do C ++, but recently I've been forced to study Java. (No, when you start learning another language, you can see how you write the code with a superficial understanding w)

With that said, I've just set up a Java development environment with Atom, so I'll write about it.

I'm writing a technical article for the first time, so it may be full of mistakes, but I'm not sure.

The following is the story under Win10 64bit environment.

1. Download and install Atom

Here https://atom.io/

2. Download and install Java Development Kit

Here http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

Select the one that suits your PC environment, check the Accept License Agreement, and download it.

By the way, I chose windows x64 at the bottom because I am Win10 64bit.

3. Pass the JDK Path

My Computer-> Properties-> Advanced System Settings-> Preferences

You can open the preferences with. There should be an item called Path under the variables under System Environment Variables. If you find it, select it and click the edit button. A new window called "Edit Environment Variable Name" will open.

Then click the new button and enter the directory where you installed the JDK.

By the way, in my case it was "C: \ Program Files \ Java \ jdk1.8.0_111 \ bin".

You should now be able to pass the Path.

Let's check.

Open a command prompt and type Java -version.

java version "1.8.0_111"

If it is displayed, it is OK. If you don't see it, try restarting your PC.

4. Try Hello World with Atom

So let's write the code in Atom, compile and run it.

Start Atom and create a new file with File-> New File.

HelloWorld.java


public class HelloWorld
{
        public static void main( String[] args )
        {
                System.out.println( "Hello World!" );
        }
}

Copy and paste and save it as HelloWorld.java in any directory with File-> Save.

I named it C: \ dev \ HelloWorld.java.

Then compile and run it.

Please start the command prompt.

Change to the directory where you saved HelloWorld.java.

cd "HelloWorld.java directory"

In the case of I

cd C:\dev

is not it.

Once moved, compile.

javac HelloWorld.java

You should be able to compile by typing and running.

Just type Hello World and run

"HelloWorld!"

Is displayed, it is successful!

5. Introduce script

That said, this method is very, very cumbersome, so let's improve it.

Atom is a highly extensible editor. People all over the world are making various useful extensions.

Let's introduce one of them, "script".

script is a magical package that allows you to compile and run it in an editor.

Start Atom and File-> settings

Select Install and type script to install.

Now you can't run java from the editor.

Open HelloWorld.java and press shift + ctrl + b to see it. Probably the characters will be garbled and you will not understand. First, solve this garbled character problem.

Start Atom and click File-> Init Script. Open init.coffee and properly

process.env.JAVA_TOOL_OPTIONS = '-Dfile.encoding=UTF-8'

Let's add and save.

Now you can't run java from the editor.

Open HelloWorld.java and press shift + ctrl + b to see it. Probably

javac:File not found: HelloWorld.java

I get angry. Next, let's solve this problem.

Click Packages-> Script-> Conffigure Script

Enter the directory where HelloWorld.java is saved in the Current Working Directory ("C: \ dev" in my case) and click save as profile. Save it with a suitable name as Hello.

Now you can run java from the editor, and it will be.

Open HelloWorld.java

You should be able to compile and execute with shift + ctrl + Alt + b.

6. Let's add code completion function

From the menu as usual

File->Settings

Select Install and enter "autocomplete-java" to install. This will complement it.

Then enter "autocomplete-paths" to install. This will also complement the path.

7. Insert the chord formatter

Introduce uncrustify.

Here https://sourceforge.net/projects/uncrustify/files/uncrustify/uncrustify-0.64/

Dl the 64-bit version, decompress it, and save it in an appropriate folder.

Pass through Path. Add the location of uncrustify by editing the environment variable name

In my case it was "C: \ dev \ uncrustify-0.64-win64".

Then install the package "atom-beautify" on Atom.

Once installed, it must be configured.

From the menu File-> Settings

Search for atom-beautify from the package and open the setting.

If you go to the bottom, there is an item of "Java", so turn on Beautify On Save. Then specify the "uncrustify.cfg" file in ConfigPath.

In my case "C: \ dev \ uncrustify-0.64-win64 \ cfg \ uncrustify.cfg"

This should auto-format your code every time you save a Java file!

8. End

I think that the development environment is fairly comfortable. However, it may be a little annoying that the shortcut key for compilation and the shortcut key for auto-formatting are different. (Maybe you can edit init.coffee and have it auto-formatted every time you compile it. I don't know the details.)

Recommended Posts

Prepare Java development environment with Atom
Prepare Java development environment with VS Code
Java development environment
Java development environment memo
java development environment construction
Prepare the JVM language development environment with WSL
Prepare a scraping environment with Docker and Java
Build a Java development environment with VS Code
Prepare Python3 environment with CentOS7
Java development environment (Mac, Eclipse)
Build Java development environment with VS Code on Mac
Build Java development environment with WSL2 Docker VS Code
How to build Java development environment with VS Code
Prepare the environment for java11 and javaFx with Ubuntu 18.4
[Environment construction] Build a Java development environment with VS Code!
Build Java program development environment with Visual Studio Code
Java + Spring development environment construction with VirtualBox + Ubuntu (Xfce4)
I tried to create a java8 development environment with Chocolatey
[Eclipse Java] Development environment setting memo
Play Framework 2.6 (Java) development environment creation
About the current development environment (Java 8)
Java web application development environment construction with VS Code (struts2)
Build Java development environment (for Mac)
Build jooby development environment with Eclipse
Html5 development with Java using TeaVM
Java development environment (Mac, VS Code)
[Vagrant] Prepare LAMP development environment with Vagrant (centos + apache + MySQL + PHP)
Build WebAPP development environment with Java + Spring with Visual Studio Code
[Java development environment construction] Install OpenJDK 11 (Java 11) on macOS with Homebrew.
Install Java development environment on Mac
[Processing x Java] Construction of development environment
Laravel development environment construction with Docker (Mac)
Build a PureScript development environment with Docker
Java development environment construction memo on Mac
Prepare the format environment with "Rails" (VScode)
Create Spring Boot-gradle-mysql development environment with Docker
Let's create a Java development environment (updating)
What is Java and Development Environment (MAC)
Build a Java development environment on Mac
Build Java 8 development environment on AWS Cloud9
Java development with Codenvy: Hello World! Run
Spring Boot + Docker Java development environment construction
Game development with two people using java 2
Build a Wordpress development environment with Docker
Game development with two people using java 1
Launch java verification environment locally with Vagrant
[Personal memo] Java development environment is ready
Game development with two people using java 3
Java development with Codenvy: Console app debug
Lightweight PHP 7.4 development environment created with Docker
24 hours struggling with Android development, Java Optional
Java application development environment created in VM environment
[Java development] Java memory
[Java] Environment construction
Creating a java web application development environment with docker for mac part1
Java environment construction
Create a java web application development environment with docker for mac part2
Introduction to Java development environment & Spring Boot application created with VS Code
Let's get started with Java-Create a development environment ②
Let's get started with Java-Create a development environment ①
[Jakarta EE 8 application development with Gradle] 1. Environment construction