java.rst
author Oleksandr Gavenko <gavenkoa@gmail.com>
Mon, 22 Feb 2016 12:41:52 +0200
changeset 1903 901e7394849f
parent 1848 17256527f85e
child 1905 fba288d59662
permissions -rw-r--r--
Decrease intent to increase space usage on mobile.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1213
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     1
.. -*- coding: utf-8; -*-
1334
9bf0d5a1f0cf Include common header with quick links.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1270
diff changeset
     2
.. include:: HEADER.rst
1213
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     3
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     4
================
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     5
 Java language.
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     6
================
1346
a2fbf50a43f4 Fix: Has no 'contents::' directive.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1334
diff changeset
     7
.. contents::
1213
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     8
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     9
Class version.
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    10
==============
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    11
1216
7a3ade740d3f Fix RST syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1215
diff changeset
    12
  =========  ====== =====================
7a3ade740d3f Fix RST syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1215
diff changeset
    13
  major      minor  Java platform version
7a3ade740d3f Fix RST syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1215
diff changeset
    14
  =========  ====== =====================
7a3ade740d3f Fix RST syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1215
diff changeset
    15
  45 0x27    3      1.0
7a3ade740d3f Fix RST syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1215
diff changeset
    16
  45 0x27    3      1.1
7a3ade740d3f Fix RST syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1215
diff changeset
    17
  46 0x28    0      1.2
7a3ade740d3f Fix RST syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1215
diff changeset
    18
  47 0x29    0      1.3
7a3ade740d3f Fix RST syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1215
diff changeset
    19
  48 0x30    0      1.4
1677
3d2d4e6062f3 New Java byte code versions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1655
diff changeset
    20
  49 0x31    0      5.0
3d2d4e6062f3 New Java byte code versions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1655
diff changeset
    21
  50 0x32    0      6.0
3d2d4e6062f3 New Java byte code versions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1655
diff changeset
    22
  51 0x33    0      7
3d2d4e6062f3 New Java byte code versions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1655
diff changeset
    23
  52 0x34    0      8
1216
7a3ade740d3f Fix RST syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1215
diff changeset
    24
  =========  ====== =====================
1213
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    25
1216
7a3ade740d3f Fix RST syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1215
diff changeset
    26
where ``minor`` and ``major`` are value of 6 and 8 bytes in .class file::
7a3ade740d3f Fix RST syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1215
diff changeset
    27
7a3ade740d3f Fix RST syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1215
diff changeset
    28
  0xCA, 0xFE, 0xBA, 0xBE, 0x00, minor, 0x00, major
1213
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    29
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    30
Access modifiers.
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    31
=================
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    32
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    33
Public.
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    34
-------
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    35
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    36
 * Public class is visible in other packages.
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    37
 * Public field is visible everywhere (class must be public too).
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    38
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    39
Private.
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    40
--------
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    41
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    42
 * Private variables or methods may be used only by an instance of the same
1216
7a3ade740d3f Fix RST syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1215
diff changeset
    43
   class that declares the variable or method
1213
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    44
 * A private feature may only be accessed by the class that owns the feature.
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    45
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    46
Protected.
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    47
----------
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    48
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    49
 * Is available to all classes in the same package and also available to all
1216
7a3ade740d3f Fix RST syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1215
diff changeset
    50
   subclasses of the class that owns the protected feature.
1213
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    51
 * This access is provided even to subclasses that reside in a different
1216
7a3ade740d3f Fix RST syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1215
diff changeset
    52
   package from the class that owns the protected feature.
