0% found this document useful (0 votes)
9 views

73752

The document provides information on the book 'Beginning Java SE 6 Platform: From Novice to Professional' by Jeff Friesen, including download links and details about other related ebooks. It highlights the key features of Java SE 6 and offers insights into upcoming features in Java SE 7. Additionally, it includes a comprehensive table of contents and information about the author and technical reviewers.

Uploaded by

amasierenas
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

73752

The document provides information on the book 'Beginning Java SE 6 Platform: From Novice to Professional' by Jeff Friesen, including download links and details about other related ebooks. It highlights the key features of Java SE 6 and offers insights into upcoming features in Java SE 7. Additionally, it includes a comprehensive table of contents and information about the author and technical reviewers.

Uploaded by

amasierenas
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 50

Visit https://ebookultra.

com to download the full version and


explore more ebooks or textbooks

Beginning Java SE 6 Platform From Novice to


Professional 1st Edition Jeff Friesen

_____ Click the link below to download _____


https://ebookultra.com/download/beginning-java-
se-6-platform-from-novice-to-professional-1st-edition-jeff-
friesen/

Explore and download more ebooks or textbooks at ebookultra.com


Here are some recommended products that we believe you will be
interested in. You can click the link to download.

Beginning Java 7 1st Edition Jeff Friesen

https://ebookultra.com/download/beginning-java-7-1st-edition-jeff-
friesen/

Beginning PivotTables in Excel 2007 From Novice to


Professional Beginning from Novice to Professional 1st
Edition Debra Dalgleish
https://ebookultra.com/download/beginning-pivottables-in-
excel-2007-from-novice-to-professional-beginning-from-novice-to-
professional-1st-edition-debra-dalgleish/

Beginning Joomla From Novice to Professional Dan Rahmel

https://ebookultra.com/download/beginning-joomla-from-novice-to-
professional-dan-rahmel/

Beginning Ruby From Novice to Professional 3rd Edition


Peter Cooper

https://ebookultra.com/download/beginning-ruby-from-novice-to-
professional-3rd-edition-peter-cooper/
Beginning Databases with PostgreSQL From Novice to
Professional 2nd Edition Matthew

https://ebookultra.com/download/beginning-databases-with-postgresql-
from-novice-to-professional-2nd-edition-matthew/

Beginning portable shell scripting from novice to


professional 1st Edition Peter Seebach

https://ebookultra.com/download/beginning-portable-shell-scripting-
from-novice-to-professional-1st-edition-peter-seebach/

Beginning OpenOffice 3 From Novice to Professional 1st


Edition Andy Channelle (Auth.)

https://ebookultra.com/download/beginning-openoffice-3-from-novice-to-
professional-1st-edition-andy-channelle-auth/

Beginning Microsoft Word Business Documents Beginning from


Novice to Professional 1st Edition James J. Marshall

https://ebookultra.com/download/beginning-microsoft-word-business-
documents-beginning-from-novice-to-professional-1st-edition-james-j-
marshall/

Beginning SQL Server 2000 DBA From Novice to Professional


1st Edition Tony Bain

https://ebookultra.com/download/beginning-sql-server-2000-dba-from-
novice-to-professional-1st-edition-tony-bain/
Beginning Java SE 6 Platform From Novice to
Professional 1st Edition Jeff Friesen Digital Instant
Download
Author(s): Jeff Friesen
ISBN(s): 9781590598306, 159059830X
Edition: 1
File Details: PDF, 2.94 MB
Year: 2007
Language: english
 CYAN  YELLOW
 MAGENTA BLACK
 PANTONE 123 C

Empowering Productivity for the JavA™ Developer The EXPERT’s VOIce ® in Java™ Technology
Companion eBook
Author of Available
Includes
Includes
Java 2 By Example,
Second Edition
Beginning Java SE 6 Platform: ™
Java™™ SE 7
Beginning Preview
From Novice to Professional

Java SE 6 Platform
Dear Reader,

Every two years or so, Sun releases a major update to the Java™ platform, and
Beginning

Java SE 6
each update introduces new features and improves on existing features. This
book covers the key new features in Java SE 6—ranging from the core libraries
to security and web services.
As a busy professional, you need easy access to key information. This book
tells you precisely what distinguishes Java SE 6 from its predecessors. In the ™
first chapter, I introduce you to Java SE 6 in a broad sweep. The following chap-
ters drill down to specific features of Java SE 6 by topic areas, such as JDBC™,


scripting, Swing, and the Abstract Windowing Toolkit (AWT). Each chapter
wraps up with a “Test Your Understanding” section, which challenges your

Platform
grasp of its topic area. An appendix provides complete answers to those ques-
tions. Other appendices summarize Java SE 6 annotation types, tools, and per-
formance enhancements.
While you’re here to learn about the features of Java SE 6, you may also want
to get an idea of what’s coming up in Java SE 7. So I include a preview of Java SE
7. You’ll find out about upcoming language features such as closures, and API
changes such as the Swing Application Framework.
My goal is to give you a fast and secure knowledge of Java SE 6 today, and
insight into what you can expect in the future, so you can feel confident with
Java for the years to come. From Novice to Professional
Jeff Friesen

Companion eBook THE APRESS JAVA™ ROADMAP


Pro Java™ 6 3D
Your guide to the new and improved features in the
Game Development: open source Java™ Standard Edition (SE) 6 platform.
Java 3D™, JOGL, JInput
Beginning and JOAL APIs
Java™ SE 6 Platform
See last page for details firstPress
on $10 eBook version JavaFX™ Script

SOURCE CODE ONLINE


www.apress.com
java.apress.com
ISBN-13: 978-1-59059-830-6
ISBN-10: 1-59059-830-X
Friesen Jeff Friesen
53999

US $39.99

Shelve in
Java Programming

User level: 9 781590 598306


Beginner–Intermediate

this print for content only—size & color not accurate spine = 0.969" 512 page count
830-X FM.qxd 10/2/07 9:11 PM Page i

Beginning Java™ SE 6
Platform
From Novice to Professional

Jeff Friesen
830-X FM.qxd 10/2/07 9:11 PM Page ii

Beginning Java™ SE 6 Platform: From Novice to Professional


Copyright © 2007 by Jeff Friesen
All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means,
electronic or mechanical, including photocopying, recording, or by any information storage or retrieval
system, without the prior written permission of the copyright owner and the publisher.
ISBN-13 (pbk): 978-1-59059-830-6
ISBN-10 (pbk): 1-59059-830-X
Printed and bound in the United States of America 9 8 7 6 5 4 3 2 1
Trademarked names may appear in this book. Rather than use a trademark symbol with every occurrence
of a trademarked name, we use the names only in an editorial fashion and to the benefit of the trademark
owner, with no intention of infringement of the trademark.
Java™ and all Java-based marks are trademarks or registered trademarks of Sun Microsystems, Inc., in the
US and other countries. Apress, Inc., is not affiliated with Sun Microsystems, Inc., and this book was writ-
ten without endorsement from Sun Microsystems, Inc.
Lead Editor: Steve Anglin
Technical Reviewers: Sumit Pal, John Zukowski
Editorial Board: Steve Anglin, Ewan Buckingham, Tony Campbell, Gary Cornell, Jonathan Gennick,
Jason Gilmore, Kevin Goff, Jonathan Hassell, Matthew Moodie, Joseph Ottinger,
Jeffrey Pepper, Ben Renow-Clarke, Dominic Shakeshaft, Matt Wade, Tom Welsh
Project Manager: Richard Dal Porto
Copy Editor: Marilyn Smith
Assistant Production Director: Kari Brooks-Copony
Production Editor: Elizabeth Berry
Compositor: Gina Rexrode
Proofreader: April Eddy
Indexer: Becky Hornyak
Artist: April Milne
Cover Designer: Kurt Krames
Manufacturing Director: Tom Debolski
Distributed to the book trade worldwide by Springer-Verlag New York, Inc., 233 Spring Street, 6th Floor,
New York, NY 10013. Phone 1-800-SPRINGER, fax 201-348-4505, e-mail [email protected], or
visit http://www.springeronline.com.
For information on translations, please contact Apress directly at 2855 Telegraph Avenue, Suite 600,
Berkeley, CA 94705. Phone 510-549-5930, fax 510-549-5939, e-mail [email protected], or visit
http://www.apress.com.
The information in this book is distributed on an “as is” basis, without warranty. Although every precau-
tion has been taken in the preparation of this work, neither the author(s) nor Apress shall have any
liability to any person or entity with respect to any loss or damage caused or alleged to be caused directly
or indirectly by the information contained in this work.
The source code for this book is available to readers at http://www.apress.com in the Source Code/
Download section.
830-X FM.qxd 10/2/07 9:11 PM Page iii

