怎么删除右键菜单看图王 Open with HbuilderX

输入关键字或相关内容进行搜索
用户设置这么写的
&node.path&:&C:\Program Files\nodejs&,
&editor.colorScheme&:&Default&
&browsers.config&: {
&Chrome.path&:&C:\Users\naphat\AppData\Local\Google\Chrome\Application&
控制台显示这个
[JSHINT] C:/Users/naphat/AppData/Roaming/HBuilder X/user/settings.json: line 4, col 1, Unrecoverable syntax error. (57% scanned).
[JSHINT] 1 error
添加chrome.exe后显示如下问题
&node.path&:&C:\Program Files\nodejs&,
&editor.colorScheme&:&Default&
&browsers.config&: {
&Chrome.path&:&C:\Users\naphat\AppData\Local\Google\Chrome\Application\chrome.exe&
[JSHINT] C:/Users/naphat/AppData/Roaming/HBuilder X/user/settings.json: line 4, col 1, Unrecoverable syntax error. (57% scanned).
[JSHINT] 1 error
[JSHINT] C:/Users/naphat/AppData/Roaming/HBuilder X/user/settings.json: line 4, col 1, Unrecoverable syntax error. (57% scanned).
[JSHINT] 1 error
[JSHINT] C:/Users/naphat/AppData/Roaming/HBuilder X/user/settings.json: line 4, col 1, Unrecoverable syntax error. (57% scanned).
[JSHINT] 1 error
路径都是双斜杠
如能解答叩谢 万分感激 刚入行的小白
赞助DCloud可免广告,
要回复问题请先或
最新活动: 19 小时前
赞助DCloud可免广告,Visual Assist X Options
注释设置-类
类的注释,如下图显示snippet源
其中的snippet代码如下
//////////////////////////////////基本信息///////////////////////////////////////////////////////
// &&免责声明 &&
Copyright (c) $YEAR$-$YEAR$ by Xie Zhimin All Rights Reserved
// &&创建日期 &&
// &&创建时间 &&
$YEAR$年:$MONTH_02$月:$DAY_02$日
$HOUR_02$时:$MINUTE$分:$SECOND$秒
$FILE_BASE$.$FILE_EXT$
// &&文件路径 &&
$FILE_PATH$
// &&隶属工程&&
$projName$
// &&当前用户 &&
%USERNAME%
&& 《$reference$》
&& 【$purpose$】
// &&设计技术 &&
//////////////////////////////////迭代修改///////////////////////////////////////////////////////
// &&修改日期 &&
$YEAR$年:$MONTH_02$月:$DAY_02$日
$HOUR_02$时:$MINUTE$分:$SECOND$秒
/////////////////////////////////////////////////////////////////////////////////////////////////
实际结果展示
//////////////////////////////////基本信息///////////////////////////////////////////////////////
// &&免责声明 &&
Copyright (c)
by Xie Zhimin All Rights Reserved
// &&创建日期 &&
// &&创建时间 &&
2016年:09月:03日
12时:04分:05秒
// &&文件路径 &&
E:\ssss\dddd\hehe\hehe
// &&隶属工程&&
// &&当前用户 &&
Administrator
&& 《http://www.autodesk.com/cn/3dsmax/2012help/index.html?url=files/GUID-65B76EDE-BB5--3591.htm,topicNumber=d28e605061》
&& 【完成3D模型设计】
// &&设计技术 &&
//////////////////////////////////迭代修改///////////////////////////////////////////////////////
// &&修改日期 &&
2016年:09月:03日
12时:04分:05秒
/////////////////////////////////////////////////////////////////////////////////////////////////其他的snippet代码
//////////////////////////////////基本信息///////////////////////////////////////////////////////
// &&免责声明 &&
Copyright (c) $YEAR$-$YEAR$ by Xie Zhimin All Rights Reserved
// &&创建日期 &&
// &&创建时间 &&
$YEAR$年:$MONTH_02$月:$DAY_02$日
$HOUR_02$时:$MINUTE$分:$SECOND$秒
$FILE_BASE$.$FILE_EXT$
// &&文件路径 &&
$FILE_PATH$
// &&隶属工程 &&
$projName$
// &&当前用户 &&
%USERNAME%
&& 《$reference$》
// &&参考文章 && 《$ReferenceArticle$》
&& 【$purpose$】
// &&设计技术 &&
//////////////////////////////////迭代修改///////////////////////////////////////////////////////
// &&修改日期 &&
$YEAR$年:$MONTH_02$月:$DAY_02$日
$HOUR_02$时:$MINUTE$分:$SECOND$秒
/////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////使用环境///////////////////////////////////////////////////////
1.1 windows
| 2 客户端
2.1 windows
| 3 浏览器
3.1 是否需要使用服务
3.1.1 lighttpd
3.1.2 apache
3.1.3 nginx
3.2 浏览器兼容性
3.2.1 Internet Explorer(微软公司旗下浏览器)
3.2.2 google chrome(google旗下浏览器)
3.2.3 firefox(mozilla公司旗下浏览器)
3.2.4 safari(苹果公司旗下浏览器)
3.2.5 opera(挪威厂商opera旗下浏览器)
| 4 字符集
4.3 Unicode
4.4 Unicode big endian
/////////////////////////////////////////////////////////////////////////////////////////////////
没有更多推荐了,
不良信息举报
举报内容:
Visual Assist X Options
注释设置-类
举报原因:
原文地址:
原因补充:
最多只允许输入30个字
加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!Cocos2d-x初入学堂(10)--&ParticleEditor粒子编辑器
File:save,save as(导出plist文件),new,Open
Samples:有test里面的一些例子,暂时版本没有增加自己添加纹理进来功能...不过粒子有设置图片的方法,如果要求不高的话,也是可以用的...可能后面的版本作者会增加此功能
编辑器里面有说明,我就简单介绍右边的功能:
半径模式:这种只有围绕中心运动,这个下面的参数要有效
编辑器:IsBackgroundMove背景是否动,Scale缩放
大小:粒子的开始大小和结束大小
角度:粒子的运动方向...(-90)垂直朝下
生命:粒子生命
位置:设置PosVar值就可以了,SourcePosition不用管..设置资源的
纹理渲染:对于一般情况,只需要记住:&我们最常使用的CC_BLEND_SRC和CC_BLEND_DST分别对应GL_ONE和GL_ONE_MINUS_SRC_ALPHA&。
颜色:StartColor, EndColor, StartColorVar, EndColorVar这4个属性代表着粒子的初始颜色、结束颜色以及其浮动值。
重力模式:重力、速度等的设置
自旋:粒子的旋转
EmissionRate
粒子的发射速率,即每秒发射的粒子数量。
这里有一个问题,不知道算不算是bug,我给大家描述一下:
CCParticleSystem加载.plist文件时并没有读取这个EmissionRate的值。实际上,它是由粒子数量上限除以粒子生命期算出来的。
1 // emission Rate
2 m_fEmissionRate = m_uTotalParticles / m_fL
有点儿说不通对不对。我为什么要在(第一个)粒子的生命期内把所有的粒子都发出去?
这是CCParticleSystem加载.plist文件的问题,临时的解决办法就是,在加载.plist文件后,再手工调用setEmissionRate设置每秒的发射量。
&导出.plist文件,然后将其对应的图片,一同copy到新建工程的Resource文件夹下...
(注意两个文件要放在一起,要不然找不到..自然你也可以进.plist下去修改图片资源的路径,不过没有必要..放一起就好了)
& 、实现下雪效果:
老样子,上传我的demo代码:
ParticleTestScene.h
#pragma once&
#include &cocos2d.h&&
using namespace cocos2d;&
class ParticleTestScene :public CCScene&
&&& ParticleTestScene(void);&
&&& ~ParticleTestScene(void);&
&&& static CCScene* scene();&
ParticleTestScene.cpp
#include &ParticleTestScene.h&&
#include &ParticleTestLayer.h&&
ParticleTestScene::ParticleTestScene(void)&
ParticleTestScene::~ParticleTestScene(void)&
CCScene* ParticleTestScene::scene()&
&&& CCScene* scene=CCScene::create();&
&&& CCLayer* layer=new ParticleTestLayer();&
&&& scene-&addChild(layer);&
ParticleTestLayer.h
#pragma once&
#include &cocos2d.h&&
using namespace cocos2d;&
class ParticleTestLayer :public CCLayer&
&&& virtual void onEnter();&
protected:&
&&& CCParticleSystem*&&& m_&
&&& CCSprite*&&&&&&&&&&& m_&
&&& unsigned int m_nO&
PartileTestLayer.cpp
#include &ParticleTestLayer.h&&
#include &cocos2d.h&&
void ParticleTestLayer::onEnter()&
&&& CCLayer::onEnter();&
&&& //注意:如果你的层继承的是CCLayerColor,必须初始化颜色值&
&&& /*initWithColor( ccc4(127,127,127,255) );*/&
&&& //创建一个CCParticleSystem粒子系统&
&&& CCNode *parent1 = CCNode::create();//创建一个父节点&
&&& //创建一个CCParticleSystemQuad系统:每个粒子用4个点(Quad,矩形)表示的粒子系统&
&&& CCParticleSystemQuad *emitter1 = CCParticleSystemQuad::create(&pottersnow.plist&);&
&&& emitter1-&setBlendAdditive(false);//是否混合&
&&& CCSize s = CCDirector::sharedDirector()-&getWinSize();&
&&& emitter1-&setPosition(ccp( s.width/2-30,&&& s.height/2+60));&
&&& parent1-&addChild(emitter1, 0, 1);&
&&& addChild(parent1, 10, 1000);&
运行效果:TABLE OF CONTENTS
Eclipse (@ ) is an open-source Integrated Development Environment (IDE) supported by IBM. Eclipse is popular for Java application development (Java SE and Java EE) and Android apps. It also supports C/C++, PHP, Python, Perl, and other web project developments via extensible plug-ins. Eclipse is cross-platform and runs under Windows, Linux and Mac OS.
Eclipse Versions
The various versions are:
Eclipse 1.0 (November 7, 2001): based on an earlier Java IDE called VisualAge from IBM.
Eclipse 2.0 (June 28, 2002)
Eclipse 2.1 (March 28, 2003)
Eclipse 3.0 (June 25, 2004)
Eclipse 3.1 (June 28, 2005)
Eclipse 3.2
(June 30, 2006) (Callisto - named after one of the Jupiter's Galilean moons): started annual simultaneous release of all the related Eclipse projects.
Eclipse 3.3
(June 25, 2007) (Europa - named after another Jupiter's Galilean moons)
Eclipse 3.4
(June 19, 2008) (Ganymede - named after yet another Jupiter's Galilean moons)
Eclipse 3.5
(June 12, 2009) (Galileo - named after the great 17th century scientist and astronomer Galileo Galilei)
Eclipse 3.6 (June 23, 2010) (Helios - named after
god of the sun in Greek Mythology)
Eclipse 3.7 (June 23, 2011) (Indigo)
Eclipse 4.2 (June 27, 2012) (Juno)
Eclipse 4.3 (June 2013) (Kepler)
Eclipse 4.4 (June 2014) (Luna)
Eclipse 4.5 (June 2015) (Mars)
Eclipse 4.6 (June 2016) (Neon)
Eclipse 4.7 (June 2017) (Oxygen)
Eclipse 4.8 (June 2018) (Photon) (Planned)
How to Install Eclipse 4.7.2 (Oxygen.2) for Java Developers
How to Install Eclipse on Windows
Step 0: Install JDK
To use Eclipse for Java programming, you need to first install Java Development Kit (JDK).
Step 1: Download
Download Eclipse from . Under &Get Eclipse Oxygen& &rA Click &Download Packages&. For beginners, choose the 2nd (or 3rd) entry &Eclipse IDE for Java Developers& (32-bit or 64-bit) (e.g., &eclipse-java-oxygen-2-win32-x86_64.zip& 180MB) &rA Download.
Step 2: Unzip
To install Eclipse, simply unzip the downloaded file into a directory of your choice (e.g., &d:\myproject&).
There is no need to run any installer. Moreover,
you can simply delete the entire Eclipse directory when it is no longer needed (without running any un-installer). You are free to move or rename the directory. You can install (unzip) multiple copies of Eclipse in the same machine.
How to Install Eclipse on Mac OS X
To use Eclipse for Java programming, you need to first install JDK. Read &&.
To install Eclipse:
Goto . Under &Get Eclipse Oxygen& &rA Click &Download Packages&. Choose &Mac OS X (Cocoa)&. For beginners, select the 2nd (or 3rd) entry &Eclipse IDE for Java Developers&. You will receive a
DMG file (e.g., &eclipse-java-oxygen-2-macosx-cocoa-x86_64.dmg&).
Double-click the downloaded Disk Image (DMG) file. Follow the screen instructions to install Eclipse. Eclipse will be installed under &/Applications/eclipse&. (To confirm!)
(Alternatively, you may download a TAR ball (.tar.gz); double click to expand into a folder called &eclipse&; and drag the expanded &eclipse& folder into the &Applications& folder.)
How to Install Eclipse on Ubuntu Linux
Eclipse comes with many flavors (See &Eclipse Packages& @ ):
To use Eclipse for Java programming, choose &Eclipse IDE for Java Developers& (JavaSE) or &Eclipse IDE for Java EE Developers& (JavaEE). You need to first install JDK. Read &&.
To use Eclipse for PHP programming, choose &Eclipse IDE for PHP Developers&.
To use Eclipse for C/C++ programming, choose &Eclipse IDE for C/C++ Developers&.
Nonetheless, you can install any package, and then add more features when needed.
To install Eclipse (e.g, for Java Programming):
Download Eclipse from . Under &Get Eclipse Oxygen& &rA Click &Download Packages&. For Platform, choose &Linux&
&rA &Eclipse IDE for Java Developers& for Java SE or &Eclipse IDE for Java EE Developers& for developing webapps. You will receive a
tarball (e.g., &eclipse-java-oxygen-2-linux-gtk-x86_64.tar.gz&) in the &~/Downloads& folder.
We shall install Eclipse under /usr/local.
$ cd /usr/local
$ sudo tar xzvf ~/Downloads/eclipse-java-oxygen-2-linux-gtk-x86_64.tar.gz
$ cd /usr/local
$ sudo chown -R your-username:your-groupname eclipse
$ cd /usr/bin
$ sudo ln -s /usr/local/eclipse/eclipse
$ ls -ld /usr/bin/eclipse
lrwxrwxrwx 1 root root 26 Aug 30 11:53 /usr/bin/eclipse -& /usr/local/eclipse/eclipse
$ which eclipse
/usr/bin/eclipse
To run Eclipse, open the &/usr/local/eclipse& folder and click on the &Eclipse& or start a &Terminal&, enter &eclipse&.
Lock Eclipse on Launcher
Simply start Eclipse. Right-click the Eclipse icon &rA Lock to Launcher.
(For older version - If the above don't work) Create a /usr/share/applications/eclipse.desktop file with the following contents:
[Desktop Entry]
Name=Eclipse
Type=Application
Exec=eclipse
Terminal=false
Icon=/usr/local/eclipse/icon.xpm
Comment=Integrated Development Environment
NoDisplay=false
Categories=DIDE;
Name[en]=Eclipse
Start Eclipse, right-click on the Eclipse icon on launcher &rA lock to launcher.
Writing your First Java Program in Eclipse
Step 0: Launch Eclipse
Launch Eclipse by running &eclipse.exe& from the Eclipse installed directory.
Choose an appropriate directory for your workspace, i.e., where you would like to save your files (e.g., d:\myproject\eclipse for Windows).
If the &Welcome& screen shows up, close it by clicking the &cross& button next to the &Welcome& title.
Step 1: Create a new Java Project
For each Java application, you need to create a project to keep all the source files, classes and relevant resources.
To create a new Java project:
Choose &File& menu &rA &New& &rA &Java project& (or &File& &rA &New& &rA &Project& &rA &Java project&).
The &New Java Project& dialog pops up.
In &Project name&, enter &FirstProject&.
Check &Use default location&.
In &JRE&, select &Use default JRE (currently 'JDK9.0.x')&. But make sure that your JDK is 1.8 and above.
In &Project Layout&, check &Use project folder as root for sources and class files&.
Push &Finish& button.
Step 2: Write a Hello-world Java Program
In the &Package Explorer& (left pane) =>
Right-click on &FirstProject& (or use the &File& menu) =>
New &rA Class.
The &New Java Class& dialog pops up.
In &Source folder&, keep the &FirstProject&.
In &Package&, delete the content if it is not empty.
In &Name&, enter &Hello&.
Check &public static void main(String[] args)&.
Don't change the rest.
Push &Finish& button.
The source file &Hello.java& opens on the editor panel (the center pane). Enter the following codes:
public class Hello {
public static void main(String[] args) {
System.out.println(&Hello, world!&);
Step 3: Compile & Execute the Java Program
There is no need to compile the Java source file in Eclipse explicitly. It is because Eclipse performs the so-called incremental compilation, i.e., the Java statement is compiled as and when it is entered.
To run the program, right-click anywhere on the source file &Hello.java& (or choose &Run& menu) &rA Run As &rA Java Application.
The output &Hello, world!& appears on the Console panel (the bottom pane).
You should create a NEW Java project for EACH of your Java application.
Nonetheless, Eclipse allows you to keep more than one programs in a project, which is handy for writing toy programs (such as your tutorial exercises). To run a particular program, open and right-click on the source file &rA Run As &rA Java Application.
Clicking the &Run& button (with a &Play& icon) runs the recently-run program (based on the previous configuration). Try clicking on the &down-arrow& besides the &Run& button.
Correcting Syntax Errors
Eclipse performs incremented compilation, as and when a source &line& is entered. It marked a source line having syntax error with a RED CROSS. Place your cursor at the RED CROSS to view the error message.
You CANNOT RUN the program if there is any syntax error (marked by a RED CROSS before the filename). Correct a and RUN the program.
HINTS: In some cases, Eclipse shows a ORANGE LIGHT-BULB (for HINTS) next to the ERROR RED-CROSS (Line 5 in the above diagram). You can click on the LIGHT-BULB to get a list of HINTS to resolve this particular error, which may or may not work!
SYNTAX WARNING: marked by a orange triangular exclaimation sign. Unlike errors, warnings may or may not cause problems. Try to fix these warnings as well. But you can RUN your program with warnings.
Read the Eclipse Documentation
At a minimum, you SHOULD browse through Eclipse's &Workbench User Guide& and &Java Development User Guide& - accessible via the Eclipse's &Welcome& page or &Help& menu. This will save you many agonizing hours trying to figure out how to do somethings later.
Debugging Programs in Eclipse
Able to use a graphics debugger to debug program is crucial in programming. It could save you countless
hours guessing on what went wrong.
Step 0: Write a Java Program
The following program computes and prints the factorial of n (=1*2*3*...*n).
The program, however, has a logical error and produce a wrong answer for n=20 (&The Factorial of 20 is -& - a negative number?!).
public class Factorial {
public static void main(String[] args) {
int n = 20;
int factorial = 1;
int i = 1;
while (i &= n) {
factorial = factorial *
System.out.println(&The Factorial of & + n + & is & + factorial);
Let's use the graphic debugger to debug the program.
Step 1: Set an Initial Breakpoint
A breakpoint suspends program execution for you to examine the internal states (e.g., value of variables) of the program. Before starting the debugger, you need to set at least one breakpoint to suspend the execution inside the program. Set a breakpoint at main() method by double-clicking on the left-margin of the line containing main().
blue circle appears in the left-margin indicating a breakpoint is set at that line.
Step 2: Start Debugger
Right click anywhere on the source code (or from the &Run& menu) &rA &Debug As& &rA &Java Application& &rA choose &Yes& to switch into &Debug& perspective (A perspective is a particular arrangement of panels to suits a certain development task such as editing or debugging). The program begins execution but suspends its operation at the breakpoint, i.e., the main() method.
As illustrated in the following diagram, the highlighted line (also pointed to by a blue arrow) indicates the statement to be executed in the next step.
Step 3: Step-Over and Watch the Variables and Outputs
Click the &Step Over& button (or select &Step Over& from &Run& menu) to single-step thru your program. At each of the step, examine the value of the
variables (in the &Variable& panel) and the outputs produced by your program (in the &Console& Panel), if any. You can also place your cursor at any variable to inspect the content of the variable.
Single-stepping thru the program and watching the values of internal variables and the outputs produced is the ultimate mean in debugging programs - because it is exactly how the computer runs your program!
Step 4: Breakpoint, Run-To-Line, Resume and Terminate
As mentioned, a breakpoint suspends program execution and let you examine the internal states of the program. To set a breakpoint on a particular statement, double-click the left-margin of that line (or select &Toggle Breakpoint& from &Run& menu).
&Resume& continues the program execution, up to the next breakpoint, or till the end of the program.
&Single-step& thru a loop with a large count is time-consuming. You could set a breakpoint at the statement immediately outside the loop (e.g., Line 11 of the above program), and issue &Resume& to complete the loop.
Alternatively, you can place the cursor on a particular statement, and issue &Run-To-Line& from the &Run& menu to continue execution up to the line.
&Terminate& ends the debugging session. Always terminate your current debugging session using &Terminate& or &Resume& till the end of the program.
Step 5: Switching Back to Java perspective
Click the &Java& perspective icon on the upper-right corner to switch back to the &Java& perspective for further programming (or &Window& menu &rA Open Perspective &rA Java).
Important: I can's stress more that mastering the use of debugger is crucial in programming. Explore the features provided by the debuggers.
Other Debugger's Features
Modify the Value of a Variable: You can modify the value of a variable by entering a new value in the &Variable& panel. This is handy for temporarily modifying the behavior of a program, without changing the source code.
Step-Into and Step-Return: To debug a method, you need to use &Step-Into& to step into the first statement of the method.
(&Step-Over& runs the function in a single step without stepping through the statements within the function.) You could use &Step-Return& to return back to the caller, anywhere within the method.
Alternatively, you could set a breakpoint inside a method.
Tips & Tricks
General Usages (for all Programming Tasks)
These are the features that I find to be most useful in Eclipse:
You can double-click on the &header& of any panel to maximize that particular panel, and double-click again to restore it back. This feature is particularly useful for writing source code in full panel.
You can type &sysout& followed by a ctrl+space (or alt-/) as a shorthand for typing &System.out.println()&.
The default shortcut key (ctrl-space or alt-/) depends on the system. Check your system's shortcut key setting in &Edit& &rA &Content Assist& &rA &Default&. Take note that many of you use ctrl+space to switch between input languages. You need to reconfigure either your language switching hot-key or Eclipse.
Similarly, you can type &for& followed by ctrl-space (or alt-/) to get a for-loop.
You can create your own shorthand in &Window&
menu &rA &Preferences&
&rA &Java&
&rA &Editor&
&rA &Templates&. (Alternatively, in &Window& &rA &Preferences& &rA type &template& as filter text and choose &Java&
&rA &Editor&
&rA &Templates&.)
You can change your key settings in &Window&
menu &rA &Preferences&
&rA &General&
&rA choose &Command&, &Content Assist&. (Alternatively, in &Window& &rA &Preferences& &rA type &key& as filter text and choose &General&
&rA &Key&.)
You can use
ctrl-space to activate the &intelli-sense& (or content assist). That is, Eclipse will offer you the choices, while you are typing.
Right-click on the source. Choose &Source& &rA &Format& to let Eclipse to layout your source codes with the proper indentation.
To comment/uncomment a block of codes, choose &Source& &rA &Toggle Comment&.
If there is a syntax error on a statement, a red mark will show up on the left-margin on that statement. You could click on the
&light bulb& to display the error message, and also select from the available hints for correcting that syntax error.
You can rename a variable, method, class, package or even the project easily in Eclipse. Select and right-click on the entity to be renamed &rA &Refactor& &rA &Rename&. Eclipse can rename all the occurrences of the entity.
To show the line numbers, choose &Window& menu &rA &Preferences& &rA &General& &rA &Editors& &rA &Text Editors& &rA Check the &Show Line Numbers& Box. You can also configure many editor options, such as the number of spaces for tab. Alternatively, you can right-click on the left-margin, and check &Show Line Numbers&.
Click on an error message will hyperlink to the corresponding source statement.
From &Window& menu &rA &Preferences& &rA &General& &rA &Appearance& &rA &Colors and Fonts& &rA expand &Java& &rA &Java Editor Text Font& &rA &Edit&. (Alternatively, in &Window& &rA &Preferences& &rA type &font& as filter text and choose the appropriate entry.)
To enable Unicode support, select &Window& menu &rA Preferences &rA General &rA Workspace &rA Text file encoding &rA UTF-8. This sets the default character set used for file encoding, similar to VM's command-line option -Dfile.encoding=UTF-8. Commonly used charsets for Unicode are UTF-8, UTF-16 (with BOM), UTF-16BE, UTF-16LE. Other charsets are US-ASCII, ISO-8859-1.
In debug mode, you could configure to show the variable's value when the mouse hovers over the variable. Select &Window&
menu &rA &Preferences&
&rA &Java&
&rA &Editor&
&rA &Hover&.
In &Package Explorer&, select two files (hold the control key) => Right-click => Compare with.
F3: Goto the declaration of the highlighted variable/method.
Ctrl-Shift-G: Search for ALL references of the highlighted variable/method
in workspace.
Ctrl-G: Search for the Declaration of a variable/method in workspace.
Don't use Find (Ctrl-F), but use the above context-sensitive search.
Ctrl-Shift-F: Format the source code.
Ctrl-Shift-O: Organize imports.
Alt-Shift-R: Rename. (Don't use Find/Replace.)
Ctrl-Space: auto-complete.
We usually use &Package Explorer& in programming, but it will not show you all the folders and files under the project. On the other hand, &Navigator& is a file manager that shows the exact file structure of the project (similar to Windows Explorer). You can enable the Navigator by &Window& &rA Show view &rA Navigator.
To enable spell check, select Window &rA Preferences &rA type &spell& in the filter &rA General &rA Editors &rA Text Editors &rA Spelling &rA Check &Enable spell checking&. Also provide a &User defined dictionary& (with an initially empty text file).
To correct mis-spell words, right-click and press ctrl-1 (or Edit menu &rA Quick Fix).
Goto Help &rA about Eclipse &rA Installation details &rA Configuration &rA View Error Log.
Simply click and hold on the title of one file and drag it to the lower side of the screen.
[To view the same file on split screen, create a new editor window by selecting Window &rA New E and drag one window to the lower side of the screen.]
Push Alt-Shift-A to toggle between block-select mode and normal mode.
To view the snippet window: choose &Window& &rA Show View &rA Snippets.
To create a new snippet category: Right-click &rA Customize &rA New.
To create a new snippet item: Copy the desired text &rA Select the snippet category &rA paste as snippet.
To insert a snippet: place the cursor on the desired location at the editor panel &rA click the snippet item.
Word-wrap (or line-wrap) is essential for editing long HTML documents without the horizontal scroll bar. However, the Eclipse's HTML Editor and Text Editor do not support word-wrap.
You could install a plug-in called "Word Wrap" from http://ahtik.com/eclipse-update/.
Choose &Help& &rA Install New Software &rA in &Work with& Enter &http://ahtik.com/eclipse-update/&.
To activate word wrap, right-click on the editor panel &rA select &Word Wrap&.
: You do not have to place all the folders under the project base directory, instead, you can use so-called &link folders& to link to folder outside the project base directory.
To create a link folder in a project, right-click on the project &rA File &rA New &rA Folder &rA Advanced &rA Check Link to alternate Location (Linked Folder).
You can run eclipse in so-called &clean& mode, which wipes all the cached data and re-initialize the cache, by running eclipse from command-line with &-clean& argument (i.e., &eclipse -clean&). It is useful if something is not working proper, especially if you install a new copy of Eclipse.
Show the Right Margin: Window &rA Preferences &rA General &rA Editors &rA Text Editors &rA Show Print Margin and set the column number.
Let me know if you have more tips to be included here.
Update Eclipse and Install new Software
Select &Help& menu &rA Install New Software &rA In &Work With&, pull down the select menu and choose a software site.
Select &Help& menu &rA Check for Updates &rA.
For Java Application Development Only
You can keep many small programs (with main()) in one Java project instead of create a new project for each toy program. To run the desired program, right-click on the source file &rA &Run as& &rA &Java Application&.
and JDK 1.5: If you encounter syntax error in using printf() or Scanner (which are available from JDK 1.5), you need to check your compiler settings. Select &Window& menu &rA Preferences &rA open the &Java& node &rA select &Compiler& &rA in &Compiler compliance level& &rA select the latest release, which should be &1.5& or above.
To provide command-line arguments to your Java program in Eclipse, right-click on the source file &rA &Run Configurations& &rA Under the &Main& panel, check that &Project& name and &Main Class& are appropriate &rA Select the &Argument& tab &rA type your command-line arguments inside the &Program Arguments& box &rA &Run&.
: To ask Eclipse to insert the import statements for classes. Useful when you copy a large chunk of codes without the corresponding import statements.
To include another project in the same work space, right-click on the project
=> Build Path => Configure Build Path... => Select &Projects& tab
=> &Add...& to select project in the existing work space => OK.
Right-click on the project => Export... => Java, JAR File
=> Next => Select the files to be exported
=> Next => Next => In &JAR Manifest Specification& dialog, enter the main class (if you wish to run the JAR file directly) => Finish.
If you keep your test in another project, you need to include the project under test in your Build Path (see above).
To create a test case: Right-click on the project
&rA New &rA JUnit Test Case &rA the &New JUnit Test Case& dialog appears. Select &New JUnit 4 Test&. In &Name&, enter your class name. In &Class under test&, browse and select the class to be tested.
To run the test: Right-click
&rA &Run As&
&rA &JUnit Test&. The results are displayed in a special &JUnit console&.
&, &.lib&, &.a&, &.so&): Many external Java packages (such as JOGL, Java3D, JAMA, etc) are available to extend the functions of JDK. These packages typically provide a &lib& directory containing JAR files (&.jar&) (Java Archive - a single-file package of Java classes) and native libraries (&.dll&, &.lib& for windows, &.a&, &.so& for Linux and Mac).
To include these external packages into an Eclipse's project, right-click on the project &rA Build Path &rA Add External Archives &rA Navigate to select the JAR files (&.jar&) to be included.
In &Package Explorer&, right-click on the JAR file added &rA Properties:
To include native libraries (&.dll&, &.lib&, &.a&, &.so&), select &Native Library& &rA &Location Path& &rA &External Folder&.
To include the javadoc, select &JavaDoc Location& &rA &JavaDoc URL& &rA You can specify a local file or a remote link.
To include source file (for debugging), select &Java Source Attachment&.
All the above options are also accessible via project's property &rA &Build Path&.
Notes: The JAR files must be included in the CLASSPATH. The native library directories must be included in JRE's property &java.library.path&, which normally but not necessarily includes all the paths from the PATH environment variable. Read &&.
You can also create a Eclipse's user library to include a set of JAR files and native libraries, that can then be added into subsequent Eclipse projects.
For example, I created a user library for &JOGL& as follows:
From &Window& menu
=> Preferences
=> Build Path => User Libraries
=> In &User library name&, enter &jogl&. The &User Library& dialog appears.
In &User Library& dialog => Select &jogl&
=> Add JAR... => Navigate to &JOGL_HOME&/lib, and select &gluegen-rt.jar& and
&jogl.jar&.
Expand the &jogl.jar& node => Select &Native library location: (none)& &rA Edit... &rA External Folder... &rA select &JOGL_HOME&/lib.
Expand the &jogl.jar& node
=> Select &Javadoc location: (none)& &rA Edit... &rA Javadoc in archive
&rA In &Archive Path&, &Browse& and
select the downloaded JOGL API documentation zip-file
=> In &Path within archive&, &Browse& and expand the zip-file to select the top-level path (if any) => Validate. Alternatively, you can provide the path to the un-zipped javadocs. This is needed for Eclipse to display javadoc information about classes, fields, and methods.
You may provide the source files by editing &Source attachment: (none)&. Source is needed only if you are interested to debug into the JOGL source codes.
For EACH subsequent Java project created that uses JOGL, right-click on the project => Build Path => Add Libraries => Select &User Library& => Check &jogl&.
Suppose that you want to run a Perl script on the selected file, you can configure an external tool as follows:
From &Run& menu => External Tools => External Tools Configuration... => The &External Tools Configuration& dialog appears.
In &Name&, enter your tool name.
Choose the &Main& tab => In &Location&, &Browse File System...& to choose the perl interpreter &perl& => In &Arguments&, enter &path/scriptname.pl ${resource_loc}&, where ${resource_loc} is an Eclipse variable that denotes the currently selected resource with absolute path.
Choose the &Common& tab => In &Standard Input and Output&, uncheck &Allocate Console&, check &File& and provide an output file (e.g., d:\temp\${resource_name}.txt).
(If you use the CYGWIN perl interpreter, need to set environment variable CYGWIN=nodosfilewarning to disable warning message.)
To run the configured external tool, select a file &rA run &rA external tool &rA tool name.
In debug perspective, &Variable& panel
=> Select the &menu& (inverted triangle) => Java
=> Java Preferences... => Primitive Display Options => Check &Display hexadecimal values (byte, short, char, int, long)&.
First, you can check the installed JDK/JRE via &Window& menu
=> &Preferences& => Expand &Java& node => &Installed JREs&. Check the
&Location& current JRE installed to make sure that it is the intended one. You can use the &Add& button to add a new version of JRE. For program development, I recommend that you add the JDK (instead of JRE). [The &Location& decides the extension directory used for including additional JAR files, e.g., $JAVA_HOME\jre\lib\ext.]
For Web Developers
Use the &Web Page Editor& (available in Eclipse Java EE), which provides the design view (WYSISYG).
To use the &Web Page Editor&, right-click on the HTML file, open as &Web Page Editor&.
To make the &Web Page Editor& as default for HTML file, goto Window &rA Preferenes &rA General &rA Editor &rA File Associations &rA .htm and .html &rA Select "Web page editor" &rA default.
File I/O in Eclipse
Suppose that
your want to write a Java program, which inputs from a text file called &xxxx.in& and outputs to a text file called &xxxx.out&. This is a little tricky under Eclipse due to:
When you create a text file in Windows' Notepad and saved it as &xxxx.in&, Notepad will append the &.txt& to your file and it becomes &xxxx.in.txt&.
Worse still, the Windows' Explorer, by default, will not show the &.txt& extension. (The first thing I always do to an alien computer is to change this setting. From &Tools& menu &rA Folder Options... &rA View &rA Uncheck &Hide extensions for known file types&.) You need to put a pair of double quotes around xxxx.in to override the default &.txt& extension. This is one good reason not to use Notepad for programming at all. You should use Eclipse to create the text file instead.
Which directory to keep the input file &xxxx.in& in Eclipse?
If you did not separate the sources and class files into two separate directories, then the answer is straight forward, because there is only one directory to place your input file.
If you choose to keep your sources and class files in two separate directories, eclipse will create two sub-directories &src& and &bin& under the base directory. BUT you need to put your input file &xxxx.in& in the base directory of your project, instead of the &src& or &bin&..
For writing simple programs:
Put the sources, class files, and the input/output files in the same directory. (When you create a new project, select &Use project folder as root for sources and class files& in &Project Layout&.) (But put your sources and class files in separate directories for big project.)
You can create you input file from eclipse directly via &File& menu &rA &New& &rA &File&.
Remember to add a newline to the end of your input file.
You may need to right-click the project and select &Refresh& to see the output file &xxxx.out& created in the package explorer.
To open the &xxxx.in& and &xxxx.out&: right-click &rA Open With &rA Text Editor.
This is a sample JDK 1.5 program for file input/output:
import java.util.S
import java.util.F
import java.io.F
import java.io.IOE
public class FileIOTest {
public static void main (String [] args) throws IOException {
Scanner in = new Scanner(new File(&FileIOTest.in&));
Formatter out = new Formatter(new File(&FileIOTest.out&));
int a = in.nextInt();
int b = in.nextInt();
out.format(&%d\n&,a+b);
out.close();
Create the input text file called &FileIOTest.in& with the following contents and terminated with a newline:
Writing Swing Applications using Eclipse GUI Builder
Eclipse provides a visual GUI builder called &WindowBuilder& (@ ), which supports AWT/Swing, SWT (Eclipse's Standard Widget Toolkit
- an alternative to JDK's AWT/Swing), XWT, GWT, eRCT.
Step 0: Install WindowBuilder
To install &WindowBuilder&, goto &Help& &rA Install New Software &rA In &Work with&, for Eclipse 4.7, enter &http://download.eclipse.org/windowbuilder/WB/integration/4.7/& (You can find the proper link from &http://www.eclipse.org/windowbuilder/download.php&) &rA Check &WindowBuilder& &rA Next &rA Next &rA Accept the licence
&rA Finish.
Step 1: Create a New &Java Application& Project
Choose &File& menu &rA &New& &rA &Java project&.
The &New Java Project& dialog pops up.
In the &Project name& field, enter &FirstSwingProject&.
Check &Use default location&.
In the &JRE& box, select &Use default JRE (currently 'JDK1.x')&. But check the JDK version, you should be using JDK 1.5 and above.
Click &Finish&.
Step 2: Create a Swing JFrame Subclass
Choose &File& menu &rA &New& &rA &WindowBuilder& (could be under &Others&) &rA &Swing Designer& &rA &JFrame& &rA &Next&. [If you cannot find &WindowBuilder& option, you need to install the &WindowBuilder& plug-in for Eclipse. Check .]
In the &Create JFrame& dialog &rA Enter &SwingMain& in the &Name& field &rA &Finish&.
Select the &Design& pane.
In &Layouts&, select &FlowLayout& and click on the &design form&.
From &Components&, select &JLabel& and click on the design form. Change the label text to &Counter: &. Select a &JTextField& and place it on the design form. Change the text to &0&. Select a &JButton& and place it on the design form. Change the text label to &Count&.
To attach a event-handler to the button, double-click the JButton to switch into the &Source& pane, with the event-handler skeleton created. Complete the actionPerformed() as follows:
public void actionPerformed(ActionEvent e) {
textField.setText(count + &&);
Add an instance variable called count as follow:
public class SwingMain extends JFrame {
private int count = 0;
You can now ready run the program. Right-click on the project &rA Run As &rA Java Application.
Eclipse Generated Codes
Study the codes generated by Eclipse GUI Builder, as follows, which is just a typical Swing application.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.border.EmptyB
public class SwingMain extends JFrame {
private JPanel contentP
private JTextField textF
private int count = 0;
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
SwingMain frame = new SwingMain();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
public SwingMain() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 450, 300);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
JLabel lblNewLabel = new JLabel(&Counter: &);
contentPane.add(lblNewLabel);
textField = new JTextField();
textField.setText(&0&);
contentPane.add(textField);
textField.setColumns(10);
JButton btnCount = new JButton(&Count&);
btnCount.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
textField.setText(count + &&);
contentPane.add(btnCount);
Eclipse for C/C++ Programming
Eclipse PDT (PHP Development Tool)
Eclipse and Database Development (MySQL)
Reference: &Data Tools Platform User Documentation& @ Eclipse Welcome page.
You need to install Eclipse for Java EE, MySQL and MySQL Connector/J Driver. Read &&.
To use Eclipse for MySQL development:
Switch to &Database Development& perspective: From &Window& menu &rA Open Perspective &rA Other &rA Database Development.
Connect to MySQL database server: Start your MySQL database server. Right-click &Database Connection& &rA New.
In &Connection Profile&, choose &MySQL& &rA Next.
In &Driver&, choose &New Driver Definition& &rA Choose the MySQL Connector/J Driver &rA In JAR List, select the MySQL Connector/J Driver JAR file (that you have installed). In &Properties&, &General&, specify URL (take note of the database name), User name and password &rA Test Connection &rA Finish.
In &Datasource Explorer&, you can &connect& and &disconnect& the connection.
To create a new SQL script, choose File &rA New &rA SQL File &rA You may use an existing project or create a new project (General - Project or Web - Dynamic Web Project) &rA Enter filename, and set the connection profile name &rA Finish. Enter a SQL statement (e.g., SELECT * FROM tablename) &rA Right-click on the text &rA &Execute Current Text& or &Execute All&.
To use an existing SQL file, drop the file into a project and open the SQL file. In Connection profile, set the type and connection name. Right-click on a statement &rA &Execute ...&.
To CURD (create-update-read-delete) tables, in &Datasource Explorer& (of the &Database Development& perspective), expand &database& to view the tables. Right-right on the table &rA Datat &rA Edit.
Developing and Deploying Web Applications in Eclipse for Java EE
Setting Up Eclipse for Web Development
Install &Eclipse for Java EE (Enterprise Edition)&.
Install Tomcat (or Glassfish) server.
Configuring Web Server: Launch Eclipse &rA Window &rA Preferences &rA Expand the &Server& node
&rA &Runtime Environments& &rA &Add...& &rA Expand &Apache& and select &Apache Tomcat v7.0& &rA Enter the &Tomcat Installation Directory&
&rA &Finish&.
Writing a Hello-world JSP Page
Create a new Web Application: File &rA New &rA Dynamic Web Project (under &Web& category) &rA In &Project Name&, enter &HelloJSP& &rA Finish.
Create a new JSP File: Right-click on the project &HelloJSP&
&rA JSP File
&rA The parent folder shall be &HelloJSP/WebContent& &rA In &File Name&, enter &Hello& &rA &Finsih&.
Enter the following HTML/JSP codes within the &body&...&/body& tags:
&h1&Hello World!&/h1&
out.println(&Your IP address is & + request.getRemoteAddr() + &&br/&&);
out.println(&Your user agent is & + request.getHeader(&user-agent&) + &&br/&&);
To execute the JSP, right-click on &Hello.jsp& &rA Run As
&rA Run on Server.
Writing a Hello-world Servlet
Create a new Web Application: File &rA New &rA Dynamic Web Project (under &Web& category) &rA In &Project Name&, enter &HelloServlet& &rA &Finish&.
Create a new Servlet: Right-click on the project &HelloServlet&
&rA Servlet
&rA In &Java Package&, enter &hello&; in &Class Name&, enter &HelloServlet& &rA Next &rA In &URL Mappings&, select &\HelloServlet&, &Edit& to &\Hello& &rA Next &rA In &Which method stubs would you like to create&, check &Inherited abstract method& and &doGet& &rA Finish.
In &HelloServlet.java&, enter the following codes:
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.WebS
@WebServlet(&/sayhello&)
public class HelloServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType(&text/html&);
PrintWriter out = response.getWriter();
out.println(&&!DOCTYPE html&&);
out.println(&&html&&head&&);
out.println(&&meta http-equiv='Content-Type' content='text/ charset=UTF-8'&&);
out.println(&&title&Hello Servlet&/title&&/head&&);
out.println(&&body&&h1&Hello, World!&/h1&&);
out.println(&&p&Your IP address is & + request.getRemoteAddr() + &&/p&&);
out.println(&&p&Your user agent is & + request.getHeader(&user-agent&) + &&/p&&);
out.println(&&/body&&/html&&);
(For Servlet 2.4/2.5 with Tomcat 6) The annotation @WebServlet is new in Servlet 3.0 and is not supported in Servlet 2.4/2.5. Hence, you need to manually configure the URL for the servlet in the Web Application Deployment Descriptor &web.xml& under directory &WEB-INF&, as follows:
&?xml version=&1.0& encoding=&ISO-8859-1&?&
&web-app xmlns=&http://java.sun.com/xml/ns/javaee&
xmlns:xsi=&http://www.w3.org/2001/XMLSchema-instance&
xsi:schemaLocation=&http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd&
version=&3.0& metadata-complete=&true&&
&servlet-name&HelloServletExample&/servlet-name&
&servlet-class&hello.HelloServlet&/servlet-class&
&/servlet&
&servlet-mapping&
&servlet-name&HelloServletExample&/servlet-name&
&url-pattern&/sayhello&/url-pattern&
&/servlet-mapping&
&/web-app&
To execute the Servlet, right-click on the &HelloServlet& project &rA &Run As& &rA &Run on Server& &rA Change the URL to &http://localhost:8080/HelloServlet/sayhello&.
Exporting a Web Application as a WAR file
Right-click on the project to be exported &rA Export &rA WAR File &rA In &Destination&, specify the destination directory and filename (the filename shall be the web application name) &rA Finish.
To deploy the war file in Tomcat, simply drop the war file into Tomcat's &webapps& folder. The war file will be automatically extracted and deployed. The web application name is the war-filename.
You could use WinZip (or WinRAR) to view the content of the war file, as war-file is in ZIP format.
Writing a Hello-world JSF Page
Debugging Web Applications
You can debug a webapp just like standalone application. For example, you can set breakpoints, single-step through the programs, etc.
REFERENCES & RESOURCES
Eclipse mother site @ .
Eclipse documentation and user guides, accessible via Eclipse's Help and

我要回帖

更多关于 迅雷影音右键菜单删除 的文章

 

随机推荐