1213
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    53
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    54
default.
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    55
--------
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    56
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    57
What you get by default ie, without any access modifier.
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    58
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    59
 * It means that it is visible to all within a particular package.
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    60
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    61
static.
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    62
-------
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    63
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    64
 * Static means one per class, not one for each object no matter how many
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    65
   instance of a class might exist. This means that you can use them without
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    66
   creating an instance of a class.
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    67
 * Static methods are implicitly final, because overriding is done based on
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    68
   the type of the object, and static methods are attached to a class, not an
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    69
   object.
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    70
 * A static method in a superclass can be shadowed by another static method in
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    71
   a subclass, as long as the original method was not declared final.
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    72
 * You can't override a static method with a nonstatic method.
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    73
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    74
final.
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    75
------
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    76
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    77
 * A final class can't be extended ie., final class may not be subclassed.
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    78
 * A final method can't be overridden when its class is inherited.
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    79
 * You can't change value of a final variable.
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    80
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    81
Exceptions.
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    82
===========
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    83
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    84
A checked exception is some subclass of Exception (or Exception itself),
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    85
excluding class RuntimeException and its subclasses.
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    86
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    87
Unchecked exceptions are RuntimeException and any of its subclasses. Class
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    88
Error and its subclasses also are unchecked. With an unchecked exception,
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    89
however, the compiler doesn't force client programmers either to catch the
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    90
exception or declare it in a throws clause.
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    91
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    92
Inner classes.
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    93
==============
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    94
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    95
Nested top-level classes.
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    96
-------------------------
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    97
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    98
If you declare a class within a class and specify the static modifier, the
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    99
compiler treats the class just like any other top-level class.
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   100
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   101
Any class outside the declaring class accesses the nested class with the
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   102
declaring class name acting similarly to a package. eg, outer.inner. Top-level
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   103
inner classes implicitly have access only to static variables. There can also
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   104
be inner interfaces. All of these are of the nested top-level variety.
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   105
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   106
Member classes.
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   107
---------------
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   108
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   109
Member inner classes are just like other member methods and member variables
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   110
and access to the member class is restricted, just like methods and variables.
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   111
This means a public member class acts similarly to a nested top-level class.
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   112
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   113
The primary difference between member classes and nested top-level classes is
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   114
that member classes have access to the specific instance of the enclosing
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   115
class.
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   116
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   117
Local classes.
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   118
--------------
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   119
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   120
Local classes are like local variables, specific to a block of code. Their
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   121
visibility is only within the block of their declaration. In order for the
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   122
class to be useful beyond the declaration block, it would need to implement a
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   123
more publicly available interface.
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   124
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   125
Because local classes are not members, the modifiers public, protected,
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   126
private, and static are not usable.
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   127
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   128
Anonymous classes.
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   129
------------------
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   130
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   131
Anonymous inner classes extend local inner classes one level further. As
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   132
anonymous classes have no name, you cannot provide a constructor.
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   133
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   134
64-bit problem.
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   135
===============
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   136
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   137
  http://www.java.com/en/download/faq/java_win64bit.xml
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   138
                Which version of Java should I download for my 64-bit Windows
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   139
                operating system?
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   140
  http://java.sun.com/javase/6/webnotes/install/system-configurations.html
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   141
                Java SE 6 Release Notes Supported System Configurations
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   142
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   143
Java performance.
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   144
=================
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   145
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   146
  http://java.sun.com/performance/reference/whitepapers/5.0_performance.html
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   147
  http://java.sun.com/performance/reference/whitepapers/6_performance.html
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   148
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   149
Creating jar.
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   150
=============
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   151
::
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   152
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   153
  $ jar cf myFile.jar *.class
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   154
  $ jar cmf myManifestFile myFile.jar *.class
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   155
  $ jar -cfe Main.jar foo.Main foo/Main.class
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   156
1215
84101bddf00c Debugging Java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1214
diff changeset
   157
Profiling Java.
1213
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   158
===============
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   159
::
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   160
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   161
  $ java -Xprof com.vendor.product.Clazz
1214
fe28cec0bb40 java -Xrunhprof:help
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1213
diff changeset
   162
  $ java -Xrunhprof:help
1213
06623bbdb097 Profiling java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   163
1215
84101bddf00c Debugging Java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1214
diff changeset
   164
Debugging Java.
84101bddf00c Debugging Java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1214
diff changeset
   165
===============
84101bddf00c Debugging Java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1214
diff changeset
   166
84101bddf00c Debugging Java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1214
diff changeset
   167