To my parents and my good friend Amaury


830-X FM.qxd 10/2/07 9:11 PM Page iv
830-X FM.qxd 10/2/07 9:11 PM Page v

Contents at a Glance

Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xv
About the Author . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvi
About the Technical Reviewers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvii
Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xviii
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xix

■CHAPTER 1 Introducing Java SE 6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1


■CHAPTER 2 Core Libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
■CHAPTER 3 GUI Toolkits: AWT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
■CHAPTER 4 GUI Toolkits: Swing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
■CHAPTER 5 Internationalization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
■CHAPTER 6 Java Database Connectivity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
■CHAPTER 7 Monitoring and Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221
■CHAPTER 8 Networking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253
■CHAPTER 9 Scripting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281
■CHAPTER 10 Security and Web Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345
■APPENDIX A New Annotation Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 381
■APPENDIX B New and Improved Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 389
■APPENDIX C Performance Enhancements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 409
■APPENDIX D Test Your Understanding Answers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 415
■APPENDIX E A Preview of Java SE 7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 455

■INDEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 469

v
7f672e752e259312b9d0e126a4b50034
830-X FM.qxd 10/2/07 9:11 PM Page vi
830-X FM.qxd 10/2/07 9:11 PM Page vii

Contents

Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xv
About the Author . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvi
About the Technical Reviewers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvii
Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xviii
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xix

■CHAPTER 1 Introducing Java SE 6 .......................................1

Name Change for This Java Edition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1


The Themes of Java SE 6. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Overview of Java SE 6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Sampling of Java SE 6 New Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
A Trio of New Action Keys and a Method to
Hide/Show Action Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Clearing a ButtonGroup’s Selection . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Enhancements to Reflection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
GroupLayout Layout Manager . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Image I/O GIF Writer Plug-in . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Incremental Improvements to String . . . . . . . . . . . . . . . . . . . . . . . . . . 16
LCD Text Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
NumberFormat and Rounding Modes. . . . . . . . . . . . . . . . . . . . . . . . . . 18
Improved File Infrastructure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Window Icon Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Window Minimum Size . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Interruptible I/O Switch for Solaris . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
ZIP and JAR Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Ownerless Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Navigable Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Java SE 6, Update 1 and Update 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Test Your Understanding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 vii
830-X FM.qxd 10/2/07 9:11 PM Page viii

viii ■CONTENTS

■CHAPTER 2 Core Libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37


BitSet Enhancements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Compiler API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
Access to the Compiler and Other Tools . . . . . . . . . . . . . . . . . . . . . . . 39
The Standard File Manager . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Compilation Task Futures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Diagnostic Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
String-Based Compilation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
I/O Enhancements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
Console I/O . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
Disk Free Space and Other Partition-Space Methods . . . . . . . . . . . . 52
File-Access Permissions Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
Mathematics Enhancements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
New and Improved Collections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
More Collections Interfaces and Classes . . . . . . . . . . . . . . . . . . . . . . . 57
More Utility Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
New and Improved Concurrency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
More Concurrent Interfaces and Classes . . . . . . . . . . . . . . . . . . . . . . . 70
Ownable and Queued Long Synchronizers . . . . . . . . . . . . . . . . . . . . . 72
Extension Mechanism and ServiceLoader API . . . . . . . . . . . . . . . . . . . . . . . 73
Extension Mechanism . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
ServiceLoader API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
Test Your Understanding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77

■CHAPTER 3 GUI Toolkits: AWT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79


Desktop API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
Dynamic Layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
Improved Support for Non-English Locale Input . . . . . . . . . . . . . . . . . . . . . 91
New Modality Model and API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
Splash Screen API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
Making a Splash . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
Customizing the Splash Screen. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
System Tray API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
Exploring the SystemTray and TrayIcon Classes. . . . . . . . . . . . . . . . 103
Quickly Launching Programs via the System Tray . . . . . . . . . . . . . . 110
XAWT Support on Solaris . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
Test Your Understanding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
830-X FM.qxd 10/2/07 9:11 PM Page ix

■CONTENTS ix

■CHAPTER 4 GUI Toolkits: Swing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119


Arbitrary Components for JTabbedPane Tab Headers . . . . . . . . . . . . . . . . 119
Improved SpringLayout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
Improved Swing Component Drag-and-Drop . . . . . . . . . . . . . . . . . . . . . . . 126
JTable Sorting and Filtering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
Sorting the Table’s Rows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
Filtering the Table’s Rows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
Look and Feel Enhancements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
New SwingWorker . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
Text Component Printing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
Test Your Understanding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151

■CHAPTER 5 Internationalization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153


Japanese Imperial Era Calendar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
Date Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
Calendar Page Display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
Locale-Sensitive Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
Service Provider Interface Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
A New Currency for Java . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
New Locales . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
Normalizer API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
ResourceBundle Enhancements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
Taking Advantage of Cache Clearing . . . . . . . . . . . . . . . . . . . . . . . . . 173
Taking Control of the getBundle() Methods . . . . . . . . . . . . . . . . . . . . 180
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184
Test Your Understanding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
830-X FM.qxd 10/2/07 9:11 PM Page x

x ■CONTENTS

■CHAPTER 6 Java Database Connectivity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187


JDBC 4.0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
Automatic Driver Loading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188
Enhanced BLOB and CLOB Support . . . . . . . . . . . . . . . . . . . . . . . . . . 189
Enhanced Connection Management . . . . . . . . . . . . . . . . . . . . . . . . . . 191
Enhanced Exception Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
National Character Set Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
New Scalar Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197
SQL ROWID Data Type Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
SQL XML Data Type Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
Wrapper Pattern Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202
Java DB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
Java DB Installation and Configuration . . . . . . . . . . . . . . . . . . . . . . . 205
Java DB Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
Java DB Command-Line Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
Play with the EMPLOYEE Database . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
Test Your Understanding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219

■CHAPTER 7 Monitoring and Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221

Dynamic Attach and the Attach API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221


Using the Attach API with the JMX Agent. . . . . . . . . . . . . . . . . . . . . . 224
Using the Attach API with Your Own Java-Based Agent . . . . . . . . . 231
Improved Instrumentation API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236
Retransformation Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238
Native Method Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238
Support for Additional Instrumentation Classes . . . . . . . . . . . . . . . . 239
Improved JVM Tool Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240
Improved Management and JMX APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
Management API Enhancements . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242
JMX API Enhancements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243
JConsole GUI Makeover . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
JConsole Plug-ins and the JConsole API . . . . . . . . . . . . . . . . . . . . . . . . . . . 245
A Basic Plug-in . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246
Beyond the Basic Plug-in . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251
Test Your Understanding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251
830-X FM.qxd 10/2/07 9:11 PM Page xi

■CONTENTS xi

■CHAPTER 8 Networking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253


CookieHandler Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253
Internationalized Domain Names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257
An IDN Converter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259
A Better Browser . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261
Lightweight HTTP Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264
Network Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267
SPNEGO HTTP Authentication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271
Challenge-Response Mechanism, Credentials, and
Authentication Schemes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272
Basic Authentication Scheme and Authenticator Class . . . . . . . . . . 272
Digest Authentication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275
NTLM and Kerberos Authentication . . . . . . . . . . . . . . . . . . . . . . . . . . 276
GSS-API, SPNEGO, and the Negotiate Authentication Scheme . . . 276
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278
Test Your Understanding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279

■CHAPTER 9 Scripting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281


