idea使用总结

运行一个java工程

Let's create a simple Java Hello World project. Click Create new project . The New Project Wizard opens.

idea使用总结_第1张图片

The main thing you should pay attention to is the Project SDK. SDK (Software Development Kit) is a set of software development tools that lets you develop applications. IntelliJ IDEA does not include an SDK, so If you have none, download and install it. Since we make a Java project, we need a Java SDK (JDK). After installation, click New and point to the installation folder of the JDK.

idea使用总结_第2张图片

In the New Project Wizard, you can choose technologies your project will support, but as you're making a plain Java Application, select none of them and just click Next. Then IDE offers you to create project from a template. We don't need this now, so click Next .

idea使用总结_第3张图片

Specify the name and location of the project. Click Finish .

idea使用总结_第4张图片

You have src folder inside your project. This is the folder for your source code. Right click on this folder, then choose New | Java Class .

idea使用总结_第5张图片

Enter the name of this class, say, quickstart.HelloWorld, and click Finish .

idea使用总结_第6张图片

Now the new class opens in the editor. Notice, that HelloWorld class is created in quickstart package. HelloWorld program text is a known one.

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

Every time you run an application, you need to have a configuration, which this process is based on. For creating a run configuration click Run | Edit configurations' Then click add.png and choose Application .

idea使用总结_第7张图片

Here you can specify the main class and program arguments. Since we have a simple application, we need to point the Main class only. Put quickstart.HelloWorld into the Main class text field. Print something in Name field, for example, HelloWorldConfig . Run configuration is ready.

idea使用总结_第8张图片

Now you can immediately run your application and make sure all works properly. Choose Run | Run 'HelloWorldConfig' from the main menu. Get a result!

idea使用总结_第9张图片

For debugging your application, choose Run | Debug. You should also have Run Configuration for this.

创建一个Java Web应用程序

创建一个新的工程,在左侧选择Java Enterprise

idea使用总结_第10张图片

idea使用总结_第11张图片

Click Finish and wait while IntelliJ IDEA is creating the project.

When the project is created, you'll see something similar to this in the Project tool window.

idea使用总结_第12张图片

Open index.jsp for editing: select the file in the Project tool window and press F4.

Between <body> and </body> type Hello World!

idea使用总结_第13张图片

In the upper-right part of the workspace, click run.

idea使用总结_第14张图片

IntelliJ IDEA compiles your source code and builds an application artifact. (We'll discuss artifacts a bit later. For now, the artifact is your application in deployment-ready format.)

After that, the Run tool window opens. IntelliJ IDEA starts the server and deploys the artifact onto it.

idea使用总结_第15张图片

Finally, your default web browser starts and you see the application output Hello World! there.

idea使用总结_第16张图片

In index.jsp, change Hello World! to Hello!.

idea使用总结_第17张图片

In the Run tool window, click the Update icon update_icon.

In the Update dialog, select Update resources and click OK

Switch to the web browser and reload the page to see the changes.

idea使用总结_第18张图片

Customize IDE appearance in File | Settings | Appearance & Behaviour | Appearance. . Intellij IDEA provides light and dark appearance themes. There can be several light ones, depending on your OS, and a dark one called Darcula .

idea使用总结_第19张图片

In File | Settings | Editor | Colors and fonts , you can choose any color scheme for the Editor, modify them and save them as your own.

idea使用总结_第20张图片

Try start typing anywhere with trees or lists and find out that speed search is working in many places.

idea使用总结_第21张图片

版本控制:idea自动集成了svn,只需要在安装svn客户端的时候选中命令行,其它的都不需要在idea里面进行配置,idea会自动扫描并集成进去。

对文件进行修改过后文件会变成蓝色

查看本地修改文件:

idea使用总结_第22张图片

在运行dubbo的main类时,为main类添加配置

idea使用总结_第23张图片

在选择这个main类时,去项目中找

idea使用总结_第24张图片

idea使用总结_第25张图片

修改属性文件编码为utf-8

idea使用总结_第26张图片

从svn上导下来一个新的java工程(maven)

idea使用总结_第27张图片

idea使用总结_第28张图片

idea使用总结_第29张图片

如果哪个类的包引错类了,可删除引用,在这个类上alt+enter,import正确的类
idea使用总结_第30张图片

svn更新代码时:

idea使用总结_第31张图片

这里就会展现哪些文件代码更新了,哪些文件是新建的,比eclipse好用多了

idea使用总结_第32张图片

查看dao层接口的实现方法用ctrl+alt键,不同于eclispe


创建一个maven web工程:

new maven工程,选择从webapp模板创建,一路next到finish。创建出来的项目没有java目录。新建一个java文件,双击,设java目录为sources,ok.

你可能感兴趣的:(idea使用总结)