未登录,请登录后再发表信息
最新评论 (0)
播放视频

《迪哥Java教程》#3 在Netbeans里创建Java项目

How to create a Java project in Netbeans? - 003

好吧 那么我们会开始使用IDE从这点出发
Alright so we’re gonna start using an IDE from this point forward.
我可以指导你完成步骤 使用一个IDE可以使得开发更简单
So I can walk you through the steps. Using an IDE makes development much
因为它提供了代码(自动)补齐功能和错误检查功能 就像你本人完成那样
easier because it provides code completion, and error checking as you go.
我要在这里做的第一件事就是启动NetBeans
Here first thing I’m going to do is start NetBeans.
当我进到NetBeans后 我将创建一个新的Java项目
Once I’m in Netbeans, I’m going to create a new Java project.
项目就是用来组成一个应用程序的所有文件的集合
A project is just the collection of files used to make an application.
我要选择“File” 然后“New Project”
I’ll select, “File”, then “New Project”.
这将弹出一个对话框窗口 我要选择Maven这一类别
This will bring up a dialog window. I’m going to select Maven for the category.
Maven是一个用来构建大型项目的工具
Maven is a tool used to build larger projects.
它也能使项目更容易把源代码从一台机器
It also makes it much easier to take source code on one
移植到另一个机器上编译 我建议你
machine to another and have a compile. It’s something I recommend that you look
看看
into.
关于使用Maven的教程都在DeegeU.com
All the Java tutorials on DeegeU.com use Maven.
这里有两个教程给你
There are two tutorials to give you
如果感兴趣 你可以对Maven深入了解一下 在项目类型这一栏 我
a deeper look at Maven if you like. For the project type, I’m going to select
将要选择Java application 点击下一步
Java application. Hit next.
这一行的名字我使用“Primitives”
For the name I’ll use Primitives.
你可以改成任何你想要的名字 这是你项目的名称
You can call it anything you like. This is the name to reference your project.
程序也会在其他地方使用这个名字
It will use the name for other parts here.
你可以保持默认然后点击完成按钮 它将创建一个·
You can accept the defaults and click finish. This creates an empty
新的项目
project.
现在我们需要添加一个Java文件进行编辑 打开“源码包”文件夹
So now we need to add a Java file to edit. Open the “Source Packages” folder.
这里应该有一个叫做包的东西在源码包文件夹下
There should be something called a package under the source packages folder.
如果没有 选择默认包 我们在以后的课程中
If there isn’t, select default package. This is something that we’re gonna cover
还会提到这些
in later lessons.
右击然后选择“New”
Right click and select “New”.
然后选择“Java Class”并给这个类取名
Then select “Java Class”. Name the class
取名”PrimitivesExample” 点击完成按钮
“PrimitivesExample” and click finish.
这将创建一个Java文件
This will create a Java file.
看到这里有熟悉的感觉么
Does it look familiar?
这应该
It should
看起来和我们上节课创建的Hello World程序类似
look similar to the Hello World app we created in last lesson.
这只是缺少了主方法和Hello world的代码部分
It’s just missing the main method and the hello world part.
因此让我们加上主方法 然后print代码”Hello World”
So let’s add the main method. Then at the print statement to say “Hello World”.
我们只是想测试下这个IDE
We just want to test the IDE.
你所看到的我打出来的弹出窗口被称为代码完成窗口
The pop-ups you’re seeing as I type are called code completion windows.
IDE在帮我补齐代码 我将用“test”来替换“Hello World”
It’s trying to complete what I type. I’ll just say “test” instead of “Hello World”.
通过点击左上角的文件然后点击保存
Save the file
现在让我们来运行这个程序
by going to File and Save. Now let’s run the application.
选择“Run”
Select “Run”,
然后“Run Project”
then “Run
在你第一次运行这个程序时 它将会问
Project”. The first time you run this, its gonna ask
为主方法使用哪一个类 我们只有一个类
what class is used for the main method. We only have one so
所以很好选
the choice is pretty easy.
它就开始在控制台编译并运行这个程序了
It should compileand run the application in the console window.
在IDE下方那块区域就是控制台了
The console is the area at the bottom the of the IDE.
如果你在命令行中运行它 它会模仿你看到的
It mimics what you’d see if you ran it from a command line.
因为我们使用Maven编译 所以它在这的输出比正常情况下更多的
It prints more than normal here, because we’re using Maven to compile.
你可以看到它打印出来“test” 所以成功了
You can see it printed “test”, so it works.
这就是我们创建一个java应用程序的步骤
And that’s how we’re going to create projects for Java applications.
嘿 感谢观看这一期的视频
Hey thanks for watch the video!
如果你想评估你究竟学了多少 你可以在DeegeU.com中
There’s a quick quiz for this on DeegeU.com if you’d like to gauge how much you
来次小测试
learned.
如果你喜欢我们的视频 请在YouTube中点击喜欢
If you like the videos are seeing, please let me know by liking the video and
并订阅DeegeU 我将非常感谢你们的支持
hitting the subscribe button to the DeegeU channel on YouTube. I’d
如果你有任何疑问或问题
really appreciate that! If you have concerns or questions please leave them
请在下方评论区留言或者在DeegeU.com提问
in the comments below or on DeegeU.com.
有一个在DeegeU.com头版的民意调查
There’s a poll on the front page in DeegeU.com,
这样可以让我们知道什么主题更受欢迎
so you can let me know what topic is covered next.
感谢您的收看让我们下期再见!
Thanks for watching and see in the next video!

发表评论

译制信息
视频概述

迪哥Java教程,零基础学Java。这一期将介绍如何在NetBeans中创建项目

听录译者

收集自网络

翻译译者

闷蛋(ಥ﹏ಥ)

审核员

萨默之光

视频来源

https://www.youtube.com/watch?v=xur-ldIGqjk

相关推荐