Experiment with familiarity with a Java development environment

Source: Internet
Author: User

Experiment with familiarity with a Java development environment

First, the contents of the experiment

1. compiling and running a simple Java program using the JDK

2. edit, compile, run, and debug Java programs using Eclipse

Second, the experimental requirements

1. no linux Linux Basic Primer (new version) " Vim editor   Courses

2. Complete the experiment, write the experiment report, the Experimental report template see the results of the operation, the problems encountered ( tools find, install, use , program editing, debugging, running, etc. , Solution (empty method such as " Check network " , " , " reading " 0 " and Analysis (from which you can get what revelation, what harvest, lessons, etc.).

3. report the time of your PSP (Personal software Process)

Steps

Take

Percentage

Demand analysis

30min

20%

Design

30min

20%

Code implementation

50min

30%

Test

20min

15%

Analysis Summary

20min

15%

4. Experimental Knowledge Points:

1. installation location and difference of JVM,JRE,JDK ;

2. command line run javac,java;javac-cp; JAVA-CP ;

3. Path,classpath,sourcepath setting method and application;

4. Package Management:package;import;javac-d;

5. Eclipse (Netbeans) manages Java projects, debugging: breakpoints, stepping, etc.;

6. Java Basic syntax: type and type conversion; variables; operators; Process control, etc.;

7. use of JDK help documentation;

Third, the experimental steps

(i) Java program Development under command line

Because the lab building can't get in,

(ii) development and commissioning of Java programs under Eclipse

1. Click the Eclipse EE icon to open Eclipse

2. in Eclipse , click file->new-> Java Project to create new java projects

3. Enter the project name hellojdb and click the finish button to complete

4. in Eclipse , click file->new->class to create a new Java class

5. Enter the package name Fyj according to the Java Code Specification , class name Hellojdb (capitalize the first letterof the word), and tick the automatically generate main function option, and then click the Finish button

6. Enter the following code:

Package fyj;

public class Hellojdb {

public static void Main (string[] args) {

TODO auto-generated method stubs

int i=8;

int j=9;

int Sum=add (I,J);

SYSTEM.OUT.PRINTLN (sum);

sum=0;

for (i=0;i<=100;i++)

Sum +=i;

SYSTEM.OUT.PRINTLN (sum);

}

public static int Add (int augend,int addend)

{

int sum=augend+addend;

return sum;

}

}

7. Click Run

8. Open the Debug view by clicking window->open perspective->debug , which has set breakpoints and a single step run

9. Step execution efficiency is slow, if we feel that the 6th line to the 10th line of code is no problem, want to let the program run directly to line 11th, what to do? First we'll set the breakpoint on line 11th and then click Resume

11. One-Step execution efficiency is slow also leads to another problem, such as a cycle in the middle of a problem? You can then resolve the issue through conditional breakpoints. When debugging a loop code, there is a value that we pay particular attention to when we look at the value of the variable in the Variable tag , such as when we are paying attention to sum at this time, we can see how the sum changes with each step of the execution.

To set a conditional breakpoint, we right-click on the left side of line 11th and select Breakpoint Properties

Four. Problems encountered and how to resolve them

Set the breakpoint time spent a long time, can not find tools to cause, the tutorial is English version, but I put the software in Chinese, by looking for students to test documents and ask students to find location.

Five. Experimental harvesting

Before starting to do an experiment to understand the use of eclipse, so the second part of the time to get started, there is a part of the problem is in the preservation of the time, I use a way to cut the map, but after the copy and paste, asked the classmate has been resolved, directly upload pictures, unfortunately, the experimental building into a lot of times not to go , the experiment can not be completed, after the experiment to better understand the use of eclipse, found that eclipse is a good learning tool, will be more practice in the future.

Experiment with familiarity with a Java development environment

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.