Compile with ``-g`` to preserve source code information::
84101bddf00c Debugging Java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1214
diff changeset
   168
84101bddf00c Debugging Java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1214
diff changeset
   169
  $ javac -g -cp $CLASSPATH -sourcepath $SRC_DIR -d $BUILD_DIR
84101bddf00c Debugging Java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1214
diff changeset
   170
84101bddf00c Debugging Java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1214
diff changeset
   171
To run Java program in debugger::
84101bddf00c Debugging Java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1214
diff changeset
   172
84101bddf00c Debugging Java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1214
diff changeset
   173
  $ jdb -cp $CLASSPATH -sourcepath $SRC_DIR
84101bddf00c Debugging Java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1214
diff changeset
   174
1238
53da16ba1897 -Xrunjdwp:transport
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1216
diff changeset
   175
To attach to Java application you firstly must run application with (use
53da16ba1897 -Xrunjdwp:transport
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1216
diff changeset
   176
``dt_shmem`` for Windows and ``dt_socket`` for Linux)::
1215
84101bddf00c Debugging Java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1214
diff changeset
   177
84101bddf00c Debugging Java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1214
diff changeset
   178
  $ java -Xdebug -Xrunjdwp:transport=dt_shmem,server=y,suspend=n,address=$PORT \
84101bddf00c Debugging Java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1214
diff changeset
   179
    com.vendor.product.Clazz
84101bddf00c Debugging Java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1214
diff changeset
   180
84101bddf00c Debugging Java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1214
diff changeset
   181
and then attach with debugger::
84101bddf00c Debugging Java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1214
diff changeset
   182
84101bddf00c Debugging Java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1214
diff changeset
   183
  $ jdb -attach $PORT
84101bddf00c Debugging Java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1214
diff changeset
   184
1848
17256527f85e Creating thread dump.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1847
diff changeset
   185
Creating thread dump.
17256527f85e Creating thread dump.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1847
diff changeset
   186
=====================
17256527f85e Creating thread dump.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1847
diff changeset
   187
1629
32f8c509119d Dump current thread traces.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1563
diff changeset
   188
Dump current thread traces and memory statistic to stdout::
32f8c509119d Dump current thread traces.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1563
diff changeset
   189
32f8c509119d Dump current thread traces.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1563
diff changeset
   190
  $ kill -QUIT $PID
32f8c509119d Dump current thread traces.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1563
diff changeset
   191
1848
17256527f85e Creating thread dump.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1847
diff changeset
   192
If application started with ``nohup`` redirect output to selected file::
17256527f85e Creating thread dump.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1847
diff changeset
   193
17256527f85e Creating thread dump.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1847
diff changeset
   194
  $ nohup java -cp ... com.app.Main  >$NOHUP.log &
17256527f85e Creating thread dump.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1847
diff changeset
   195
17256527f85e Creating thread dump.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1847
diff changeset
   196
or check default ``nohup.out`` or ``$HOME/nohup.out`` file.
17256527f85e Creating thread dump.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1847
diff changeset
   197
17256527f85e Creating thread dump.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1847
diff changeset
   198
Alternatively use ``jstack`` utility for Java version 1.5 and above::
17256527f85e Creating thread dump.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1847
diff changeset
   199
17256527f85e Creating thread dump.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1847
diff changeset
   200
  $ jstack -l $PID  >$DUMP.out
17256527f85e Creating thread dump.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1847
diff changeset
   201
17256527f85e Creating thread dump.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1847
diff changeset
   202
``jstack`` should be runned from same user as probing application::
17256527f85e Creating thread dump.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1847
diff changeset
   203
17256527f85e Creating thread dump.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1847
diff changeset
   204
  $ sudo -u $USER jstack -l $PID  >$DUMP.out
17256527f85e Creating thread dump.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1847
diff changeset
   205
17256527f85e Creating thread dump.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1847
diff changeset
   206
.. NOTE:: Thread information preserved in heap dump and can be reviewed in
17256527f85e Creating thread dump.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1847
diff changeset
   207
          ``visualvm``.
17256527f85e Creating thread dump.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1847
diff changeset
   208
