知识库 知识库
首页
  • Hyperskill - Java

    • Java basic
    • Java OOP
    • 应知
    • 扩展
    • IO & Stream
    • Error & Exception
    • Algorithm & Data structure
    • Design pattern
    • Web
    • Spring boot
  • 练习题

    • 选择题 & 填空题
    • 代码题
  • Frank - Java与生活 (OOP)

    • 参考资料
    • Java基础
    • OOP上半部分
    • OOP下半部分
  • Frank - Java API进阶

    • Base API
    • Unit Test and main function
  • 学习笔记
  • 学习笔记

    • 数据库
  • Frank - MySQL删库跑路

    • 安装、连接、配置
    • 基本操作——数据库
    • 基本操作——表
    • 基本操作——数据
    • 数据类型
    • 列属性完整性
    • 数据库设计思维
    • 单表查询
    • 多表查询
  • 学习笔记

    • 其它
  • Frank - Linux现代方法

    • 必知
    • 命令
    • 技巧
  • 技术文档
  • Git
  • GitHub技巧
  • 前端
  • Khan Academy - 语法
  • Monthly
  • 阅读
  • Others
  • 学习
  • 面试
  • 心情杂货
  • 实用技巧
  • 友情链接
收藏
  • 标签
  • 归档
GitHub (opens new window)

Jim FuckPPT

Java小学生
首页
  • Hyperskill - Java

    • Java basic
    • Java OOP
    • 应知
    • 扩展
    • IO & Stream
    • Error & Exception
    • Algorithm & Data structure
    • Design pattern
    • Web
    • Spring boot
  • 练习题

    • 选择题 & 填空题
    • 代码题
  • Frank - Java与生活 (OOP)

    • 参考资料
    • Java基础
    • OOP上半部分
    • OOP下半部分
  • Frank - Java API进阶

    • Base API
    • Unit Test and main function
  • 学习笔记
  • 学习笔记

    • 数据库
  • Frank - MySQL删库跑路

    • 安装、连接、配置
    • 基本操作——数据库
    • 基本操作——表
    • 基本操作——数据
    • 数据类型
    • 列属性完整性
    • 数据库设计思维
    • 单表查询
    • 多表查询
  • 学习笔记

    • 其它
  • Frank - Linux现代方法

    • 必知
    • 命令
    • 技巧
  • 技术文档
  • Git
  • GitHub技巧
  • 前端
  • Khan Academy - 语法
  • Monthly
  • 阅读
  • Others
  • 学习
  • 面试
  • 心情杂货
  • 实用技巧
  • 友情链接
收藏
  • 标签
  • 归档
GitHub (opens new window)
  • Hyperskill - Java

    • Java basic

    • Java OOP

    • 应知

    • 扩展

      • Theory:Units of information
      • Theory:IDE
      • Theory:IDEA
        • IntelliJ IDEA
        • Creating the first project in IntelliJ IDEA
        • Writing
        • IDEA Settings
        • How to start my program?
        • Conclusion
      • Theory:Build tools
      • Theory:Operating systems
      • Theory:Gradle basics
      • Theory:Basic project with Gradle
      • Theory:Building apps using Gradle
      • Theory:Dependency management
      • Theory:Formatted output
      • Theory:Libraries
      • Theory:Frameworks
      • Theory:Modules
      • Theory:Introduction to software architecture
      • Theory:Class Diagrams
      • Theory:Text blocks
      • Theory:YAML
      • Theory:XML
      • Theory:JSON
    • IO & Stream

    • Error & Exception

    • Algorithm & Data structure

    • Design pattern

    • Web

    • Spring boot

  • 练习题

  • Frank - Java与生活

  • Frank - Java API进阶

  • 学习笔记

  • Java
  • Hyperskill - Java
  • 扩展
Jim
2022-10-08
目录

Theory:IDEA

# IntelliJ IDEA

IntelliJ IDEA is an intelligent, context-aware IDE for working with Java and other JVM languages like Kotlin, Scala, and Groovy on all sorts of applications. It has an ergonomic user interface, supports a lot of plugins, and provides a very powerful automatic code completion feature. IntelliJ IDEA has three editions: community, enterprise, and educational. All editions support multiple programming languages, including Java, Kotlin, Scala, and some others. The educational edition has a convenient functionality for downloading programming problems from the Hyperskill platform and checking your solutions directly from the IDEA. However, the community edition is enough to complete any project.