Scripting API Fundamentals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281
Obtaining Script Engines from Factories via the Script Engine
Manager . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284
Evaluating Scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290
Interacting with Java Classes and Interfaces from Scripts. . . . . . . 292
Communicating with Scripts via Script Variables . . . . . . . . . . . . . . . 294
Understanding Bindings and Scopes . . . . . . . . . . . . . . . . . . . . . . . . . 296
Understanding Script Contexts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300
Generating Scripts from Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308
Compiling Scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309
Invoking Global, Object Member, and Interface-Implementing
Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311
Playing with the Command-Line Script Shell . . . . . . . . . . . . . . . . . . 316
The Scripting API and JEditorPane . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319
The Scripting API with JRuby and JavaFX Script . . . . . . . . . . . . . . . . . . . . 332
JRuby and the Scripting API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 332
JavaFX Script and the Scripting API . . . . . . . . . . . . . . . . . . . . . . . . . . 336
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 342
Test Your Understanding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343
830-X FM.qxd 10/2/07 9:11 PM Page xii

xii ■CONTENTS

■CHAPTER 10 Security and Web Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345


Smart Card I/O API. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345
XML Digital Signature APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349
Digital Signature Fundamentals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349
XML Signatures Standard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 350
Java and the XML Signatures Standard. . . . . . . . . . . . . . . . . . . . . . . 353
Web Services Stack . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365
Creating and Testing Your Own Web Service. . . . . . . . . . . . . . . . . . . 367
Accessing an Existing Web Service . . . . . . . . . . . . . . . . . . . . . . . . . . 371
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 377
Test Your Understanding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 378

■APPENDIX A New Annotation Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 381


Annotation Types for Annotation Processors. . . . . . . . . . . . . . . . . . . . . . . . 381
Common Annotations 1.0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 382
More New Annotation Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 384

■APPENDIX B New and Improved Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 389


Basic Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 389
Enhanced Java Archivist . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 389
Enhanced Java Language Compiler . . . . . . . . . . . . . . . . . . . . . . . . . . 391
Command-Line Script Shell . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 397
Java Monitoring and Management Console . . . . . . . . . . . . . . . . . . . . . . . . 399
Java Web Services Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 400
Java Web Start . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 400
Security Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 401
New keytool Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 401
New jarsigner Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 401
Troubleshooting Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 402
Virtual Machine and Runtime Environment . . . . . . . . . . . . . . . . . . . . . . . . . 407
830-X FM.qxd 10/2/07 9:11 PM Page xiii

■CONTENTS xiii

■APPENDIX C Performance Enhancements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 409


A Fix for the Gray-Rect Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 409
Better-Performing Image I/O . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 412
Faster Java Virtual Machine. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 413
Single-Threaded Rendering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 414

■APPENDIX D Test Your Understanding Answers . . . . . . . . . . . . . . . . . . . . . . . . 415


Chapter 1: Introducing Java SE 6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 415
Chapter 2: Core Libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 416
Chapter 3: GUI Toolkits: AWT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 419
Chapter 4: GUI Toolkits: Swing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 424
Chapter 5: Internationalization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 425
Chapter 6: Java Database Connectivity . . . . . . . . . . . . . . . . . . . . . . . . . . . . 431
Chapter 7: Monitoring and Management . . . . . . . . . . . . . . . . . . . . . . . . . . . 438
Chapter 8: Networking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 443
Chapter 9: Scripting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 445
Chapter 10: Security and Web Services . . . . . . . . . . . . . . . . . . . . . . . . . . . 449

■APPENDIX E A Preview of Java SE 7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 455


Closures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 455
JMX 2.0 and Web Services Connector for JMX Agents . . . . . . . . . . . . . . . 457
More Scripting Languages and invokedynamic . . . . . . . . . . . . . . . . . . . . . 458
New I/O: The Next Generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 458
Superpackages and the Java Module System . . . . . . . . . . . . . . . . . . . . . 459
Swing Application Framework . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 460

■INDEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 469
830-X FM.qxd 10/2/07 9:11 PM Page xiv
830-X FM.qxd 10/2/07 9:11 PM Page xv

Preface

I n late 2005, I started to explore Java SE 6 by writing a JavaWorld article titled