1845
3004b10986a1 Creating heap dump from Java application.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1833
diff changeset
   209
Creating heap dump from Java application.
3004b10986a1 Creating heap dump from Java application.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1833
diff changeset
   210
=========================================
3004b10986a1 Creating heap dump from Java application.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1833
diff changeset
   211
3004b10986a1 Creating heap dump from Java application.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1833
diff changeset
   212
Find pid of Java process::
3004b10986a1 Creating heap dump from Java application.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1833
diff changeset
   213
3004b10986a1 Creating heap dump from Java application.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1833
diff changeset
   214
  $ jps -l -v
3004b10986a1 Creating heap dump from Java application.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1833
diff changeset
   215
3004b10986a1 Creating heap dump from Java application.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1833
diff changeset
   216
Save dump to file::
3004b10986a1 Creating heap dump from Java application.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1833
diff changeset
   217
3004b10986a1 Creating heap dump from Java application.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1833
diff changeset
   218
  $ jmap -dump:format=b,file=heap.dump $PID
3004b10986a1 Creating heap dump from Java application.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1833
diff changeset
   219
1847
1333ab54cab1 ``live`` option.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1846
diff changeset
   220
With ``live`` option only reachable objects are dumped::
1333ab54cab1 ``live`` option.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1846
diff changeset
   221
1333ab54cab1 ``live`` option.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1846
diff changeset
   222
  $ jmap -dump:live,format=b,file=heap.dump $PID
1333ab54cab1 ``live`` option.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1846
diff changeset
   223
1846
a2bec9594bb4 Creating heap dump on OutOfMemory error.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1845
diff changeset
   224
Creating heap dump on OutOfMemory error.
a2bec9594bb4 Creating heap dump on OutOfMemory error.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1845
diff changeset
   225
========================================
a2bec9594bb4 Creating heap dump on OutOfMemory error.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1845
diff changeset
   226
a2bec9594bb4 Creating heap dump on OutOfMemory error.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1845
diff changeset
   227
Run Java application with::
a2bec9594bb4 Creating heap dump on OutOfMemory error.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1845
diff changeset
   228
a2bec9594bb4 Creating heap dump on OutOfMemory error.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1845
diff changeset
   229
  -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/path/to/heap.dump
a2bec9594bb4 Creating heap dump on OutOfMemory error.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1845
diff changeset
   230
1643
fed98aef5cae Debug class loading.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1629
diff changeset
   231
Debug class loading.
fed98aef5cae Debug class loading.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1629
diff changeset
   232
====================
fed98aef5cae Debug class loading.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1629
diff changeset
   233
fed98aef5cae Debug class loading.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1629
diff changeset
   234
To dump class loading and unloading to ``System.out`` add to ``java`` opts::
fed98aef5cae Debug class loading.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1629
diff changeset
   235
fed98aef5cae Debug class loading.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1629
diff changeset
   236
  $ java -XX:+TraceClassLoading -XX:+TraceClassUnloading ...
1644
54d482709640 -verbose:class
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1643
diff changeset
   237
  $ java -verbose:class ...
1643
fed98aef5cae Debug class loading.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1629
diff changeset
   238
fed98aef5cae Debug class loading.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1629
diff changeset
   239
To review loaded classes explore heap dump in ``visualvm`` (visit "Classes"
fed98aef5cae Debug class loading.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1629
diff changeset
   240
tab).
fed98aef5cae Debug class loading.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1629
diff changeset
   241
1687
da4a6ceb7e89 Decompile class file.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1686
diff changeset
   242
Decompile class file.
da4a6ceb7e89 Decompile class file.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1686
diff changeset
   243
=====================
da4a6ceb7e89 Decompile class file.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1686
diff changeset
   244
::
da4a6ceb7e89 Decompile class file.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1686
diff changeset
   245
da4a6ceb7e89 Decompile class file.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1686
diff changeset
   246
  $ javap -v -p -c My.java
da4a6ceb7e89 Decompile class file.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1686
diff changeset
   247
