eclipse-java-2019-12-R-win32-x86_64.zip
' - about 201MB) ⇒ Download.c:myProject
').eclipse-java-2019-12-R-macosx-cocoa-x86_64.dmg
')./Applications/eclipse
'. (To confirm!)eclipse-java-2019-12-R-linux-gtk-x86_64.tar.gz
') in the '~/Downloads
' folder./usr/local
. /usr/local/eclipse
' folder and click on the 'Eclipse' icon; or start a 'Terminal', enter 'eclipse'./usr/share/applications/eclipse.desktop
file with the following contents:eclipse.exe
' from the Eclipse installed directory.c:myProjecteclipse
for Windows) ⇒ Launch.FirstProject
'.FirstProject
' (or use the 'File' menu) ⇒ New ⇒ Class.Hello
'.public static void main(String[] args)
'.Hello.java
' opens on the editor panel (the center pane). Enter the following codes: Hello.java
' (or choose 'Run' menu) ⇒ Run As ⇒ Java Application.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 -2102132736
' - a negative number?!).main()
method by double-clicking on the left-margin of the line containing main()
. A blue circle appears in the left-margin indicating a breakpoint is set at that line. main()
method.sysout
' followed by a ctrl+space (or alt-/) as a shorthand for typing 'System.out.println()
'.-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.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.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 ⇒ 'Run as' ⇒ 'Java Application'.printf()
or Scanner
(which are available from JDK 1.5), you need to check your compiler settings. Select 'Window' menu ⇒ Preferences ⇒ open the 'Java' node ⇒ select 'Compiler' ⇒ in 'Compiler compliance level' ⇒ select the latest release, which should be '1.5' or above.import
statements for classes. Useful when you copy a large chunk of codes without the corresponding import statements.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 macOS)..jar
') to be included..dll
', '.lib
', '.a
', '.so
'), select 'Native Library' ⇒ 'Location Path' ⇒ 'External Folder'.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 'External JAR files and Native Libraries'.jogl
'. The 'User Library' dialog appears.jogl
' ⇒ Add JAR.. ⇒ Navigate to <JOGL_HOME>/lib
, and select 'gluegen-rt.jar
' and 'jogl.jar
'.jogl.jar
' node ⇒ Select 'Native library location: (none)' ⇒ Edit.. ⇒ External Folder.. ⇒ select <JOGL_HOME>/lib
.jogl.jar
' node ⇒ Select 'Javadoc location: (none)'
⇒ Edit.. ⇒ Javadoc in archive ⇒ 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.jogl
'.path/scriptname.pl ${resource_loc}
', where ${resource_loc}
is an Eclipse variable that denotes the currently selected resource with absolute path.d:temp${resource_name}.txt
).$JAVA_HOMEjrelibext
.]xxxx.in
' and outputs to a text file called 'xxxx.out
'. This is a little tricky under Eclipse due to: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 ⇒ Folder Options.. ⇒ View ⇒ 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.xxxx.in
' in Eclipse? xxxx.in
' in the base directory of your project, instead of the 'src' or 'bin'.xxxx.out
' created in the package explorer.xxxx.in
' and 'xxxx.out
': right-click ⇒ Open With ⇒ Text Editor.FileIOTest.in
' with the following contents and terminated with a newline:FirstSwingProject
'.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'.JButton
to switch into the 'Source' pane, with the event-handler skeleton created. Complete the actionPerformed()
as follows: Add an instance variable called count
as follow: HelloJSP
' ⇒ Finish.HelloJSP
' ⇒ New ⇒ JSP File ⇒ The parent folder shall be 'HelloJSP/WebContent' ⇒ In 'File Name', enter 'Hello
' ⇒ 'Finsih'.<body>..</body>
tags: Hello.jsp
' ⇒ Run As ⇒ Run on Server.HelloServlet
' ⇒ 'Finish'.HelloServlet
' ⇒ New ⇒ Servlet ⇒ In 'Java Package', enter 'hello
'; in 'Class Name', enter 'HelloServlet
' ⇒ Next ⇒ In 'URL Mappings', select 'HelloServlet
', 'Edit' to 'Hello
' ⇒ Next ⇒ In 'Which method stubs would you like to create', check 'Inherited abstract method' and 'doGet' ⇒ Finish.@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:HelloServlet
' project ⇒ 'Run As' ⇒ 'Run on Server' ⇒ Change the URL to 'http://localhost:8080/HelloServlet/sayhello
'.webapps
' folder. The war file will be automatically extracted and deployed. The web application name is the war-filename.