“Start saddling up for Mustang” (http://www.javaworld.com/javaworld/jw-01-2006/
jw-0109-mustang.html). This article investigated Console I/O, partition-space methods,
the Splash Screen API, and the System Tray API.
In mid-2006, I wrote “Mustang (Java SE 6) Gallops into Town” (http://www.informit.
com/articles/article.asp?p=661371&rl=1) for informit.com. This article continued my
earlier Java SE 6 exploration by focusing on access permissions control methods, the
Desktop API, programmatic access to network parameters, and table sorting and
filtering.
In late 2006, I completed my article-based coverage of Java SE 6 by writing a trilogy
of articles for informit.com: “Taming Mustang, Part 1: Collections API” (http://www.
informit.com/articles/article.asp?p=696620&rl=1), “Taming Mustang, Part 2: Scripting
API Tour” (http://www.informit.com/articles/article.asp?p=696621&rl=1), and “Taming
Mustang, Part 3: A New Script Engine” (http://www.informit.com/articles/article.
asp?p=696622&rl=1).
This book continues my exploration of Java SE 6.

xv
830-X FM.qxd 10/2/07 9:11 PM Page xvi

About the Author

■JEFF FRIESEN has been actively involved with Java since the late 1990s. Jeff has worked
with Java in various companies, including a health-care–oriented consulting firm, where
he created his own Java/C++ software for working with smart cards. Jeff has written about
Java in numerous articles for JavaWorld.com, informit.com, and java.net, and has
authored Java 2 by Example, Second Edition (Que Publishing). Jeff has also taught Java in
university and college continuing education classes. He has a Bachelor of Science degree
in mathematics and computer science from Brandon University in Brandon, Manitoba,
Canada.

xvi
830-X FM.qxd 10/2/07 9:11 PM Page xvii

About the Technical Reviewers

■SUMIT PAL has about 14 years of experience with software architec-


ture, design, and development on a variety of platforms, including
Java, J2EE. He has worked in the SQL Server Replication group while
with Microsoft, and with Oracle’s OLAP Server group while with
Oracle. Apart from certifications such as IEEE-CSDP and J2EE
Architect, Sumit has a Master of Science degree in Computer Science.
Sumit has a keen interest in database internals, algorithms, and
search engine technology. He currently works as an OLAP architect for LeapFrogRX.
Sumit has invented some basic generalized algorithms to find divisibility between num-
bers, and also invented divisibility rules for prime numbers less than 100. Sumit has a
fierce desire to work for Google some day.

■JOHN ZUKOWSKI performs strategic Java consulting for JZ Ventures, Inc. He regularly con-
tributes to Sun’s monthly Tech Tips column and Java Technology Fundamentals
newsletter. In addition, John monitors IBM’s client-side Java programming forum at
developerWorks. Since the beginning of Java time, John has authored ten books solo and
contributed to several others. His best sellers include three editions each of the Definitive
Guide to Swing (Apress) and Mastering Java 2 (Sybex), and his latest, the predecessor to
this book, Java 6 Platform Revealed (Apress).

xvii
830-X FM.qxd 10/2/07 9:11 PM Page xviii

Acknowledgments

I thank Steve Anglin for giving me the opportunity to continue my exploration of Java SE 6
via this book. I also thank Richard Dal Porto for guiding me through various aspects of
the writing process. Thank you Sumit and John for your diligence in catching various
flaws (including some embarrassing ones) that would otherwise have made it into this
book. Finally, I thank Marilyn Smith, Elizabeth Berry, and April Eddy for making the
book’s content look good.

xviii
830-X FM.qxd 10/2/07 9:11 PM Page xix

Introduction

W elcome to Beginning Java SE 6 Platform. Contrary to its title, this is not another
beginner-oriented book on Java. You will not learn about classes, threads, file I/O, and
other fundamental topics. If learning Java from scratch is your objective, you will need
to find another book. But if you need to know (or if you just happen to be curious about)
what makes Java SE 6 stand apart from its predecessors, this book is for you.
This book starts you on a journey of exploration into most of Java SE 6’s new and
improved features. Unfortunately, various constraints kept me from covering every fea-
ture, including the JavaBeans Activation Framework (<<sigh>>).
While you learn about these features, you’ll also encounter exciting technologies,
such as JRuby and JavaFX, and even catch a glimpse of Java SE 7. You’ll also find numer-
ous questions and exercises that challenge your understanding of Java SE 6, and
numerous links to web resources for continuing this journey.
Beginning Java SE 6 Platform is a must-have resource if you want to quickly upgrade
your skills. It is also the right choice if you need information about performance and
other important topics before deciding if your company should upgrade to Java SE 6. This
book will save you from wading through Java SE Development Kit (JDK) documentation
and performing a lot of Internet searches.
Authors have idiosyncrasies; I am no different. For starters, although you’ll often find
links to various resources, I do not include links to entries in Sun’s Bug Database. Rather
than present individual links, I present bug identifiers and their names (Bug 6362451
“The string returned by toString() shows the bridge methods as having the volatile modi-
ficator,” for example). If you want to find information about a bug, point your browser to
http://bugs.sun.com/bugdatabase/index.jsp, enter the bug identifier in the appropriate
field, and perform a search. In addition to the appropriate database entry appearing at
the start of the search results, other results point you to related items that can enhance
your understanding of a particular bug topic.
Other idiosyncrasies that you’ll discover include my placing a // filename.java com-
ment at the start of a source file (I forget the reason why I started to do this; old habits die
hard), placing space characters between method names and their argument/parameter
lists in source listings, importing everything from a package (import java.awt.*;, for
example), limiting my comments in source listings, bolding certain parts of source list-
ings to emphasize them, and adding the package name (unless the package is java.lang)
to the first mention of a class or an interface in the text.

xix
Other documents randomly have
different content
millions,) is a fearful tax to fall at hap-hazard on their heads. The
debt which purchased our independence was but of eighty millions,
of which twenty years of taxation had in 1809 paid but the one half.
And what have we purchased with this tax of two hundred millions
which we are to pay by wholesale but usury, swindling, and new
forms of demoralization. Revolutionary history has warned us of the
probable moment when this baseless trash is to receive its fiat.
Whenever so much of the precious metals shall have returned into
the circulation as that every one can get some in exchange for his
produce, paper, as in the revolutionary war, will experience at once
an universal rejection. When public opinion changes, it is with the
rapidity of thought. Confidence is already on the totter, and every
one now handles this paper as if playing at Robin's alive. That in the
present state of the circulation the banks should resume payments
in specie, would require their vaults to be like the widow's cruise.
The thing to be aimed at is, that the excesses of their emissions
should be withdrawn as gradually, but as speedily, too, as is
practicable, without so much alarm as to bring on the crisis dreaded.
Some banks are said to be calling in their paper. But ought we to let
this depend on their discretion? Is it not the duty of the legislature
to endeavor to avert from their constituents such a catastrophe as
the extinguishment of two hundred millions of paper in their hands?
The difficulty is indeed great; and the greater, because the patient
revolts against all medicine. I am far from presuming to say that any
plan can be relied on with certainty, because the bubble may burst
from one moment to another; but if it fails, we shall be but where
we should have been without any effort to save ourselves. Different
persons, doubtless, will devise different schemes of relief. One would
be to suppress instantly the currency of all paper not issued under
the authority of our own State or of the General Government; to
interdict after a few months the circulation of all bills of five dollars
and under; after a few months more, all of ten dollars and under;
after other terms, those of twenty, fifty, and so on to one hundred
dollars, which last, if any must be left in circulation, should be the
lowest denomination. These might be a convenience in mercantile
transactions and transmissions, and would be excluded by their size
from ordinary circulation. But the disease may be too pressing to
await such a remedy. With the legislature I cheerfully leave it to
apply this medicine, or no medicine at all. I am sure their intentions
are faithful; and embarked in the same bottom, I am willing to swim
or sink with my fellow citizens. If the latter is their choice, I will go
down with them without a murmur. But my exhortation would rather
be "not to give up the ship."
I am a great friend to the improvements of roads, canals, and
schools. But I wish I could see some provision for the former as solid
as that of the latter,—something better than fog. The literary fund is
a solid provision, unless lost in the impending bankruptcy. If the
legislature would add to that a perpetual tax of a cent a head on the
population of the State, it would set agoing at once, and forever
maintain, a system of primary or ward schools, and an university
where might be taught, in its highest degree, every branch of
science useful in our time and country; and it would rescue us from
the tax of toryism, fanaticism, and indifferentism to their own State,
which we now send our youth to bring from those of New England.
If a nation expects to be ignorant and free, in a state of civilization,
it expects what never was and never will be. The functionaries of
every government have propensities to command at will the liberty
and property of their constituents. There is no safe deposit for these
but with the people themselves; nor can they be safe with them
without information. Where the press is free, and every man able to
read, all is safe. The frankness of this communication will, I am sure,
suggest to you a discreet use of it. I wish to avoid all collisions of
opinion with all mankind. Show it to Mr. Maury, with expressions of
my great esteem. It pretends to convey no more than the opinions
of one of your thousand constituents, and to claim no more
attention than every other of that thousand.
I will ask you once more to take care of Miller and our College, and
to accept assurances of my esteem and respect.
TO CHARLES THOMPSON.

Monticello, January 9, 1816.

My Dear and Ancient Friend,—An acquaintance of fifty-two years, for I


think ours dates from 1764, calls for an interchange of notice now
and then, that we remain in existence, the monuments of another
age, and examples of a friendship unaffected by the jarring elements
by which we have been surrounded, of revolutions of government,
of party and of opinion. I am reminded of this duty by the receipt,
through our friend Dr. Patterson, of your synopsis of the four
Evangelists. I had procured it as soon as I saw it advertised, and had
become familiar with its use; but this copy is the more valued as it
comes from your hand. This work bears the stamp of that accuracy
which marks everything from you, and will be useful to those who,
not taking things on trust, recur for themselves to the fountain of
pure morals. I, too, have made a wee-little book from the same
materials, which I call the Philosophy of Jesus; it is a paradigma of
his doctrines, made by cutting the texts out of the book, and
arranging them on the pages of a blank book, in a certain order of
time or subject. A more beautiful or precious morsel of ethics I have
never seen; it is a document in proof that I am a real Christian, that
is to say, a disciple of the doctrines of Jesus, very different from the
Platonists, who call me infidel and themselves Christians and
preachers of the gospel, while they draw all their characteristic
dogmas from what its author never said nor saw. They have
compounded from the heathen mysteries a system beyond the
comprehension of man, of which the great reformer of the vicious
ethics and deism of the Jews, were he to return on earth, would not
recognize one feature. If I had time I would add to my little book the
Greek, Latin and French texts, in columns side by side. And I wish I
could subjoin a translation of Gosindi's Syntagma of the doctrines of
Epicurus, which, notwithstanding the calumnies of the Stoics and
caricatures of Cicero, is the most rational system remaining of the
philosophy of the ancients, as frugal of vicious indulgence, and
fruitful of virtue as the hyperbolical extravagances of his rival sects.
I retain good health, am rather feeble to walk much, but ride with
ease, passing two or three hours a day on horseback, and every
three or four months taking in a carriage a journey of ninety miles to
a distant possession, where I pass a good deal of my time. My eyes
need the aid of glasses by night, and with small print in the day
also; my hearing is not quite so sensible as it used to be; no tooth
shaking yet, but shivering and shrinking in body from the cold we
now experience, my thermometer having been as low as 12° this
morning. My greatest oppression is a correspondence afflictingly
laborious, the extent of which I have been long endeavoring to
curtail. This keeps me at the drudgery of the writing-table all the
prime hours of the day, leaving for the gratification of my appetite
for reading, only what I can steal from the hours of sleep. Could I
reduce this epistolary corvée within the limits of my friends and
affairs, and give the time redeemed from it to reading and reflection,
to history, ethics, mathematics, my life would be as happy as the
infirmities of age would admit, and I should look on its
consummation with the composure of one "qui summum nec me tuit
diem nec optat."
So much as to myself, and I have given you this string of egotisms in
the hope of drawing a similar one from yourself. I have heard from
others that you retain your health, a good degree of activity, and all
the vivacity and cheerfulness of your mind, but I wish to learn it
more minutely from yourself. How has time affected your health and
spirits? What are your amusements, literary and social? Tell me
everything about yourself, because all will be interesting to me who
retains for you ever the same constant and affectionate friendship
and respect.

