Java Essentials < continuous update optimization >

Source: Internet
Author: User

Java programs are divided into 2 categories:

1. Embedded in a Web page, a program that runs through a browser, called an applet, is translated into a small application .

2. In addition to 1 Java programs, known as application, are translated into applications .


The first Java applet program:

File name Firstapplet.java

Import Java.applet.*;import java.awt.*; The Import keyword indicates that a package//extends applet is to be introduced to represent the inherited applet class//program without the main () method, instead of the paint () method, which is automatically called by the browser to public class Firstapplet The extends Applet {public void paint (Graphics g) {//DrawString () method is used to output the information g.drawstring ("This is the text I generated with the Java Applet!").      ", 15, 25); }}


File name firstapplet.htm



Javac command

Usage: Javac <options> <source files>
Among the possible options are:
-G generates all debug information
-g:none does not generate any debug information
-g:{lines,vars,source} only generates some debugging information
-nowarn does not generate any warnings
-verbose output messages about the actions that the compiler is performing
-deprecation output using outdated API source location
-classpath < paths > specifying where to find user class files and comment handlers
-CP < paths > specifying where to find user class files and comment handlers
-sourcepath < paths > Specify where to find the input source files
-bootclasspath < path > Overwrite the location of the boot class file
-extdirs < directories > overriding locations for installed extensions
-endorseddirs < directory > location of standard paths for overwriting signatures
-proc:{none,only} controls whether annotation processing and/or compilation is performed.
-processor <class1>[,<class2>,<class3>] The name of the comment handler to run; Bypassing the default search process
-processorpath < paths > specifying where to find comment handlers
-parameters generating metadata for reflection of method parameters
-D < directories > specify where to place the generated class files
-S < directory > specify where to place the generated source files
-H < directory > specify where to place the generated native header file
-implicit:{none,class} Specifies whether to generate a class file for an implicit reference file
-encoding < encoding > specifying the character encoding used by the source file
-source < release > provides source compatibility with a specified release
-target < release > Generate a class file for a specific VM version
-profile < profile > Make sure that the API used is available in the specified configuration file
-version Version Information
Summary of-HELP output standard options
-a keyword [= value] The option to pass to the comment handler
-X output a feed of non-standard options
-j< tag > Direct < tag > pass to the runtime system
-werror terminating compilation When a warning occurs
@< file name > read from File option and file name


Java commands

Usage: Java [-options] class [args ...]
(Execution Class)
or Java [-options]-jar jarfile [args ...]
(Execute JAR file)
Among the options are:
-d32 using a 32-bit data model (if available)
-d64 using a 64-bit data model (if available)
-server selecting the "Server" VM
The default VM is server.

Class search paths for-CP < directories and Zip/jar files >
Class search paths for-classpath < directories and Zip/jar files >
With Delimited directories, JAR archives
And a list of ZIP archives to search for class files.
-d< name >=< value >
Setting System Properties
-VERBOSE:[CLASS|GC|JNI]
Enable verbose output
-version output product version and exit
-version:< value >
Warning: This feature is obsolete and will be
Removed in future releases.
The specified version is required to run
-showversion output product version and continue
-jre-restrict-search | -no-jre-restrict-search
Warning: This feature is obsolete and will be
Removed in future releases.
Include/exclude user-specific JRE in version search
-? -help Output This Help message
-X output Help for non-standard options
-ea[:<packagename>...|:<classname>]
-enableassertions[:<packagename>...|:<classname>]
Enable assertion at the specified granularity
-da[:<packagename>...|:<classname>]
-disableassertions[:<packagename>...|:<classname>]
Disables assertions with the specified granularity
-esa | -enablesystemassertions
Enable System assertion
-DSA | -disablesystemassertions
disabling system assertions
-agentlib:<libname>[=< option;]
Load the native agent library <libname>, for example-agentlib:hprof
See also-agentlib:jdwp=help and-agentlib:hprof=help
-agentpath:<pathname>[=< option;]
Load the native agent library by full path name
-javaagent:<jarpath>[=< option;]
Load the Java programming language proxy, see java.lang.instrument
-splash:<imagepath>
Displays the splash screen using the specified image


Java Essentials < continuous update optimization >

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.