img

The logo of IntelliJ IDEA

If you want to know more about this IDE, please, visit the official website (opens new window). You can also learn about its more powerful features (opens new window).

# Creating the first project in IntelliJ IDEA

Let's write some text using IntelliJ IDEA. Here we assume that you have the community edition already installed on your computer. The other editions have minor differences in the interface.

\1. If no project is currently open in IntelliJ IDEA, click Create New Project on the Welcome screen. Otherwise, select File | New | Project. As a result, the New Project wizard opens.

img

The color scheme of your window may be different. Later, in the IDEA Settings paragraph, is a description of how to change it.

\2. In the panel on the left, select your language (for example, Java or Kotlin). There is also an option to create an empty project without any language support:

img

You may see additional options, like the JDK (Java Development Kit), that you may want to modify for your project. Just leave them unchanged for now.

\3. The next pages may propose different templates. Code templates are prewritten snippets of code provided by the IDE. Now we are going to study the very basics of IntelliJ IDEA, and do everything from scratch, so we aren't selecting any of the options. Just leave the default.

img

\4. On the final page, specify the project name (e.g. HelloWorld). If necessary, you can change the project location on disk, but you can also use one suggested by IntelliJ IDEA.

img

\5. Click Finish.

Wait while IntelliJ IDEA creates the project. When this process is complete, the structure of your new project is shown in the Project tool window.

Let's take a look at the project structure on the left side of the window.

img

There are two top-level nodes:

  • HelloWorld. This node represents your project module. The .idea folder and the file HelloWorld.iml are used to store configuration data for your project and module respectively. The folder src is for your source code.
  • External Libraries. This is a category that represents all the "external" resources necessary for your development work. The standard files of your project language are placed there. Also, you can add other resources manually.

# Writing

Now we are going to write a text for the Hello World project.

\1. In the Project tool window, select the src folder and select File | New, or right-click the folder src and select New from the context menu.

\2. In the New menu, select File.

img

\3. In the New File dialog that opens, type text.txt in the text field. Press Enter to create the file.

img

Now, you can see this file in the src folder. At the same time, the file opens in the editor. So, we've just created a text file and in the future, you can use the same way to create source code files for your language.

We are to create something like this:

This is my test text file in IDEA.

Or is there a mistake?
1
2
3

But do not rush! Let's do it gradually, step by step.

As you see, there is a typo. And our IDE warns us about it:

img

There are many features of the IDEA. Now we want to introduce you to one called "Context actions". Place the cursor at the wrong word, press Alt+Enter, select Typo: Change to... with arrows and press Enter, and finally select the correct word from the list and press Enter again. The typo disappears 😃

img

img

IDEA supports other context actions for code, give it a try.

Congratulations! You have written your probably first text in IntelliJ IDEA and understood that there is a hidden power. You can always refer to the more complete official tutorial (opens new window). We especially recommend reading about templates (opens new window) and code completion (opens new window).

# IDEA Settings

IntelliJ IDEA has a lot of settings that can be configured as you wish. Go to File | Settings. There are many sections in the open Settings tab.

img

As an example, please go to Appearance & Behavior | Appearance and choose different themes. In this lesson, we use Darcula.

img

Note: If you would like to find something in the settings, use the search box as shown below.

img

# How to start my program?

Of course, you can create and run your programs in IDEA. Just create a new language-specific file, write content, find the green triangle "run" button ( img ), and click it.

Sometimes, your program cannot be started from IDEA for various reasons.

  1. Make sure your program contains the main method. If not, then add it.
  2. The source code should be placed inside the src directory, not next to it.
  3. Sometimes no JDK is selected. To fix this, go to File | Project Structure | Project settings | Project and then set your JDK in the Project SDK section.

img

If you have another problem, please write it in the comments or Google it.

# Conclusion

IntelliJ IDEA is one of the best IDEs for Java and JVM languages. It allows programmers to easily work and code while having convenient access to all of its functions. Features like automatic code completion and ergonomic UI make the working experience quite pleasant.

编辑 (opens new window)
上次更新: 2022/10/12, 17:01:25
Theory:IDE
Theory:Build tools

← Theory:IDE Theory:Build tools→

最近更新
01
《挪威的森林》
04-14
02
青钢影
04-14
03
Processing strings
02-18
更多文章>
Theme by Vdoing | Copyright © 2022-2023 Jim Frank | MIT License
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式