TO BENJAMIN AUSTIN, ESQ.

Monticello, January 9, 1816.


Dear Sir,—Your favor of December 21st has been received, and I am
first to thank you for the pamphlet it covered. The same description
of persons which is the subject of that is so much multiplied here
too, as to be almost a grievance, and by their numbers in the public
councils, have wrested from the public hand the direction of the
pruning knife. But with us as a body, they are republican, and mostly
moderate in their views; so far, therefore, less objects of jealousy
than with you. Your opinions on the events which have taken place
in France, are entirely just, so far as these events are yet developed.
But they have not reached their ultimate termination. There is still
an awful void between the present and what is to be the last chapter
of that history; and I fear it is to be filled with abominations as
frightful as those which have already disgraced it. That nation is too
high-minded, has too much innate force, intelligence and elasticity,
to remain under its present compression. Samson will arise in his
strength, as of old, and as of old will burst asunder the withes and
the cords, and the webs of the Philistines. But what are to be the
scenes of havoc and horror, and how widely they may spread
between brethren of the same house, our ignorance of the interior
feuds and antipathies of the country places beyond our ken. It will
end, nevertheless, in a representative government, in a government
in which the will of the people will be an effective ingredient. This
important element has taken root in the European mind, and will
have its growth; their despots, sensible of this, are already offering
this modification of their governments, as if of their own accord.
Instead of the parricide treason of Bonaparte, in perverting the
means confided to him as a republican magistrate, to the subversion
of that republic and erection of a military despotism for himself and
his family, had he used it honestly for the establishment and support
of a free government in his own country, France would now have
been in freedom and rest; and her example operating in a contrary
direction, every nation in Europe would have had a government over
which the will of the people would have had some control. His
atrocious egotism has checked the salutary progress of principle,
and deluged it with rivers of blood which are not yet run out. To the
vast sum of devastation and of human misery, of which he has been
the guilty cause, much is still to be added. But the object is fixed in
the eye of nations, and they will press on to its accomplishment and
to the general amelioration of the condition of man. What a germ
have we planted, and how faithfully should we cherish the parent
tree at home!
You tell me I am quoted by those who wish to continue our
dependence on England for manufactures. There was a time when I
might have been so quoted with more candor, but within the thirty
years which have since elapsed, how are circumstances changed!
We were then in peace. Our independent place among nations was
acknowledged. A commerce which offered the raw material in
exchange for the same material after receiving the last touch of
industry, was worthy of welcome to all nations. It was expected that
those especially to whom manufacturing industry was important,
would cherish the friendship of such customers by every favor, by
every inducement, and particularly cultivate their peace by every act
of justice and friendship. Under this prospect the question seemed
legitimate, whether, with such an immensity of unimproved land,
courting the hand of husbandry, the industry of agriculture, or that
of manufactures, would add most to the national wealth? And the
doubt was entertained on this consideration chiefly, that to the labor
of the husbandman a vast addition is made by the spontaneous
energies of the earth on which it is employed: for one grain of wheat
committed to the earth, she renders twenty, thirty, and even fifty
fold, whereas to the labor of the manufacturer nothing is added.
Pounds of flax, in his hands, yield, on the contrary, but pennyweights
of lace. This exchange, too, laborious as it might seem, what a field
did it promise for the occupations of the ocean; what a nursery for
that class of citizens who were to exercise and maintain our equal
rights on that element? This was the state of things in 1785, when
the "Notes on Virginia" were first printed; when, the ocean being
open to all nations, and their common right in it acknowledged and
exercised under regulations sanctioned by the assent and usage of
all, it was thought that the doubt might claim some consideration.
But who in 1785 could foresee the rapid depravity which was to
render the close of that century the disgrace of the history of man?
Who could have imagined that the two most distinguished in the
rank of nations, for science and civilization, would have suddenly
descended from that honorable eminence, and setting at defiance all
those moral laws established by the Author of nature between nation
and nation, as between man and man, would cover earth and sea
with robberies and piracies, merely because strong enough to do it
with temporal impunity; and that under this disbandment of nations
from social order, we should have been despoiled of a thousand
ships, and have thousands of our citizens reduced to Algerine
slavery. Yet all this has taken place. One of these nations interdicted
to our vessels all harbors of the globe without having first proceeded
to some one of hers, there paid a tribute proportioned to the cargo,
and obtained her license to proceed to the port of destination. The
other declared them to be lawful prize if they had touched at the
port, or been visited by a ship of the enemy nation. Thus were we
completely excluded from the ocean. Compare this state of things
with that of '85, and say whether an opinion founded in the
circumstances of that day can be fairly applied to those of the
present. We have experienced what we did not then believe, that
there exists both profligacy and power enough to exclude us from
the field of interchange with other nations: that to be independent
for the comforts of life we must fabricate them ourselves. We must
now place the manufacturer by the side of the agriculturist. The
former question is suppressed, or rather assumes a new form. Shall
we make our own comforts, or go without them, at the will of a
foreign nation? He, therefore, who is now against domestic
manufacture, must be for reducing us either to dependence on that
foreign nation, or to be clothed in skins, and to live like wild beasts
in dens and caverns. I am not one of these; experience has taught
me that manufactures are now as necessary to our independence as
to our comfort; and if those who quote me as of a different opinion,
will keep pace with me in purchasing nothing foreign where an
equivalent of domestic fabric can be obtained, without regard to
difference of price, it will not be our fault if we do not soon have a
supply at home equal to our demand, and wrest that weapon of
distress from the hand which has wielded it. If it shall be proposed
to go beyond our own supply, the question of '85 will then recur, will
our surplus labor be then most beneficially employed in the culture
of the earth, or in the fabrications of art? We have time yet for
consideration, before that question will press upon us; and the
maxim to be applied will depend on the circumstances which shall
then exist; for in so complicated a science as political economy, no
one axiom can be laid down as wise and expedient for all times and
circumstances, and for their contraries. Inattention to this is what
has called for this explanation, which reflection would have rendered
unnecessary with the candid, while nothing will do it with those who
use the former opinion only as a stalking horse, to cover their
disloyal propensities to keep us in eternal vassalage to a foreign and
unfriendly people.
I salute you with assurances of great respect and esteem.

TO JOHN ADAMS.

Monticello, January 11, 1816.