1269
69d8c32d7bf9 Find jar by class.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1238
diff changeset
   248
Find jar by class.
69d8c32d7bf9 Find jar by class.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1238
diff changeset
   249
==================
69d8c32d7bf9 Find jar by class.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1238
diff changeset
   250
1270
af6cbb1b5888 http://mvnrepository.com/search.html?query=PKG
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1269
diff changeset
   251
  http://mvnrepository.com/search.html?query=PKG
1269
69d8c32d7bf9 Find jar by class.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1238
diff changeset
   252
  http://www.jarfinder.com
69d8c32d7bf9 Find jar by class.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1238
diff changeset
   253
1686
4ea7c87dfb87 Set default Java in Debian.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1677
diff changeset
   254
Set default Java in Debian.
4ea7c87dfb87 Set default Java in Debian.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1677
diff changeset
   255
===========================
4ea7c87dfb87 Set default Java in Debian.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1677
diff changeset
   256
::
4ea7c87dfb87 Set default Java in Debian.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1677
diff changeset
   257
4ea7c87dfb87 Set default Java in Debian.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1677
diff changeset
   258
  $ update-java-alternatives -l
4ea7c87dfb87 Set default Java in Debian.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1677
diff changeset
   259
  $ sudo update-java-alternatives -s java-1.8.0-openjdk-i386
4ea7c87dfb87 Set default Java in Debian.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1677
diff changeset
   260
4ea7c87dfb87 Set default Java in Debian.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1677
diff changeset
   261
or individually for each executable::
4ea7c87dfb87 Set default Java in Debian.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1677
diff changeset
   262
4ea7c87dfb87 Set default Java in Debian.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1677
diff changeset
   263
  $ sudo update-alternatives --config java
4ea7c87dfb87 Set default Java in Debian.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1677
diff changeset
   264
1655
1cabdf6fe296 Import SSL certificate.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1644
diff changeset
   265
Import SSL certificate.
1cabdf6fe296 Import SSL certificate.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1644
diff changeset
   266
=======================
1cabdf6fe296 Import SSL certificate.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1644
diff changeset
   267
1cabdf6fe296 Import SSL certificate.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1644
diff changeset
   268
Get cert with::
1cabdf6fe296 Import SSL certificate.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1644
diff changeset
   269
1cabdf6fe296 Import SSL certificate.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1644
diff changeset
   270
  $ openssl s_client -connect promin-test.it.loc:433
1cabdf6fe296 Import SSL certificate.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1644
diff changeset
   271
1cabdf6fe296 Import SSL certificate.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1644
diff changeset
   272
  -----BEGIN CERTIFICATE-----
1cabdf6fe296 Import SSL certificate.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1644
diff changeset
   273
  ...
1cabdf6fe296 Import SSL certificate.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1644
diff changeset
   274
  -----END CERTIFICATE-----
1cabdf6fe296 Import SSL certificate.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1644
diff changeset
   275
1cabdf6fe296 Import SSL certificate.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1644
diff changeset
   276
or by opening URL in broswer and exporting in "Page info" ==> "Security" menu.
1cabdf6fe296 Import SSL certificate.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1644
diff changeset
   277
1cabdf6fe296 Import SSL certificate.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1644
diff changeset
   278
Call import utility with default ``changeit`` password::
1cabdf6fe296 Import SSL certificate.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1644
diff changeset
   279
1cabdf6fe296 Import SSL certificate.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1644
diff changeset
   280
  $ keytool -importcert -file $YOUR.crt -keystore $JAVA_HOME/jre/lib/security/cacert -alias $ANY -storepass changeit
1cabdf6fe296 Import SSL certificate.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1644
diff changeset
   281
  $ keytool -list -v -keystore $JAVA_HOME/jre/lib/security/cacert -storepass changeit
1cabdf6fe296 Import SSL certificate.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1644
diff changeset
   282
1cabdf6fe296 Import SSL certificate.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1644
diff changeset
   283
Import certificate system wide in Debian by (note, ``.crt`` extention is
1cabdf6fe296 Import SSL certificate.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1644
diff changeset
   284
mandatory)::
1cabdf6fe296 Import SSL certificate.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1644
diff changeset
   285
