运行一个java工程
Let's create a simple Java Hello World project. Click Create new project . The New Project Wizard opens.
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.
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 .
Specify the name and location of the project. Click Finish .
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 .
Enter the name of this class, say, quickstart.HelloWorld, and click Finish .
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 and choose Application .
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.
Now you can immediately run your application and make sure all works properly. Choose Run | Run 'HelloWorldConfig' from the main menu. Get a result!
For debugging your application, choose Run | Debug. You should also have Run Configuration for this.
创建一个Java Web应用程序
创建一个新的工程,在左侧选择Java Enterprise
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.
Open index.jsp
for editing: select the file in the Project tool window and press F4.
Between <body>
and </body>
type Hello World!
In the upper-right part of the workspace, click .
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.
Finally, your default web browser starts and you see the application output Hello World!
there.
In index.jsp
, change Hello World!
to Hello!
.
In the Run tool window, click the 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.
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 .
In File | Settings | Editor | Colors and fonts , you can choose any color scheme for the Editor, modify them and save them as your own.
Try start typing anywhere with trees or lists and find out that speed search is working in many places.
版本控制:idea自动集成了svn,只需要在安装svn客户端的时候选中命令行,其它的都不需要在idea里面进行配置,idea会自动扫描并集成进去。
对文件进行修改过后文件会变成蓝色
查看本地修改文件:
在运行dubbo的main类时,为main类添加配置
在选择这个main类时,去项目中找
修改属性文件编码为utf-8
从svn上导下来一个新的java工程(maven)
如果哪个类的包引错类了,可删除引用,在这个类上alt+enter,import正确的类
svn更新代码时:
这里就会展现哪些文件代码更新了,哪些文件是新建的,比eclipse好用多了
查看dao层接口的实现方法用ctrl+alt键,不同于eclispe
创建一个maven web工程:
new maven工程,选择从webapp模板创建,一路next到finish。创建出来的项目没有java目录。新建一个java文件,双击,设java目录为sources,ok.