Dear Sir,—Of the last five months I have passed four at my other
domicil, for such it is in a considerable degree. No letters are
forwarded to me there, because the cross post to that place is
circuitous and uncertain; during my absence, therefore, they are
accumulating here, and awaiting acknowledgments. This has been
the fate of your favor of November 13th.
I agree with you in all its eulogies on the eighteenth century. It
certainly witnessed the sciences and arts, manners and morals,
advanced to a higher degree than the world had ever before seen.
And might we not go back to the æra of the Borgias, by which time
the barbarous ages had reduced national morality to its lowest point
of depravity, and observe that the arts and sciences, rising from that
point, advanced gradually through all the sixteenth, seventeenth and
eighteenth centuries, softening and correcting the manners and
morals of man? I think, too, we may add to the great honor of
science and the arts, that their natural effect is, by illuminating
public opinion, to erect it into a censor, before which the most
exalted tremble for their future, as well as present fame. With some
exceptions only, through the seventeenth and eighteenth centuries,
morality occupied an honorable chapter in the political code of
nations. You must have observed while in Europe, as I thought I did,
that those who administered the governments of the greater powers
at least, had a respect to faith, and considered the dignity of their
government as involved in its integrity. A wound indeed was inflicted
on this character of honor in the eighteenth century by the partition
of Poland. But this was the atrocity of a barbarous government
chiefly, in conjunction with a smaller one still scrambling to become
great, while one only of those already great, and having character to
lose, descended to the baseness of an accomplice in the crime.
France, England, Spain, shared in it only inasmuch as they stood
aloof and permitted its perpetration.
How then has it happened that these nations, France especially and
England, so great, so dignified, so distinguished by science and the
arts, plunged all at once into all the depths of human enormity,
threw off suddenly and openly all the restraints of morality, all
sensation to character, and unblushingly avowed and acted on the
principle that power was right? Can this sudden apostasy from
national rectitude be accounted for? The treaty of Pilnitz seems to
have begun it, suggested perhaps by the baneful precedent of
Poland. Was it from the terror of monarchs, alarmed at the light
returning on them from the west, and kindling a volcano under their
thrones? Was it a combination to extinguish that light, and to bring
back, as their best auxiliaries, those enumerated by you, the
Sorbonne, the Inquisition, the Index Expurgatorius, and the knights
of Loyola? Whatever it was, the close of the century saw the moral
world thrown back again to the age of the Borgias, to the point from
which it had departed three hundred years before. France, after
crushing and punishing the conspiracy of Pilnitz, went herself deeper
and deeper into the crimes she had been chastising. I say France
and not Bonaparte; for, although he was the head and mouth, the
nation furnished the hands which executed his enormities. England,
although in opposition, kept full pace with France, not indeed by the
manly force of her own arms, but by oppressing the weak and
bribing the strong. At length the whole choir joined and divided the
weaker nations among them. Your prophecies to Dr. Price proved
truer than mine; and yet fell short of the fact, for instead of a
million, the destruction of eight or ten millions of human beings has
probably been the effect of these convulsions. I did not, in '89,
believe they would have lasted so long, nor have cost so much
blood. But although your prophecy has proved true so far, I hope it
does not preclude a better final result. That same light from our
west seems to have spread and illuminated the very engines
employed to extinguish it. It has given them a glimmering of their
rights and their power. The idea of representative government has
taken root and growth among them. Their masters feel it, and are
saving themselves by timely offers of this modification of their
powers. Belgium, Prussia, Poland, Lombardy, &c., are now offered a
representative organization; illusive probably at first, but it will grow
into power in the end. Opinion is power, and that opinion will come.
Even France will yet attain representative government. You observe
it makes the basis of every constitution which has been demanded
or offered,—of that demanded by their Senate; of that offered by
Bonaparte; and of that granted by Louis XVIII. The idea then is
rooted, and will be established, although rivers of blood may yet
flow between them and their object. The allied armies now couching
upon them are first to be destroyed, and destroyed they will surely
be. A nation united can never be conquered. We have seen what the
ignorant, bigoted and unarmed Spaniards could do against the
disciplined veterans of their invaders. What then may we not expect
from the power and character of the French nation? The oppressors
may cut off heads after heads, but like those of the Hydra they
multiply at every stroke. The recruits within a nation's own limits are
prompt and without number; while those of their invaders from a
distance are slow, limited, and must come to an end. I think, too, we
perceive that all these allies do not see the same interest in the
annihilation of the power of France. There are certainly some
symptoms of foresight in Alexander that France might produce a
salutary diversion of force were Austria and Prussia to become her
enemies. France, too, is the neutral ally of the Turk, as having no
interfering interests, and might be useful in neutralizing and perhaps
turning that power on Austria. That a re-acting jealousy, too, exists
with Austria and Prussia, I think their late strict alliance indicates;
and I should not wonder if Spain should discover a sympathy with
them. Italy is so divided as to be nothing. Here then we see new
coalitions in embryo, which, after France shall in turn have suffered
a just punishment for her crimes, will not only raise her from the
earth on which she is prostrate, but give her an opportunity to
establish a government of as much liberty as she can bear—enough
to ensure her happiness and prosperity. When insurrection begins,
be it where it will, all the partitioned countries will rush to arms, and
Europe again become an arena of gladiators. And what is the
definite object they will propose? A restoration certainly of the status
quo prius, of the state of possession of '89. I see no other principle
on which Europe can ever again settle down in lasting peace. I hope
your prophecies will go thus far, as my wishes do, and that they, like
the former, will prove to have been the sober dictates of a superior
understanding, and a sound calculation of effects from causes well
understood. Some future Morgan will then have an opportunity of
doing you justice, and of counterbalancing the breach of confidence
of which you so justly complain, and in which no one has had more
frequent occasion of fellow-feeling than myself. Permit me to place
here my affectionate respects to Mrs. Adams, and to add for yourself
the assurances of cordial friendship and esteem.

TO DABNEY CARR.

Monticello, January 19, 1816.


Dear Sir,—At the date of your letter of December the 1st, I was in
Bedford, and since my return, so many letters, accumulated during
my absence, have been pressing for answers, that this is the first
moment I have been able to attend to the subject of yours. While
Mr. Girardin was in this neighborhood writing his continuation of
Burke's history, I had suggested to him a proper notice of the
establishment of the committee of correspondence here in 1773, and
of Mr. Carr, your father, who introduced it. He has doubtless done
this, and his work is now in the press. My books, journals of the
times, &c., being all gone, I have nothing now but an impaired
memory to resort to for the more particular statement you wish. But
I give it with the more confidence, as I find that I remember old
things better than new. The transaction took place in the session of
Assembly of March 1773. Patrick Henry, Richard Henry Lee, Frank
Lee, your father and myself, met by agreement, one evening, about
the close of the session, at the Raleigh Tavern, to consult on the
measures which the circumstances of the times seemed to call for.
We agreed, in result, that concert in the operations of the several
colonies was indispensable; and that to produce this, some channel
of correspondence between them must be opened; that therefore,
we would propose to our House the appointment of a committee of
correspondence, which should be authorized and instructed to write
to the Speakers of the House of Representatives of the several
Colonies, recommending the appointment of similar committees on
their part, who, by a communication of sentiment on the
transactions threatening us all, might promote a harmony of action
salutary to all. This was the substance, not pretending to remember
the words. We proposed the resolution, and your father was agreed
on to make the motion. He did it the next day, March the 12th, with
great ability, reconciling all to it, not only by the reasonings, but by
the temper and moderation with which it was developed. It was
adopted by a very general vote. Peyton Randolph, some of us who
proposed it, and who else I do not remember, were appointed of the
committee. We immediately despatched letters by expresses to the
Speakers of all the other Assemblies. I remember that Mr. Carr and
myself, returning home together, and conversing on the subject by
the way, concurred in the conclusion that that measure must
inevitably beget the meeting of a Congress of Deputies from all the
colonies, for the purpose of uniting all in the same principles and
measures for the maintenance of our rights. My memory cannot
deceive me, when I affirm that we did it in consequence of no such
proposition from any other colony. No doubt the resolution itself and
the journals of the day will show that ours was original, and not
merely responsive to one from any other quarter. Yet, I am certain I
remember also, that a similar proposition, and nearly cotemporary,
was made by Massachusetts, and that our northern messenger
passed theirs on the road. This, too, may be settled by recurrence to
the records of Massachusetts. The proposition was generally
acceded to by the other colonies, and the first effect, as expected,
was the meeting of a Congress at New York the ensuing year. The
committee of correspondence appointed by Massachusetts, as
quoted by you from Marshall, under the date of 1770, must have
been for a special purpose, and functus officio before the date of
1773, or Massachusetts herself would not then have proposed
another. Records should be examined to settle this accurately. I well
remember the pleasure expressed in the countenance and
conversation of the members generally, on this debut of Mr. Carr,
and the hopes they conceived as well from the talents as the
patriotism it manifested. But he died within two months after, and in
him we lost a powerful fellow-laborer. His character was of a high
order. A spotless integrity, sound judgment, handsome imagination,
enriched by education and reading, quick and clear in his
conceptions, of correct and ready elocution, impressing every hearer
with the sincerity of the heart from which it flowed. His firmness was
inflexible in whatever he thought was right; but when no moral
principle stood in the way, never had man more of the milk of
human kindness, of indulgence, of softness, of pleasantry of
conversation and conduct. The number of his friends, and the
warmth of their affection, were proofs of his worth, and of their
estimate of it. To give to those now living, an idea of the affliction
produced by his death in the minds of all who knew him, I liken it to
that lately felt by themselves on the death of his eldest son, Peter
Carr, so like him in all his endowments and moral qualities, and
whose recollection can never recur without a deep-drawn sigh from
the bosom of any one who knew him. You mention that I showed
you an inscription I had proposed for the tomb stone of your father.
Did I leave it in your hands to be copied? I ask the question, not
that I have any such recollection, but that I find it no longer in the
place of its deposit, and think I never took it out but on that
occasion. Ever and affectionately yours.

