jdk/make/netbeans/README
author twisti
Thu, 28 Jul 2011 02:14:44 -0700
changeset 10256 8a0a9bbb6fa5
parent 7666 7b994e3dd41d
child 10601 c496d54879f4
permissions -rw-r--r--
7066143: JSR 292: Zero support after regressions from 7009923 and 7009309 Reviewed-by: jrose, twisti Contributed-by: Xerxes Ranby <xerxes@zafena.se>
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
Working on OpenJDK using NetBeans
90ce3da70b43 Initial load
duke
parents:
diff changeset
     2
    This note describes how to work on the OpenJDK from NetBeans. We've
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
    provided several NetBeans projects as starting points. Below we'll
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
    describe how to use them, as well as how to create your own.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
Getting Started
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
    In addition to the source bundle for Open JDK, you'll need to download
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
    and install copies of the JDK and of NetBeans 6. And if you want to run
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
    tests on the JDK (you do want to run tests, right?), you'll need to
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
    install the jtreg test harness.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
    In this note, when pathnames are not fully specified, they should be
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
    interpreted as being relative to the directory containing this README
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
    and the NetBeans projects themselves.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
        The JDK build process is largely make-based, and is not
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
        exceptionally tolerant of pathnames with spaces in them (such as
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
        "Program Files". Please be sure to install everything in a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
        directories whose paths don't have any spaces!
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
    Downloading the JDK
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
        You've probably done this a million times. Download and install it
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
        from http://java.sun.com/javase
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
    Downloading the OpenJDK sources
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
        Since you're reading this, d you've already downloaded the OpenJDK
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
        source bundle.  Later in this document we'll refer to the location
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
        where you installed the Open JDK sources as *install-dir*.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
    Downloading a pre-built, JDK 7
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
        This will be necessary to do builds of some of the projects.  In
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
        general, you want to download and install a pre-built JDK that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
        corresponds to the OpenJDK sources you download.  Building the entire
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
        OpenJDK depends on a few parts of the pre-built JDK.  Get this from
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
        http://download.java.net/jdk7/binaries
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
        Note: For working on certain projects, like JMX and JConsole, you 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
              may find convenient to use a pre-built version of JDK 7 (or 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
              OpenJDK) rather than building your own. This will allow you
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
              to build only that part of the OpenJDK sources which correspond
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
              to that project. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
    NetBeans 6
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
        Yep, NetBeans *6*. Nope, not FCS'd yet. We're on the edge here,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
        enjoy it! Get the latest working development build of NetBeans 6
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
        from http://netbeans.org
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
    jtreg
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
        "jtreg" is the test harness for running OpenJDK's regression tests.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
        Get it from http://openjdk.java.net/jtreg
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
    Ant
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
       NetBeans comes with ant, but if you use a separately-installed copy
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
       please make sure that it is at least version 1.7.0.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
Configuring
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
    Building OpenJDK is hard and complex. No, strike that. While it's not
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
    exactly "easy", we've got it down to *relatively* small set of
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
    properties you need to set.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
    The NetBeans projects provided here share a fair amount of common
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
    structure. They share properties values where it makes sense. Each
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
    project loads properties from these properties files, in this order
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
        ${basedir}/nbproject/private/build.properties
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
        $HOME/.openjdk/${ant.project.name}-build.properties
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
        $HOME/.openjdk/build.properties
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
        ${basedir}/build.properties
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
    (${basedir} refers to the directory containing a particular NetBeans
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
    project.) The first time a property defined determines value: it is
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
    *not* overridden if it is read from properties files read later. The net
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
    result is that by carefully choosing where to define a property, you can
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
    have it for a specific project, all uses of a specific project (useful
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
    if you work on multiple copies of the OpenJDK sources), all projects, or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
    only projects in a specific sandbox.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
    With that in mind, please set the following properties. Presuming you
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
    want the same values for all your work, set them in
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
    $HOME/.openjdk/build.properties.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
    * bootstrap.jdk
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
        Set to the location where you installed JDK 7.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
    * jtreg.home
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
        Set to the location where you installed jtreg.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
    * make.options
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
        Some of the projects invoke "make", since they compile native code.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
        The make.options property is for passing information about what you
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
        installed where to make.  Change the paths to fit your particular
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
        situation:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
        make.options=\
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
            ALT_BOOTDIR=/home/me/bin/jdk1.6.0 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
            ALT_JDK_IMPORT_PATH=/home/me/bin/jdk1.7.0 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
            OPENJDK=true
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
        The trailing '\' are important, so that make gets the above as a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
        single set of options.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
        You might want to add additional additional options: see the README
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
        for the project you're using for more information.  And see
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
                 *install-dir*/jdk/make/README-builds.html
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
        to read much more about building the JDK.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
  Windows-specific configuration
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
    First, please note that the entire JDK cannot currently be built on
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
    Windows platforms.  This will likely limit your ability to build
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
    make-based projects.  See 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
         *install-dir*/jdk/make/README-builds.html
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
    for full information on issues with building on the Windows platform.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
    That said, there are two ways to work with the Windows-required settings
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
    for the Microsoft tools. Either:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
    * Set environment variables values in Windows
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
        Doing so means accessing the System control panel in Windows, and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
        setting the environment variables there.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
        By doing so, you can launch NetBeans by double-clicking its icon,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
        and the environment variable values will be available.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
    * Set environment variable values in a shell
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
        Doing so means adding the settings to an init file (e.g. .bashrc,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
        .cshrc, etc.) or a file that you source before running NetBeans. In
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
        this case, you'll have to launch NetBeans from the command line in a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
        shell in which you've set the environment variables.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
    In either case, the end result should be that the settings are available
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
    to the make-based build process when it runs from within NetBeans.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
    The make-based builds presumes that you're using cygwin, and expects to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
    find "make" in c:\cygwin\bin\make. If you've installed cygwin elsewhere,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
    set "make" in a properties file.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
  Configuring Project Properties
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
    A note of caution is in order: These are NetBeans *freeform* projects.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
    If you use the NetBeans GUI to examine them, things are likely to not
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
    look "right". Please don't edit them there, please instead use a text
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
    editor.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
  Locale Requirements
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
    To build the Open JDK sources, be certain that you are using the "C"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
    locale on Unix (R) platforms, or "English (United States)" locale on
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
    Windows.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
Platforms and architectures, oh my!
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
    The Open JDK can be built for a variety of operating system platforms
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
    and hardware architectures. The resulting builds are always placed in a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
    directory which contains the platform and architecture as part of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
    pathname, as in *platform*-*arch*. For example, if you build the jdk
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
    project on a Linux platform running on x86 hardware, the resulting build
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
    will be in:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
    *install-dir*/jdk/build/linux-i586
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
    We've provided support for some platforms and architectures in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
    common/architectures. Add another, if your needs require it.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
Provided NetBeans projects
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
    This section describes the NetBeans projects that help you work on
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
    particular parts of the JDK. While they're largely similar in structure
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
    and should work the way you expect NetBeans projects to work: edit,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
    build, test, etc. But there are some differences. They don't all support
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
    the same targets (e.g., there's nothing to run in jarzip project).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
    Some projects are built by invoking make, since they involve compilation
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
    of native code or other activities that cannot be done by javac. We call
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
    these "make-based", and call all others "ant-based".
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
    They all are configured by way of a build.properties file, which
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
    specifies what subdirectories of the JDK sources they manipulate, what
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
    directories contain their tests, whether they use make or ant, etc.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
    The very first time you open any one of these projects on set of Open
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
    JDK sources, NetBeans will scan the entire set of sources, not just
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
    those for the project you opened. This will take a few minutes, but will
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
    ensure that Go To Type, Go To Source, and so on work as expected. Later,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
    when you open other projects on the same Open JDK sources, there will be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
    at most a slight delay.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
    There's a README accompanying each project. Most are text files, which
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
    you can Open in NetBeans, some are HTML files, in which case unless you
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
    enjoy reading raw HTML, you're better off choosing the *View* menu item
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
    from the context menu, which will display the README in your web
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
    browser.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
    Finally, note that these projects were all created by different people,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
    and are while some attempt has been made to make them look and behave
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
    the same, they are maintained separately and will vary somewhat.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
    The projects currently provided are:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
    jdk (directory "jdk")
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
        A convenient starting point for the other projects, and from which
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
        you can build the entire OpenJDK. Please note that depending on your
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
        hardware, this could take a *very* long time. The results of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
        build are in *install-dir*/jdk/build/*platform*-*arch*.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
    world (directory "world")
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
        This project builds both the Hotspot VM and all of JavaSE. Please
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
        note that pretty much regardless of your hardware, this *will* take
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
        a long time, and use *lots* of disk space (more than 3GB). The
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
        results of the build are in
5812
45384c2300ce 6960853: Cleanup makefiles, remove unused vars etc.
ohair
parents: 4341
diff changeset
   206
        *install-dir*/build/*platform*-*arch* and
45384c2300ce 6960853: Cleanup makefiles, remove unused vars etc.
ohair
parents: 4341
diff changeset
   207
        *install-dir*/build/*platform*-*arch*-fastdebug.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
        Consult the project's README file for details.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
    AWT & Java2d (directory "awt2d")
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
        For working on AWT and Java2d. Supports running the Font2DTest demo.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
        This is a make-based project: In order to build this project, you
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
        should build the jdk project first, since AWT and Java2d include
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
        native code.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
    JConsole (directory "jconsole")
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
        For working on JConsole. Creates ../dist/lib/jconsole.jar. Supports
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
        running and debugging JConsole.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
        This ant-based project does *not* require that you build the jdk
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
        project first, provided that you use a pre-built version of JDK 7. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
    Java (TM) Management Extensions (JMX(TM)) API (directory "jmx")
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
        For working on JMX source code. Creates ../dist/lib/jmx.jar.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
        This ant-based project does *not* require that you build the jdk
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
        project first, provided that you use a pre-built version of JDK 7. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
    Jar & Zip (directory "jarzip")
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
        For working on jar & zip. It builds the zip library (including
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
        native code), the jar library, and the jar tool. Creates an
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
        executable jar program in ../build/*platform*-*arch*/bin/jar.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
        This is a make-based project: In order to build this project, you
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
        should build the jdk project first, since AWT and Java2d include
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
        native code.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
    Swing (directory "swing")
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
        For working on Swing. Creates ../dist/lib/swing.jar. Supports
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
        running and debugging the SampleTree demo.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
        This ant-based project does *not* require that you build the jdk
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
        project first, provided that you use a pre-built version of JDK 7. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
    In addition, there are projects for building the compiler, javadoc,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
    and related tools, in the OpenJDK langtools component.  These
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
    projects are separate from those described here, and have their
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
    own set of guidelines and conventions. For more details, see the 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
    README files in make/netbeans in the OpenJDK langtools component.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
Running Tests
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
    We use the jtreg test harness, described more fully at
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
    http://openjdk.java.net/jtreg
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
    The OpenJDK tests are in the default Java package, are public classes,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
    and have a "static void main(String[] args)" with which they are
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
    invoked. Some tests are actually shell scripts, which might compile
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
    code, etc. jtreg is quite flexible.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
    To run tests for a project, use *Test Project* from NetBeans. From the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
    command line, you can invoke "ant jtreg" on any individual project's
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
    build.xml file.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
    In either NetBeans of on the command line, jtreg prints summary output
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
    about the pass/fail nature of each test. An HTML report of the entire
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
    test run is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
    ../build/*platform*-*arch*/jtreg/*ant-project-name*/JTreport/report.html
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
    In that same JTreport directory are also individual HTML files
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
    summarizing the test environment, test passes and failures, etc.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
    More detail on any individual test is under
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
    ../build/*platform*-*arch*/jtreg/*ant-project-name*/JTwork.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
    For example, details about the awt/Modal/SupportedTest/SupportedTest
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
    test are under the JTwork directory at the same pathname as the test
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
    itself in a ".jtr" file. For example:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
    ../build/*platform*-*arch*/jtreg/*ant-project-name*/JTwork/awt/Modal/SupportedTest/SupportedTest.jtr
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
    Sometimes you will see that running jtreg has resulted in a failure.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
    This does not always mean that a test has an error in it. Jtreg
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
    distinguishes between these two cases. There are a number of tests that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
    are "ignored", and not run, and these are reported as failures.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
    You can run a single test by right clicking on it and choosing *Run
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
    File* from the context menu. Similarly, you can debug a single test by
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
    choosing *Debug File*.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
Debugging
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
    Debugging is enabled by default in ant-based projects, as if
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
    "-g:lines,vars,source" were given. You can alter these settings via
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
    entries in one of the configuration properties files. For example:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
     javac.debug=false
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
     javac.debuglevel=<debug level options>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
    To debug a project or test, use NetBeans in the normal way, with *Debug
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
    Project* or *Debug File*. Note that not all projects provide a target
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
    that can be debugged, but tests can be debugged.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
Creating Javadoc
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
    You can create Javadoc for any of the projects: just choose *Generate
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
    Javadoc for Project* from the NetBeans menu. Your default browser will
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
    open up, displaying the just-generated javadoc.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
    Javadoc gets generated into a separate subdirectory for each project.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
    For example, the Jar & Zip project's javadoc gets generated in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
    ../build/*platform*-*arch*/jtreg/*ant-project-name*/javadoc/jarzip
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
Cleaning projects
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
    Each project can of course be cleaned. Make-based and ant-based projects
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
    differ a little in what exactly gets cleaned. In both cases, all jtreg
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
    results and javadoc are removed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
    In ant-based projects, project-specific files as determined by the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
    project's build.properties file are removed from the classes and gensrc
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
    directories that are under ../build/*platform*-*arch*.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
    In make-based projects, "make clean" is run in the same directories as
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
    "make all" is run when building the project.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
    Please note that the jdk project is "special" with respect to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
    cleaning: in this case, the entire ../build directory is removed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
    Similar for the world project.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
Creating your own NetBeans project
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
    The project's we've provided are hopefully a useful starting point, but
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
    chances are that you want to work on something else. This section will
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
    describe how to select an existing project, and then adapt it to your
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
    needs.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
  Considerations
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
    The first consideration is whether or not the code in which you're
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
    interested needs anything beyond javac and copying of resources to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
    build. If so, then you'll need to create a make-based project. If not,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
    an ant-based project is possible. See the project descriptions above to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
    learn which are make-based, and which are ant-based.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
    The second consideration is to consider the files that you'll need. Each
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
    project is defined by 3 files:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
    * build.xml
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
        This is the ant build script. For a make-based project, they tend to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
        have a target for "make clean" and another for "make all", each of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
        which invokes "make-run" in the same set of directories. Take a look
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
        at jarzip/build.xml for an example.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
        For an ant-based project, there might be nothing, with all the work
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
        done via the declaration of properties in the build.properties file.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
        Take a look at jconsole/build.xml for an example, and notice how it
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
        overrides the -pre-compile and -post-compile targets that are
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
        defined in common/shared.xml (where they are defined to do nothing).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
    * build.properties
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
        This file defines the directories (and possibly files) that are
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
        included in and excluded from. Basically, a file is considered to be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
        in a project if it is mentioned in the includes list, or is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
        contained under a directory mentioned in that list, *unless* it is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
        explicitly excluded or is contained under a directory that is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
        excluded. Take a look awt2d/build.properties for an example.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
    * nbproject/project.xml
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
        This file defines a project for NetBeans for a "freeform" project.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
        Each declares several entity references, which are used later in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
        project. For an example, see javadoc/nbproject/project.xml, which is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
        an ant-based project. Compare that with
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
        jarzip/nbproject/project.xml, which is make-based. Not much
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
        difference! That's because while the jarzip project is make-based,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
        it does not have any platform-specifc native code. Contrast that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
        with awt2d/nbproject/project.xml, which does have native code;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
        notice that it uses platform-specific entity references.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
    In summary, we recommend exploring the given projects, and choosing one
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
    that most closely suits our needs.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
  Example: A project for working on collections
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
    Let's create a project to work with on the collections classes. There's no native
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
    code here, so an ant-based project will do. Therefore, the jconsole
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
    project is a reasonable project to use as a starting point.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
   Clone the existing project
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
    Make a directory for the collections project next to the existing projects:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
        % mkdir -p collections/nbproject
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
    Copy files from the jconsole project:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
        % cp jconsole/build.properties collections
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
        % cp jconsole/build.xml collections
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
        % cp jconsole/nbproject/project.xml collections/nbproject
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
   Change the set of files included in the project
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
    The collections sources are all under one directory, and we want to include
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
    them all. The same is true of the tests. So edit
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
    collections/build.properties so that it contains these lines:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
        includes=\
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
            java/util/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
        excludes=\
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
            java/util/Calendar.java,\
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
            java/util/jar/,\
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
            java/util/logging/,\
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
            java/util/prefs/,\
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
            java/util/regex/,\
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
            java/util/spi/,\
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
            java/util/zip/,\
4341
2af5eacd4b24 6903197: Some java template files need to be renamed to .java.template
ohair
parents: 2
diff changeset
   413
            **/*-XLocales.java.template
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
        jtreg.tests=\
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
            java/util/**/*Collection/ \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
            java/util/**/*Map/ \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
            java/util/**/*Set/ \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
            java/util/**/*List/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
    Notice the trailing "/" in some of those pathnames: that tells NetBeans to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
    treat the path as a directory and include (or exclude) everything beneath
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
    it in the hierarchy.  Note also how we include java/util, but then exclude
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
    several directories under that which are not related to collections.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
    The build.xml for collections is about as simple as can be. First, change the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
    name of the project:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
        <project name="collections" default="build" basedir=".">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
    Then remove the -pre-compile target from the build.xml.  Change the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
    -post-compile target to create collections.jar without any manifest, and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
    to only contain the collections-related classes.  The jar task now looks
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
    like this:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
        <jar destfile="${dist.dir}/lib/collections.jar">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
            <fileset dir="${classes.dir}">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
                <include name="java/util/*.class"/>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
                <exclude name="java/util/Calendar*.class"/>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
            </fileset>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
        </jar>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
    Also, change the clean target to remove collections.jar instead of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
    jconsole.jar.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
    Now edit project.xml file. NetBeans uses an internal name and a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
    user-visible name, both of which should be changed:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
        <name>Collections</name> <!-- Customized -->
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
        <property name="name">collections</property> <!-- Customized -->
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
    Inside of <ide-actions>, you'll see actions defined for "run" and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
    "debug". The Open JDK sources don't include any interesting Collections
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
    demos, but leave these here for now: Chances are you'll find or create
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
    some collections app of your own, and want to run and or debug it.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
    Now, open the Collections project in NetBeans. You'll find that it operates
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
    just like all the other projects.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
    If/when you want to have this project run a collections demo, change the run
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
    target in collections/build.xml to invoke it in whatever manner is appropriate
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
    for the app. From NetBeans, you should be able to run and debug the app,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
    including setting breakpoints in collections code.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   464
90ce3da70b43 Initial load
duke
parents:
diff changeset
   465
Appendix 1: Customizations
90ce3da70b43 Initial load
duke
parents:
diff changeset
   466
    There are several ways to customize NetBeans projects. These projects
90ce3da70b43 Initial load
duke
parents:
diff changeset
   467
    share a common structure, based on common/shared.xml and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   468
    common/make.xml. Because of that sharing, some mechanisms described
90ce3da70b43 Initial load
duke
parents:
diff changeset
   469
    below apply to most any project.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   470
90ce3da70b43 Initial load
duke
parents:
diff changeset
   471
    Several properties can be user-defined (and several should not be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   472
    user-defined!). There are different properties files read. Some default
90ce3da70b43 Initial load
duke
parents:
diff changeset
   473
    targets can be overridden.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   474
90ce3da70b43 Initial load
duke
parents:
diff changeset
   475
  Property files
90ce3da70b43 Initial load
duke
parents:
diff changeset
   476
    When projects are started, and when when ant runs (whether from NetBeans
90ce3da70b43 Initial load
duke
parents:
diff changeset
   477
    or the command line), these properties files are loaded in the order
90ce3da70b43 Initial load
duke
parents:
diff changeset
   478
    shown:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   479
90ce3da70b43 Initial load
duke
parents:
diff changeset
   480
        ${basedir}/nbproject/private/build.properties
90ce3da70b43 Initial load
duke
parents:
diff changeset
   481
        $HOME/.openjdk/${ant.project.name}-build.properties
90ce3da70b43 Initial load
duke
parents:
diff changeset
   482
        $HOME/.openjdk/build.properties
90ce3da70b43 Initial load
duke
parents:
diff changeset
   483
        ${basedir}/build.properties
90ce3da70b43 Initial load
duke
parents:
diff changeset
   484
90ce3da70b43 Initial load
duke
parents:
diff changeset
   485
    Recall that with ant, once a property is defined, its value cannot be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   486
    changed, so it's "first one wins".
90ce3da70b43 Initial load
duke
parents:
diff changeset
   487
90ce3da70b43 Initial load
duke
parents:
diff changeset
   488
    To set or change a property for all your projects, put the change into
90ce3da70b43 Initial load
duke
parents:
diff changeset
   489
    $HOME/.openjdk/build.properties. This will affect all projects,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   490
    regardless of how many copies of the Open JDK sources you have
90ce3da70b43 Initial load
duke
parents:
diff changeset
   491
    installed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   492
90ce3da70b43 Initial load
duke
parents:
diff changeset
   493
    Let's say you have 2 copies of the Open JDK sources installed on your
90ce3da70b43 Initial load
duke
parents:
diff changeset
   494
    machine. To set or change a property for only the jconsole projects, but
90ce3da70b43 Initial load
duke
parents:
diff changeset
   495
    for both of them, make the change in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   496
    $HOME/.openjdk/${ant.project.name}-build.properties. If you wanted to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   497
    make the change for only one of them, do it in that project's
90ce3da70b43 Initial load
duke
parents:
diff changeset
   498
    ${basedir}/build.properties or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   499
    ${basedir}/nbproject/private/build.properties.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   500
90ce3da70b43 Initial load
duke
parents:
diff changeset
   501
    Note that the ${basedir}/build.properties file is provided as part of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   502
    the Open JDK sources. If you want to make a change for a particular
90ce3da70b43 Initial load
duke
parents:
diff changeset
   503
    project, you can do so there. To be sure that you don't ever
90ce3da70b43 Initial load
duke
parents:
diff changeset
   504
    accidentally check it in to the Open JDK sources, you might prefer to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   505
    change it in ${basedir}/nbproject/private/build.properties.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   506
90ce3da70b43 Initial load
duke
parents:
diff changeset
   507
  User-definable Properties
90ce3da70b43 Initial load
duke
parents:
diff changeset
   508
    You can provide your own definitions for the properties listed below. We
90ce3da70b43 Initial load
duke
parents:
diff changeset
   509
    don't recommend overriding the definitions of other properties.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   510
90ce3da70b43 Initial load
duke
parents:
diff changeset
   511
    The following two properties should be set before you try to use the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   512
    projects with NetBeans or ant:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   513
90ce3da70b43 Initial load
duke
parents:
diff changeset
   514
    * bootstrap.jdk
90ce3da70b43 Initial load
duke
parents:
diff changeset
   515
        Default: None. Please set this, normally in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   516
        $HOME/.openjdk/build.properties.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   517
90ce3da70b43 Initial load
duke
parents:
diff changeset
   518
    * jtreg.home
90ce3da70b43 Initial load
duke
parents:
diff changeset
   519
        Default: None. Please set this, normally in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   520
        $HOME/.openjdk/build.properties.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   521
90ce3da70b43 Initial load
duke
parents:
diff changeset
   522
    These options are for configuring the behavior of make:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   523
90ce3da70b43 Initial load
duke
parents:
diff changeset
   524
    * use.make
90ce3da70b43 Initial load
duke
parents:
diff changeset
   525
        Default: Not set. Set this, normally in ${basedir}/build.properties,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   526
        for a project which is make-based.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   527
90ce3da70b43 Initial load
duke
parents:
diff changeset
   528
    * make
90ce3da70b43 Initial load
duke
parents:
diff changeset
   529
        Default: The right make for the platform, at the normal location, set
90ce3da70b43 Initial load
duke
parents:
diff changeset
   530
        in *install-dir*/jdk/make/netbeans/common/make.xml
90ce3da70b43 Initial load
duke
parents:
diff changeset
   531
90ce3da70b43 Initial load
duke
parents:
diff changeset
   532
    * make.options
90ce3da70b43 Initial load
duke
parents:
diff changeset
   533
        Default: Empty string. Set this to any options you want to pass to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   534
        make, normally in ${basedir}/build.properties.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   535
90ce3da70b43 Initial load
duke
parents:
diff changeset
   536
    The remaining options are for use at your discretion:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   537
90ce3da70b43 Initial load
duke
parents:
diff changeset
   538
    * javac.options
90ce3da70b43 Initial load
duke
parents:
diff changeset
   539
        Default: -Xlint
90ce3da70b43 Initial load
duke
parents:
diff changeset
   540
90ce3da70b43 Initial load
duke
parents:
diff changeset
   541
    * javac.debug
90ce3da70b43 Initial load
duke
parents:
diff changeset
   542
        Default: true
90ce3da70b43 Initial load
duke
parents:
diff changeset
   543
90ce3da70b43 Initial load
duke
parents:
diff changeset
   544
    * javac.debuglevel
90ce3da70b43 Initial load
duke
parents:
diff changeset
   545
        Default: lines,vars,source
90ce3da70b43 Initial load
duke
parents:
diff changeset
   546
90ce3da70b43 Initial load
duke
parents:
diff changeset
   547
    * javadoc.options
90ce3da70b43 Initial load
duke
parents:
diff changeset
   548
        Default: Empty string.  Some projects will need to set this to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   549
        increase the heap for running javadoc.  For example, see the jconsole
90ce3da70b43 Initial load
duke
parents:
diff changeset
   550
        project.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   551
90ce3da70b43 Initial load
duke
parents:
diff changeset
   552
    * javadoc.packagenames
90ce3da70b43 Initial load
duke
parents:
diff changeset
   553
        Default: "none".  Set this only if your project has packages that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   554
        should be javadoc'd which are outside of those listed in the javadoc
90ce3da70b43 Initial load
duke
parents:
diff changeset
   555
        target's packageset.  See the jconsole project for an example.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   556
90ce3da70b43 Initial load
duke
parents:
diff changeset
   557
    * jtreg.tests
90ce3da70b43 Initial load
duke
parents:
diff changeset
   558
        Default: None. Set this to a list of tests and/or directories
90ce3da70b43 Initial load
duke
parents:
diff changeset
   559
        containing regression tests, normally in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   560
        ${basedir}/build.properties.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   561
90ce3da70b43 Initial load
duke
parents:
diff changeset
   562
    * jtreg.options
90ce3da70b43 Initial load
duke
parents:
diff changeset
   563
        Default: Empty string. See http://openjdk.java.net/jtreg
90ce3da70b43 Initial load
duke
parents:
diff changeset
   564
90ce3da70b43 Initial load
duke
parents:
diff changeset
   565
    * jtreg.vm.options
90ce3da70b43 Initial load
duke
parents:
diff changeset
   566
        Default: Empty string. See http://openjdk.java.net/jtreg
90ce3da70b43 Initial load
duke
parents:
diff changeset
   567
90ce3da70b43 Initial load
duke
parents:
diff changeset
   568
    * jtreg.samevm
90ce3da70b43 Initial load
duke
parents:
diff changeset
   569
        Default: false. See http://openjdk.java.net/jtreg
90ce3da70b43 Initial load
duke
parents:
diff changeset
   570
90ce3da70b43 Initial load
duke
parents:
diff changeset
   571
  User-overridable Targets
90ce3da70b43 Initial load
duke
parents:
diff changeset
   572
    The following targets are provided for your convenience in customizing
90ce3da70b43 Initial load
duke
parents:
diff changeset
   573
    various standard actions of the build process. The default action for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   574
    each one is to do nothing.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   575
90ce3da70b43 Initial load
duke
parents:
diff changeset
   576
    These come in pairs, allowing your scripts to take some action before or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   577
    after a standard action.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   578
90ce3da70b43 Initial load
duke
parents:
diff changeset
   579
    * -pre-init
90ce3da70b43 Initial load
duke
parents:
diff changeset
   580
        Runs before any other initialization has been done.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   581
90ce3da70b43 Initial load
duke
parents:
diff changeset
   582
    * -post-init
90ce3da70b43 Initial load
duke
parents:
diff changeset
   583
        Runs before after all other initialization has been done.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   584
90ce3da70b43 Initial load
duke
parents:
diff changeset
   585
    * -pre-compile
90ce3da70b43 Initial load
duke
parents:
diff changeset
   586
        Runs before compilation, whether via ant or make. Note that in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   587
        case of make, it is before the -build-make target has run, not after
90ce3da70b43 Initial load
duke
parents:
diff changeset
   588
        each individual make-run has run.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   589
90ce3da70b43 Initial load
duke
parents:
diff changeset
   590
    * -post-compile
90ce3da70b43 Initial load
duke
parents:
diff changeset
   591
        Runs after compilation, whether via ant or make.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   592
90ce3da70b43 Initial load
duke
parents:
diff changeset
   593
    * -pre-jtreg
90ce3da70b43 Initial load
duke
parents:
diff changeset
   594
        Runs before regression tests are run.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   595
90ce3da70b43 Initial load
duke
parents:
diff changeset
   596
    * -post-jtreg
90ce3da70b43 Initial load
duke
parents:
diff changeset
   597
        Runs before after regression tests are run.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   598
90ce3da70b43 Initial load
duke
parents:
diff changeset
   599
    In a make-based project, you should override these targets to do the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   600
    build and clean actions required of your project.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   601
90ce3da70b43 Initial load
duke
parents:
diff changeset
   602
    * -build-make
90ce3da70b43 Initial load
duke
parents:
diff changeset
   603
    * -clean-make
90ce3da70b43 Initial load
duke
parents:
diff changeset
   604
90ce3da70b43 Initial load
duke
parents:
diff changeset
   605
Known Issues
90ce3da70b43 Initial load
duke
parents:
diff changeset
   606
  Tests won't run: waiting for lock
90ce3da70b43 Initial load
duke
parents:
diff changeset
   607
    Occasionally when running tests, there will be a delay, followed by a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   608
    message like this:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   609
        Waiting to lock test result cache for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   610
           /tmp/jdk/build/linux-i586/jtreg/jconsole/JTwork for 20 seconds
90ce3da70b43 Initial load
duke
parents:
diff changeset
   611
    The workaround is to stop the tests, rm -rf the offending jtreg/<project>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   612
    directory by hand, and re-run the tests.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   613
90ce3da70b43 Initial load
duke
parents:
diff changeset
   614
  Can't run nor debug a single test in the JConsole test
90ce3da70b43 Initial load
duke
parents:
diff changeset
   615
    In most projects, you can run a single test by opening it in the editor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   616
    and choosing Run File from the context menu.  If you try this with the a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   617
    JConsole test, instead you'll see that *all* tests from *all* projects
90ce3da70b43 Initial load
duke
parents:
diff changeset
   618
    are run.  The workaround is to not try to run a single JConsole test.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   619
    Debugging is similarly problematic (both running and debugging use the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   620
    same underlying infrastructure).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   621
90ce3da70b43 Initial load
duke
parents:
diff changeset
   622
    If you do Run File a JConsole tests, you can always stop them by pressing
90ce3da70b43 Initial load
duke
parents:
diff changeset
   623
    the stop button in the NetBeans output window.  But you'll be surprised to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   624
    learn that they are actually still running in the background.  The only
90ce3da70b43 Initial load
duke
parents:
diff changeset
   625
    way out of this situation is to exit NetBeans.  A few more tests will run,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   626
    but after restarting NetBeans things will be OK.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   627
90ce3da70b43 Initial load
duke
parents:
diff changeset
   628
Attribution
90ce3da70b43 Initial load
duke
parents:
diff changeset
   629
    UNIX is a registered trademark in the United States and other countries,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   630
    exclusively licensed through X/Open Company, Ltd.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   631