FreeBSD用のJDK-1.3.1をインストールしよう!

ようやく、FreeBSD用のJDK-1.3.1のバイナリパッケージがリリースされました。FreeBSD-4.9Rからは、なんの苦労もなく、Javaを使うことができるようになるかも知れません。今までSunやIBMのlinux版をエミュレーション機能で使っていた人も、FreeBSD nativeのJDKを使うことができます。

  1. まずはダウンロード!

    以下のサイトからdiablo-jdk-1.3.1.0.tgzをダウンロードします。
    http://www.freebsdfoundation.org/downloads/java.shtml

  2. 次に下調べ!

    とりあえず、パッケージの内容をpkg_infoコマンドを使って調べてみます。

    % pkg_info -r diablo-jdk-1.3.1.0.tgz
    Information for diablo-jdk-1.3.1.0.tgz:
    
    Depends on:
    Dependency: libiconv-1.9.1_1
    Dependency: javavmwrapper-1.4
    Dependency: gettext-0.11.5_1
    Dependency: XFree86-libraries-4.3.0_5
    

    いくつか必要なものがあるようです。私の場合は、javavmwrapper-1.4がインストールされていなかったので、前もってportからインストールします。

    # cd /usr/ports/java/javavmwrapper/
    # make install
    ===>  Extracting for javavmwrapper-1.4
    >> No MD5 checksum file.
    ===>  Patching for javavmwrapper-1.4
    ===>  Configuring for javavmwrapper-1.4
    /usr/bin/sed 's|%%PREFIX%%|/usr/local|'  < /usr/ports/java/javavmwrapper/src/javavmwrapper.sh > /usr/ports/java/javavmwrapper/work/javavmwrapper.sh
    ===>  Installing for javavmwrapper-1.4
    install -c -o root -g wheel -m 555 /usr/ports/java/javavmwrapper/work/javavmwrapper.sh /usr/local/bin/javavm
    /bin/ln -sf /usr/local/bin/javavm /usr/local/bin/registervm
    /bin/ln -sf /usr/local/bin/javavm /usr/local/bin/unregistervm
    ===>   Generating temporary packing list
    ===>   Registering installation for javavmwrapper-1.4
    

    これで準備は終了です。

  3. いよいよインストール!

    いよいよ、実際にインストールしてみます。

    # pkg_add diablo-jdk-1.3.1.0.tgz 
    

    しばらくすると、ライセンス条項が表示されます。長い!

    FREEBSD FOUNDATION
    
    Diablo Caffe Version 1.3.1-0 ("Software") 
    
    END USER LICENSE AGREEMENT
    
    You may install this Software only if you are currently a licensee
    of FreeBSD (including substantially similar versions of FreeBSD)
    for your own internal use only with your copy(ies) of FreeBSD
    (including substantially similar versions of FreeBSD).  If you are
    an OEM - a person who will bundle the Software with other software
    before distributing the bundled product to end users - you must
    read and "accept" the provisions of the OEM License Agreement.  You
    must read the License Agreement and enter "YES" below to continue
    your install.  By doing so, you agree to be bound by all of the
    terms of this License Agreement.
    
    IMPORTANT - READ CAREFULLY: This End User License Agreement
    ("Agreement") is a legal agreement between you (in your capacity
    as an individual and as an agent for your company, institution, or
    other entity) and the FreeBSD Foundation ("Foundation").  accessing,
    downloading, installing, using or copying of the Software (as
    hereafter defined) by you or a third party on your behalf indicates
    your agreement to be bound by the terms and conditions of this
    Agreement.  If you do not agree to these terms and conditions, do
    not access, download, install, use or copy the Software.  In the
    absence of this Agreement, you have no rights in the Software.
    
    1.      LICENSE GRANT.  
    
            (a)     Subject to all third party intellectual property
            claims and without warranty of any nature, Foundation hereby
            grants to you, and you hereby accept, a non-exclusive license
            ("License") to:  (i) download, install and use the Software
            in binary executable form on one or more computers for use
            by a total number of end users not to exceed the number of
            your end users who are authorized to use FreeBSD; provided
            that you agree to implement reasonable controls to ensure
            that your use of the Software does not exceed such maximum
            number of end users; and (ii) download and/or use one or
            more copies of any related materials provided by Foundation
            ("Related Materials") in electronic format and/or one copies
            of the Related Materials in hard copy format subject to the
            following terms and conditions:
    
                    (i)     other than as set forth in paragraph 1(a)
                    above, you may not make or distribute copies of the
                    Software, or electronically transfer the Software
                    from one computer to another or over a network;
    
                    (ii)     you may not decompile, reverse engineer,
                    disassemble or otherwise reduce the Software to a
                    human-perceivable form;
    
                    (iii)   you may not rent, lease or sublease the
                    Software;
    
                    (iv)    you may not modify the Software or create
                    derivative works based upon the Software; and
    
                    (v)     in the event that you breach any of the
                    terms of this Agreement, Foundation may terminate
                    the License and you must destroy all copies of the
                    Software and Related Materials.
    
            (b)     you may make one copy of the Software in machine-readable
            form solely for back-up purposes; provided, however, that
            you must reproduce on such copy all copyright notices and
            proprietary legends on the original copy of the software.
    
            (c)     Subject to the terms and conditions of this Agreement,
            you may create a hyperlink between an Internet website owned
            and controlled by you and the Foundation's website, which
            hyperlink describes in a fair and accurate manner where the
            Software may be obtained, provided that you do not frame
            the Website or otherwise give the false impression that
            Foundation is somehow associated with, or otherwise endorses
            or sponsors your website.  Any goodwill associated with
            such hyperlink shall inure to the sole and exclusive benefit
            of Foundation.  Other than the creation of such hyperlink,
            nothing in this Agreement shall be construed as conferring
            upon you any right to make any reference to Foundation or
            to its trademarks, service marks or any other indicia of
            origin owned by Foundation, or to indicate in any way that
            your products or services are in any way sponsored, approved,
            endorsed by or affiliated with Foundation.
    
    2.      RIGHTS RESERVED.  
    
            (a)     This License does not grant you any right to
            enhancements or updates to, or support or maintenance for,
            the Software or any modifications made by Foundation;
    
            (b)     Foundation is free to license the Software on terms
            different from those contained herein;
    
            (c)     Foundation and its licensors hereby expressly reserve
            all rights in the Software which are not expressly granted
            to you under the License; and, without limiting the generality
            of the foregoing, Foundation and its licensors retain all
            title, copyright, and other intellectual property and
            proprietary rights in the Software and any copies thereof,
            and you do not acquire any rights, express or implied, other
            than those expressly set forth in this Agreement.
    
    3.      COPYRIGHT.  You hereby acknowledge and agree that the
    Software is protected by United States copyright law and international
    treaty provisions.  You must reproduce all copyright notices,
    trademark notices and other proprietary notices of Foundation and
    its licensors on any copies of the Software and Related Materials
    and you must not remove such notices;
    
    4.      MAINTENANCE AND SUPPORT.  Foundation is under no obligation
    whatsoever to provide maintenance or support for the Software or
    to notify you of bug fixes, patches, or upgrades to the features,
    functionality or performance of the Software ("Enhancements") (if
    any), whether developed by Foundation or others.  If, in its sole
    discretion, Foundation makes an Enhancement available to you and
    does not enter into a separate written license agreement with you
    relating to such Enhancement, then that Enhancement will be deemed
    incorporated into the Software and subject to this Agreement.
    
    5.      WARRANTY DISCLAIMER.  THE SOFTWARE IS PROVIDED TO YOU "AS
    IS" WITHOUT WARRANTY OF ANY TYPE OR NATURE, AND FOUNDATION AND ITS
    LICENSORS HEREBY EXPRESSLY DISCLAIM ANY WARRANTIES, EXPRESS OR
    IMPLIED, INCLUDING, BUT NOT LIMITED TO, ANY IMPLIED WARRANTIES OF
    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE OR
    NON-INFRINGEMENT OR ANY WARRANTIES ARISING BY USAGE OF TRADE, COURSE
    OF DEALING OR COURSE OF PERFORMANCE.  IN ADDITION, FOUNDATION AND
    ITS LICENSORS EXPRESSLY DISCLAIM ANY LIABILITY FOR THE ACCURACY,
    COMPLETENESS OR USEFULNESS OF THE SOFTWARE AND DO NOT WARRANT THAT
    THE SOFTWARE WILL FUNCTION UNINTERRUPTED, THAT IT IS ERROR-FREE OR
    THAT ANY ERRORS WILL BE CORRECTED.  YOU ASSUME TOTAL RESPONSIBILITY
    AND RISK FOR YOUR USE OF THE SOFTWARE, INCLUDING, BUT NOT LIMITED
    TO ANY DEFECTS OR INACCURACIES THEREIN.
    
    6.      LIMITATION OF LIABILITY.  IN NO EVENT SHALL FOUNDATION OR
    ITS LICENSORS BE LIABLE FOR ANY INDIRECT, INCIDENTAL, CONSEQUENTIAL,
    SPECIAL OR PUNITIVE DAMAGES OF ANY KIND OR NATURE, INCLUDING, BUT
    NOT LIMITED TO, LOSS OF PROFITS OR LOSS OF DATA, FOR ANY REASON
    WHATSOEVER, WHETHER SUCH LIABILITY IS ASSERTED ON THE BASIS OF
    CONTRACT, TORT (INCLUDING NEGLIGENCE OR STRICT LIABILITY), OR
    OTHERWISE, EVEN IF FOUNDATION HAS BEEN ADVISED OF THE POSSIBILITY
    OF SUCH LOSS OR DAMAGES.  IN NO EVENT SHALL FOUNDATION'S LIABILITY
    FOR DAMAGES ARISING FROM OR IN CONNECTION WITH THIS AGREEMENT EXCEED
    THE GREATER OF 00 OR THE AMOUNT PAID BY YOU FOR THE SOFTWARE.
    BECAUSE SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF
    LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES, THE ABOVE
    LIMITATIONS MAY NOT APPLY TO YOU.  IN THE EVENT THAT APPLICABLE LAW
    DOES NOT ALLOW THE COMPLETE EXCLUSION OR LIMITATION OF LIABILITY
    OF CLAIMS AND DAMAGES AS SET FORTH IN THIS AGREEMENT, FOUNDATION'S
    LIABILITY IS LIMITED TO THE GREATEST EXTENT PERMITTED BY LAW.
    
    7.      INDEMNIFICATION.  You shall defend, indemnify and hold
    harmless Foundation and its licensors and their respective directors,
    officers, agents, employees and volunteers from and against any and
    all claims, suits, losses, damages, costs, fees and expenses arising
    out of or in connection with this Agreement.  You shall pay all
    costs incurred by Foundation in enforcing this provision, including
    reasonable attorneys' fees and court costs.  You agree that under
    no circumstances will Foundation indemnify you or any other person.
    
    8.      TERM AND TERMINATION.  The License will continue perpetually
    unless terminated by Foundation in accordance with this Agreement.
    If you breach any term of this Agreement and failure to cure such
    breach within thirty (30) days after receipt of written notice
    specifying the breach, this Agreement shall automatically terminate.
    Upon the termination of this Agreement, you shall immediately cease
    using the Software and provide Foundation with written certification
    of your compliance with the foregoing.  The termination of this
    Agreement shall not relieve you of your obligations arising prior
    to such termination.  Notwithstanding any provision in this Agreement
    to the contrary, Sections 5 through 7 shall survive the termination
    of this Agreement.
    
    9.      EXPORT CONTROLS.  You shall observe all applicable United
    States and foreign laws and regulations (if any) with respect to
    the export, re-export, diversion or transfer of the Software, related
    technical data and direct products thereof, including, but not
    limited to the Export Administration Regulations.
    
    10.     THIRD PARTY SOFTWARE.  You acknowledge and agree that the
    Software includes Java2 Standard Edition (the "Technology") pursuant
    to Sun Community Source License 2.3 Copyright 1994-2003 Sun
    Microsystems, Inc.  All rights reserved.  You also agree to install
    and use the Software on a product which (i) has a principle purpose
    that is substantially different from that of the stand-alone
    Technology; (ii) represents a significant functional and value
    enhancement to the Technology; (iii) operates in conjunction with
    the Technology; and (iv) is not marketed as a technology which
    replaces or substitutes for the Technology.
    
    11.     GENERAL.  You shall not assert against Foundation or its
    licensors any claim for infringement or misappropriation of any
    intellectual property rights in any way relating to the Software.
    This Agreement shall be governed by, construed and enforced in
    accordance with the laws of the State of California, excluding its
    rules governing conflicts of laws.  In the event that any provision
    of this Agreement is deemed illegal or unenforceable, Foundation
    may, but is not obligated to, post on the Website a new version of
    this Agreement which, in Foundation's opinion, reasonably preserves
    the intent of this Agreement.  This Agreement is binding upon and
    shall inure to the benefit of Foundation and its successors and
    assigns.  This Agreement represents the entire understanding of the
    parties, and superceded all previous communications, written or
    oral, relating to the subject of this Agreement.
    
    
    Do you agree to the above license terms? [yes or no] 
    

    ここで、ライセンスに同意するかどうかを入力します。

    Do you agree to the above license terms? [yes or no] 
    yes
    

    すると、インストールが実行されます。私の場合、以下のメッセージが出力されてしまいました。

    pkg_add: warning: package 'diablo-jdk-1.3.1.0' requires 'libiconv-1.9.1_1', but 'libiconv-1.8_2' is installed
    pkg_add: warning: package 'diablo-jdk-1.3.1.0' requires 'XFree86-libraries-4.3.0_5', but 'XFree86-libraries-4.3.0_1' is installed
    
  4. 実行!

    インストールは成功した(みたいです)ので、とにかく、実行してみます。

    % javavm -jar /usr/local/diablo-jdk1.3.1/demo/jfc/SwingSet2/SwingSet2.jar
    Font specified in font.properties not found [--symbol-medium-r-normal--*-%d-*-*-p-*-adobe-fontspecific]
    Font specified in font.properties not found [--symbol-medium-r-normal--*-%d-*-*-p-*-adobe-fontspecific]
    Font specified in font.properties not found [--symbol-medium-r-normal--*-%d-*-*-p-*-adobe-fontspecific]
    Font specified in font.properties not found [--symbol-medium-r-normal--*-%d-*-*-p-*-adobe-fontspecific]
    Font specified in font.properties not found [--symbol-medium-r-normal--*-%d-*-*-p-*-adobe-fontspecific]
    Font specified in font.properties not found [--symbol-medium-r-normal--*-%d-*-*-p-*-adobe-fontspecific]
    Font specified in font.properties not found [--symbol-medium-r-normal--*-%d-*-*-p-*-adobe-fontspecific]
    Font specified in font.properties not found [--symbol-medium-r-normal--*-%d-*-*-p-*-adobe-fontspecific]
    Font specified in font.properties not found [--symbol-medium-r-normal--*-%d-*-*-p-*-adobe-fontspecific]
    Font specified in font.properties not found [--symbol-medium-r-normal--*-%d-*-*-p-*-adobe-fontspecific]
    Font specified in font.properties not found [--symbol-medium-r-normal--*-%d-*-*-p-*-adobe-fontspecific]
    Font specified in font.properties not found [--symbol-medium-r-normal--*-%d-*-*-p-*-adobe-fontspecific]
    Font specified in font.properties not found [--symbol-medium-r-normal--*-%d-*-*-p-*-adobe-fontspecific]
    Font specified in font.properties not found [--symbol-medium-r-normal--*-%d-*-*-p-*-adobe-fontspecific]
    Font specified in font.properties not found [--symbol-medium-r-normal--*-%d-*-*-p-*-adobe-fontspecific]
    Font specified in font.properties not found [--symbol-medium-r-normal--*-%d-*-*-p-*-adobe-fontspecific]
    Font specified in font.properties not found [--symbol-medium-r-normal--*-%d-*-*-p-*-adobe-fontspecific]
    Font specified in font.properties not found [--symbol-medium-r-normal--*-%d-*-*-p-*-adobe-fontspecific]
    Font specified in font.properties not found [--symbol-medium-r-normal--*-%d-*-*-p-*-adobe-fontspecific]
    Font specified in font.properties not found [--symbol-medium-r-normal--*-%d-*-*-p-*-adobe-fontspecific]
    java.awt.AWTException: cannot open XIM
            at sun.awt.motif.X11InputMethod.(X11InputMethod.java:148)
            at sun.awt.motif.X11InputMethodDescriptor.createInputMethod(X11InputMethodDescriptor.java:78)
            at sun.awt.im.InputContext.getInputMethodInstance(InputContext.java:691)
            at sun.awt.im.InputContext.getInputMethod(InputContext.java:641)
            at sun.awt.im.InputContext.dispatchEvent(InputContext.java:193)
            at sun.awt.im.InputMethodContext.dispatchEvent(InputMethodContext.java:177)
            at java.awt.Component.dispatchEventImpl(Component.java:2527)
            at java.awt.Container.dispatchEventImpl(Container.java:1213)
            at java.awt.Window.dispatchEventImpl(Window.java:914)
            at java.awt.Component.dispatchEvent(Component.java:2497)
            at java.awt.EventQueue.dispatchEvent(EventQueue.java:339)
            at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:131)
            at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:98)
            at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
            at java.awt.EventDispatchThread.run(EventDispatchThread.java:85)
    

    何やら、フォント関連のメッセージとIMのExceptionが出ています。まだ怪しいか...今日はここまで

  5. その後の調査で判明したこと

    その後、ドキュメントなどをちゃんと読み、いくつかのことが分かりました。

    native threadやHotSpot JVMを試しに使ってみることもできるようですが、実行時に以下の設定をする必要があるそうです。 ドキュメントはしっかり読みましょう。


Copyright(C) 2001-2008 ykondou.org
webmaster@ykondou.org
Key fingerprint = 7721 FB0E 42CC 2BD3 DB09 5868 3EC7 B5D2 B75C 5DAA

Valid CSS! Valid HTML 4.01!