TO DR. PETER WILSON, PROFESSOR OF LANGUAGES,


COLUMBIA COLLEGE, NEW YORK.

Monticello, January 20, 1816.

Sir,—Of the last five months, I have been absent four from home,
which must apologize for so very late an acknowledgment of your
favor of November 22d, and I wish the delay could be compensated
by the matter of the answer. But an unfortunate accident puts that
out of my power. During the course of my public life, and from a
very early period of it, I omitted no opportunity of procuring
vocabularies of the Indian languages, and for that purpose formed a
model expressing such objects in nature as must be familiar to every
people, savage or civilized. This being made the standard to which
all were brought, would exhibit readily whatever affinities of
language there be between the several tribes. It was my intention,
on retiring from public business, to have digested these into some
order, so as to show not only what relations of language existed
among our own aborigines, but by a collation with the great Russian
vocabulary of the languages of Europe and Asia, whether there were
any between them and the other nations of the continent. On my
removal from Washington, the package in which this collection was
coming by water, was stolen and destroyed. It consisted of between
thirty and forty vocabularies, of which I can, from memory, say
nothing particular; but that I am certain more than half of them
differed as radically, each from every other, as the Greek, the Latin,
and Islandic. And even of those which seemed to be derived from
the same radix, the departure was such that the tribes speaking
them could not probably understand one another. Single words, or
two or three together, might perhaps be understood, but not a
whole sentence of any extent or construction. I think, therefore, the
pious missionaries who shall go to the several tribes to instruct them
in the Christian religion, will have to learn a language for every tribe
they go to; nay, more, that they will have to create a new language
for every one, that is to say, to add to theirs new words for the new
ideas they will have to communicate. Law, medicine, chemistry,
mathematics, every science has a language of its own, and divinity
not less than others. Their barren vocabularies cannot be vehicles
for ideas of the fall of man, his redemption, the triune composition
of the Godhead, and other mystical doctrines considered by most
Christians of the present date as essential elements of faith. The
enterprise is therefore arduous, but the more inviting perhaps to
missionary zeal, in proportion as the merit of surmounting it will be
greater. Again repeating my regrets that I am able to give so little
satisfaction on the subject of your inquiry, I pray you to accept the
assurance of my great consideration and esteem.

TO MR. AMOS J. COOK, PRECEPTOR OF FRYEBURG ACADEMY


IN THE DISTRICT OF MAINE.

Monticello, January 21, 1816.

Sir,—Your favor of December 18th was exactly a month on its way to


this place; and I have to thank you for the elegant and philosophical
lines communicated by the Nestor of our Revolution. Whether the
style or sentiment be considered, they were well worthy the trouble
of being copied and communicated by his pen. Nor am I less
thankful for the happy translation of them. It adds another to the
rare instances of a rival to its original: superior indeed in one
respect, as the same outline of sentiment is brought within a
compass of better proportion. For if the original be liable to any
criticism, it is that of giving too great extension to the same general
idea. Yet it has a great authority to support it, that of a wiser man
than all of us. "I sought in my heart to give myself unto wine; I
made me great works; I builded me houses; I planted me vineyards;
I made me gardens, and orchards, and pools to water them; I got
me servants and maidens, and great possessions of cattle; I
gathered me also silver and gold, and men singers and women
singers, and the delights of the sons of men, and musical
instruments of all sorts; and whatsoever mine eyes desired I kept
not from them; I withheld not my heart from any joy. Then I looked
on all the works that my hands had wrought, and behold! all was
vanity and vexation of spirit! I saw that wisdom excelleth folly, as far
as light excelleth darkness." The Preacher, whom I abridge, has
indulged in a much larger amplification of his subject. I am not so
happy as my friend and ancient colleague, Mr. Adams, in possessing
anything original, inedited, and worthy of comparison with the
epigraph of the Spanish monk. I can offer but humble prose, from
the hand indeed of the father of eloquence and philosophy; a moral
morsel, which our young friends under your tuition should keep ever
in their eye, as the ultimate term of your instructions, and of their
labors. "Hic, quisquis est, qui moderatione et constantia quietus
animo est, sibique ipse placatus; ut nec tabescat molestiis, nec
frangatur timore, nec sitienter quid expectens ardeat desiderio, nec
alacritate futili gestiens deliquescat; is est sapiens, quem quaerimus;
is est beatus; cui nihil humanarum rerum aut intolerabile ad
dimittendum animum, aut nimis lactabile ad efferendum, videri
potest." Or if a poetical dress will be more acceptable to the fancy of
the juvenile student:
"Quisnam igitur liber? Sapiens, sibique imperiosus:
Quem neque pauperies, neque mors, neque vincula terrent:
Responsare cupidinibus, contemnere honores
Fortis, et in scipso totus teres, atque rotundus;
Externi ne quid valeat per laeve morari:
In quem manea ruit semper Fortuna."

And if the Wise be the happy man, as these sages say, he must be
virtuous too; for, without virtue, happiness cannot be. This then is
the true scope of all academical emulation.
You request something in the handwriting of General Washington. I
enclose you a letter which I received from him while in Paris,
covering a copy of the new Constitution; it is offered merely as what
you ask, a specimen of his handwriting.
On the subject of your Museum, I fear I cannot flatter myself with
being useful to it. Were the obstacle of distance out of the way, age
and retirement have withdrawn me from the opportunities of
procuring objects in that line. With every wish for the prosperity of
your institution, accept the assurances of my great esteem and
respect.

TO MR. THOMAS RITCHIE.

Monticello, January 21, 1816.

Dear Sir,—In answering the letter of a northern correspondent lately,


I indulged in a tirade against a pamphlet recently published in this
quarter. On revising my letter, however, I thought it unsafe to
commit myself so far to a stranger. I struck out the passage
therefore, yet I think the pamphlet of such a character as not to be
unknown, or unnoticed by the people of the United States. It is the
most bold and impudent stride New England has ever made in
arrogating an ascendency over the rest of the Union. The first form
of the pamphlet was an address from the Reverend Lyman Beecher,
chairman of the Connecticut Society for the education of pious
young men for the ministry. Its matter was then adopted and
published in a sermon by Reverend Mr. Pearson of Andover in
Massachusetts, where they have a theological college; and where
the address "with circumstantial variations to adopt it to more
general use" is reprinted on a sheet and a half of paper, in so cheap
a form as to be distributed, I imagine, gratis, for it has a final note
indicating six thousand copies of the first edition printed. So far as it
respects Virginia, the extract of my letter gives the outline. I
therefore send it to you to publish or burn, abridge or alter, as you
think best. You understand the public palate better than I do. Only
give it such a title as may lead to no suspicion from whom you
receive it. I am the more induced to offer it to you because it is
possible mine may be the only copy in the State, and because, too,
it may be à propos for the petition for the establishment of a
theological society now before the legislature, and to which they
have shown the unusual respect of hearing an advocate for it at
their bar. From what quarter this theological society comes forward I
know not; perhaps from our own tramontaine clergy, of New
England religion and politics; perhaps it is the entering wedge from
its theological sister in Andover, for the body of "qualified religious
instructors" proposed by their pious brethren of the East "to
evangelize and catechize," to edify our daughters by weekly lectures,
and our wives by "family visits" from these pious young monks from
Harvard and Yale. However, do with this what you please, and be
assured of my friendship and respect.

TO NATHANIEL MACON.

Monticello, January 22, 1816.


