Java Development Eclipse Usage tips (GO)

Source: Internet
Author: User

1, how to set the default code directory for SRC, the default output directory is bin?

Window->preferences->java->buil path, select Folders on the right to

2. How to set the Getx,setx property for fast local variables?
In the code, right-click->source->generae Getters and Setters, and in the popup dialog box, tick the attributes you want to add.

3. Quickly increase the TRY-CATCH statement block
The cursor is placed in the wrong line, then ctrl+1, in the drop-down list, select

4. Automatically compile when eclipse is saved, to cancel automatic compilation
Project->build automatically before the hook removed, you can not automatically compile the disk when the
At this point, you need to compile manually, select Project--Right-click->build Project

5.ctrl+shift+m pour in the required package,ctrl+shift+o pour in the required package and remove the extra package

6. How do I enter the parameters of the main function in eclipse?

Run-->run...-->arguments-->program Arguments variables. Write only one parameter per line. Add 3 parameters as follows: AAA,111,CCC
If it is myeclipse:run->run configurations ... Switch to the (x) =arguments tab

Test procedure:

public class Myhelloworld {public static void main (string[] args) {System.out.println ("number of args elements:" +args.length); for (int i=0;i<args.length;i++) {System.out.println ("args element" +i+ "value:" +args[i]);}}}

Operation Result:
Number of args elements: 3
The args element 0 value is: AAAA
The args element 1 value is: 1111
The args element 2 value is: CCCC

7, ctrl+shift+f format code, how to change the width of the line?
Window->preferences->java->code style->formatter dot Edit, in the tab line wrapping there is maximun line width after
You can see that the default is 80 because the default is not to change. So close profile in the previous window, first create a new one, such as Xuhktemple.
On the tab line wrapping Setup is possible. In this way, when you automatically format, you will have to wrap your own width.

8, the shortcut key when debugging.
To view the value of an expression: Ctrl+shift+i
If you want to debug the code inside the thread, press F5 to follow, you can first put the code inside the thread breakpoint, and then press F8 to jump to the breakpoint within the thread.

9, not close the program, is to close the current code window. Ctrl+w

10. How to display the number of lines of code
Window->preferences->general->editors->text Editors "Show line Numbers" before the Tick

11, when the Output window console has output, how to prohibit the popup has the Output window.
In particular, when running multiple programs, such as TCP communication, requires two programs running, want to see the output of a program, have not seen clearly, another program also has output, jumped out. How do I suppress a popup with an output window?
Window->preferences->run/debug->console, Cancel "show when program writes to standard out", "show when program writes To standard error "before the tick.

12, solve the code prompt shortcut key "alt+/" failure problem
In fact, by default he is set to CTRL + SPACEBAR. Let's change it over.
Window->preferences->general->keys, put word completion (complete word) shortcut key settings alt+/Delete, the content Assist (contents hint) shortcut key to change to alt+/

13, enhance the prompt function, the default input point when the prompt box, if you do not encounter points need to manually press the shortcut key alt+/just out of the box, that can not press the shortcut key, enter any letter immediately out of the prompt box? The answer is yes, as set out below.
Window->preferences->java->editor->content Assist. After the window sees the option "Auto Activation triggers for Java" There is only one point, change him to
. ABCDEFGHIJKLMNOPQRSTUVWXYZ (So enter any letter you can start the hint.)

14. How to export the import configuration.
If you have a good configuration, you want to use together, so that others do not have a configuration, we need to export the configuration.
Export:file->export->general->preferences-> Point Button "Next", tick the "Export All", select the exported file path, click the button "Finish"
Import:file->import->general->preferences-> Point button "Next", tick "Export all", select Import file path, click button "Finish"

15, note shortcut key ctrl+/, if the failure can be reset
Window->preferences->general->keys in the search line input toggle Comment, all toggle Comment shortcut keys are changed to ctrl+/. It's not good for me to change my face. Reset only by default

16, Ctrl+q jump to the last edit place

17. Delete all Breakpoints
Window->open Perspective->debug, in the upper right corner of the Breakpoints window, put a check box in front of the tick to cancel it, or directly point to the Breakpoints window "Remove all Breakpoints "button.

18. Let eclipse restore the default view interface
Reset Perspective Window

19, the prompt to select the work area of the interface re-appear when you start
Window->preferences->general->startup and Shutdown->workspase check prompt for workspase on Startup

20. How do I set command line parameters in eclipse? such as the-D parameter
-d<propertyname>=value
Set the property name/value pair in the system properties of the virtual machine, and the application running on top of this virtual machine can get the value of System.getproperty ("PropertyName"). If there are spaces in value, you need to enclose the value in double quotation marks, such as-dname= "space string". This parameter is typically used to set system-level global variable values, such as configuration file paths, which should be accessible anywhere in the program. Depending on your project situation, especially when cross-platform.
For example, the following test class TESTD:

 import   java.util.Properties;  public  class   TestD { static  void   main (string[] args) {Proper        Ties Propsys  = System.getproperties ();        String proid  = Propsys.getproperty ("proid" );    System.out.println ( "proid=" +proid); }}

As in the DOS window, add the-D parameter proid for class TESTD. Input command java-dproid=test01 TestD
Operation Result:
proid=test01
So how do you add-dproid=test01 under Eclipse?
Run->run configurations ... Switch to the "(x) =arguments" tab, (see above 6, how do I enter the parameters of the main function in Eclipse), in VM Arguments: Enter-dproid=test01 below.

21. Add shortcut keys for import and export
Window->preferences->general->keys enter export in the search line and enter ctrl+alt+o after binding. Import shortcut settings similar to the search line, enter import and set it up.

http://blog.csdn.net/aspnet2002web/article/details/1925841

Related Article

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.