1cabdf6fe296 Import SSL certificate.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1644
diff changeset
   286
  $ sudo mkdir /usr/share/ca-certificates/$ANY/    # don't mess with other certs
1cabdf6fe296 Import SSL certificate.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1644
diff changeset
   287
  $ sudo cp /tmp/$YOUR.crt /usr/share/ca-certificates/$ANY/
1cabdf6fe296 Import SSL certificate.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1644
diff changeset
   288
  $ sudo dpkg-reconfigure --force ca-certificates  # check your cert in curses GUI!
1cabdf6fe296 Import SSL certificate.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1644
diff changeset
   289
  $ sudo update-ca-certificates --fresh --verbose
1cabdf6fe296 Import SSL certificate.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1644
diff changeset
   290
1379
e1c949673102 Java EE versions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1346
diff changeset
   291
Java EE versions.
e1c949673102 Java EE versions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1346
diff changeset
   292
=================
e1c949673102 Java EE versions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1346
diff changeset
   293
e1c949673102 Java EE versions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1346
diff changeset
   294
======= ======== ======== ========
e1c949673102 Java EE versions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1346
diff changeset
   295
Java EE Servlet  JSP      JSTL
e1c949673102 Java EE versions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1346
diff changeset
   296
======= ======== ======== ========
e1c949673102 Java EE versions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1346
diff changeset
   297
6       3.0      2.2      -
e1c949673102 Java EE versions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1346
diff changeset
   298
5       2.5      2.1      1.2
e1c949673102 Java EE versions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1346
diff changeset
   299
1.4     2.4      2.0      1.1
e1c949673102 Java EE versions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1346
diff changeset
   300
1.2     2.3      1.2      1.0
e1c949673102 Java EE versions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1346
diff changeset
   301
======= ======== ======== ========
e1c949673102 Java EE versions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1346
diff changeset
   302
1380
428a226bf835 Specify file name.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1379
diff changeset
   303
To set servlet version check ``WEB-INF/web.xml``::
1379
e1c949673102 Java EE versions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1346
diff changeset
   304
e1c949673102 Java EE versions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1346
diff changeset
   305
  <web-app xmlns="http://java.sun.com/xml/ns/javaee" version="3.0">
e1c949673102 Java EE versions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1346
diff changeset
   306
e1c949673102 Java EE versions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1346
diff changeset
   307
See:
e1c949673102 Java EE versions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1346
diff changeset
   308
1833
378b566fd86b Java EE version history
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1687
diff changeset
   309
  http://en.wikipedia.org/wiki/Java_EE_version_history
378b566fd86b Java EE version history
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1687
diff changeset
   310
    Java EE version history.
1379
e1c949673102 Java EE versions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1346
diff changeset
   311
  http://jcp.org/aboutJava/communityprocess/final/jsr315/index.html
1833
378b566fd86b Java EE version history
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1687
diff changeset
   312
    Servlet 3.0 Specification
1379
e1c949673102 Java EE versions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1346
diff changeset
   313
  http://jcp.org/aboutJava/communityprocess/mrel/jsr154/index.html
1833
378b566fd86b Java EE version history
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1687
diff changeset
   314
    Servlet 2.5 Specification
1379
e1c949673102 Java EE versions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1346
diff changeset
   315
  http://www.mularien.com/blog/2008/04/24/how-to-reference-and-use-jstl-in-your-web-application/
1833
378b566fd86b Java EE version history
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1687
diff changeset
   316
    How to Reference and Use JSTL in your Web Application
1563
9b4441d30cac Java interactive shell.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1380
diff changeset
   317
9b4441d30cac Java interactive shell.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1380
diff changeset
   318
Java interactive shell.
9b4441d30cac Java interactive shell.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1380
diff changeset
   319
=======================
9b4441d30cac Java interactive shell.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1380
diff changeset
   320
9b4441d30cac Java interactive shell.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1380
diff changeset
   321
Just use Groovy. ``bsh`` is older alternative without code completion.