Dear Sir,—Your favor of the 7th, after being a fortnight on the road,
reached this the last night. On the subject of the statue of General
Washington, which the legislature of North Carolina has ordered to
be procured, and set up in their capitol, I shall willingly give you my
best information and opinions.
1. Your first inquiry is whether one worthy the character it is to
represent, and the State which erects it, can be made in the United
States? Certainly it cannot. I do not know that there is a single
marble statuary in the United States, but I am sure there cannot be
one who would offer himself as qualified to undertake this
monument of gratitude and taste. Besides, no quarry of statuary
marble has yet, I believe, been opened in the United States, that is
to say, of a marble pure white, and in blocks of sufficient size,
without vein or flaw. The quarry of Carara, in Italy, is the only one in
the accessible parts of Europe which furnishes such blocks. It was
from thence we brought to Paris that for the statue of General
Washington, made there on account of this State; and it is from
there that all the southern and maritime parts of Europe are supplied
with that character of marble.
2. Who should make it? There can be but one answer to this. Old
Canova, of Rome. No artist in Europe would place himself in a line
with him; and for thirty years, within my own knowledge, he has
been considered by all Europe as without a rival. He draws his blocks
from Carara, and delivers the statue complete, and packed for
transportation, at Rome; from thence it descends the Tiber, but
whether it must go to Leghorn, or some other shipping port, I do
not know.
3. Price, time, size, and style? It will probably take a couple of years
to be ready. I am not able to be exact as to the price. We gave
Houdon, at Paris, one thousand guineas for the one he made for this
State; but he solemnly and feelingly protested against the
inadequacy of the price, and evidently undertook it on motives of
reputation alone. He was the first artist in France, and being willing
to come over to take the model of the General, which we could not
have got Canova to have done, that circumstance decided on his
employment. We paid him additionally for coming over about five
hundred guineas; and when the statue was done, we paid the
expenses of one of his under workmen to come over and set it up,
which might, perhaps, be one hundred guineas more. I suppose,
therefore, it cost us, in the whole, eight thousand dollars. But this
was only of the size of life. Yours should be something larger. The
difference it makes in the impression can scarcely be conceived. As
to the style or costume, I am sure the artist, and every person of
taste in Europe, would be for the Roman, the effect of which is
undoubtedly of a different order. Our boots and regimentals have a
very puny effect. Works of this kind are about one-third cheaper at
Rome than Paris; but Canova's eminence will be a sensible
ingredient in price. I think that for such a statue, with a plain
pedestal, you would have a good bargain from Canova at seven or
eight thousand dollars, and should not be surprised were he to
require ten thousand dollars, to which you would have to add the
charges of bringing over and setting up. The one-half of the price
would probably have to be advanced, and the other half paid on
delivery.
4. From what model? Ciracchi made the bust of General Washington
in plaster. It was the finest which came from his hand, and my own
opinion of Ciracchi was, that he was second to no sculptor living
except Canova; and, if he had lived, would have rivalled him. His
style had been formed on the fine models of antiquity in Italy, and
he had caught their ineffable majesty of expression. On his return to
Rome, he made the bust of the General in marble, from that in
plaster; it was sent over here, was universally considered as the best
effigy of him ever executed, was bought by the Spanish Minister for
the king of Spain, and sent to Madrid. After the death of Ciracchi, Mr.
Appleton, our Consul at Leghorn, a man of worth and taste,
purchased of his widow the original plaster, with a view to profit by
copies of marble and plaster from it. He still has it at Leghorn; and it
is the only original from which the statue can be formed. But the
exterior of the figure will also be wanting, that is to say, the outward
lineaments of the body and members, to enable the artist to give to
them also their true forms and proportions. There are, I believe, in
Philadelphia, whole length paintings of General Washington, from
which, I presume, old Mr. Peale or his son would sketch on canvas
the mere outlines at no great charge. This sketch, with Ciracchi's
bust, will suffice.
5. Through whose agency? None so ready or so competent as Mr.
Appleton himself; he has had relations with Canova, is a judge of
price, convenient to engage the work, to attend to its progress, to
receive and forward it to North Carolina. Besides the accommodation
of the original bust to be asked from him, he will probably have to
go to Rome himself, to make the contract, and will incur a great deal
of trouble besides, from that time to the delivery in North Carolina;
and it should therefore be made a matter of interest with him to act
in it, as his time and trouble is his support. I imagine his agency
from beginning to end would not be worth less than from one to two
hundred guineas. I particularize all these things, that you may not
be surprised with after-claps of expense, not counted on
beforehand. Mr. Appleton has two nephews at Baltimore, both in the
mercantile line, and in correspondence with him. Should the
Governor adopt this channel of execution, he will have no other
trouble than that of sending to them his communications for Mr.
Appleton, and making the remittances agreed on as shall be
convenient to himself. A letter from the Secretary of State to Mr.
Appleton, informing him that any service he can render the State of
North Carolina in this business, would be gratifying to his
government, would not be without effect.
Accept the assurance of my great esteem and respect.

TO JOSEPH C. CABELL.

Monticello, January 24, 1816.


Dear Sir,—Your favor of the 16th experienced great delay on the
road, and to avoid that of another mail, I must answer very briefly.
My letter to Peter Carr contains all I ever wrote on the subject of the
College, a plan for the institution being the only thing the trustees
asked or expected from me. Were it to go into execution, I should
certainly interest myself further and strongly in procuring proper
professors.
The establishment of a Proctor is taken from the practice of Europe,
where an equivalent officer is made a part, and is a very essential
one, of every such institution; and as the nature of his functions
requires that he should always be a man of discretion,
understanding, and integrity above the common level, it was thought
that he would never be less worthy of being trusted with the powers
of a justice, within the limits of institution here, than the neighboring
justices generally are; and the vesting him with the conservation of
the peace within that limit, was intended, while it should equally
secure its object, to shield the young and unguarded student from
the disgrace of the common prison, except where the case was an
aggravated one. A confinement to his own room was meant as an
act of tenderness to him, his parents and friends; in fine, it was to
give them a complete police of their own, tempered by the paternal
attentions of their tutors. And, certainly, in no country is such a
provision more called for than in this, as has been proved from times
of old, from the regular annual riots and battles between the
students of William and Mary with the town boys, before the
revolution, quorum pars fui, and the many and more serious affrays
of later times. Observe, too, that our bill proposes no exclusion of
the ordinary magistrate, if the one attached to the institution is
thought to execute his power either partially or remissly.
The transfer of the power to give commencement to the Ward or
Elementary Schools from the court and aldermen to the visitors, was
proposed because the experience of twenty years has proved that
no court will ever begin it. The reason is obvious. The members of
the courts are the wealthy members of the counties; and as the
expenses of the schools are to be defrayed by a contribution
proportioned to the aggregate of other taxes which every one pays,
they consider it as a plan to educate the poor at the expense of the
rich. It proceeded, too, from a hope that the example and good
effects being exhibited in one county, they would spread from county
to county and become general. The modification of the law, by
authorizing the alderman to require the expense of tutorage from
such parents as are able, would render trifling, if not wholly prevent,
any call on the county for pecuniary aid. You know that nothing
better than a log-house is required for these schools, and there is
not a neighborhood which would not meet and build this themselves
for the sake of having a school near them.
I know of no peculiar advantage which Charlottesville offers for Mr.
Braidwood's school of deaf and dumb. On the contrary, I should
think the vicinity of the seat of government most favorable to it. I
should not like to have it made a member of our College. The
objects of the two institutions are fundamentally distinct. The one is
science, the other mere charity. It would be gratuitously taking a
boat in tow which may impede, but cannot aid the motion of the
principal institution.
Ever and affectionately yours.

TO REV. MR. WORCESTER.

Monticello, January 29, 1816.

Sir,—Your letter bearing date October 18th, 1815, came only to


hand the day before yesterday, which is mentioned to explain the
date of mine. I have to thank you for the pamphlets accompanying
it, to wit, the Solemn Review, the Friend of Peace or Special
Interview, and the Friend of Peace, No. 2; the first of these I had
received through another channel some months ago. I have not read
the two last steadily through, because where one assents to
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebookultra.com

You might also like