TweetVeiwerをJavaで作ろう 1.ビルド | 乖離のぶろぐ(*´∀`)吸い込んで応援
■前作は・・・
http://ameblo.jp/pochifx/entry-11237030271.html
BOTサイトから追い出されてしまった。。しようがない、Javaで作るか。
2012-04-29

■今回のIDEは pleiades-e4.2-ultimate-jre_20120812.zip を用いる。
http://mergedoc.sourceforge.jp/index.html#/pleiades.html
Pleiades All in One 日本語ディストリビューション (zip) ダウンロード
Pleiades All in One 4.2.0.v20120812 (Eclipse 4.2.0 Juno for Windows ベース)
Ultimate 64bit JREあり
http://ftp.jaist.ac.jp/pub/mergedoc/pleiades/4.2/pleiades-e4.2-ultimate-jre_20120812.zip
SIZE: 1,029,684,021 bytes

C:\tmp\a\eclipse\eclipse.exe を実行する。
$乖離のぶろぐ(*´∀`)吸い込んで応援
(゚ω゚)起動できた。

■今回は、Javaのプロパティファイルではなく、XMLファイルを読んでみる。
XMLファイルを扱うには以下のAPIを使う。
http://xerces.apache.org/

$乖離のぶろぐ(*´∀`)吸い込んで応援

ダウンロードするファイルは2つ。

Source Distributions
Xerces2 Java 2.11.0 - zip
http://ftp.riken.jp/net/apache//xerces/j/source/Xerces-J-src.2.11.0.zip

Build Tools Distributions
Xerces2 Java 2.11.0 - zip
http://ftp.riken.jp/net/apache//xerces/j/source/Xerces-J-tools.2.11.0.zip


Xerces-J-src.2.11.0.zipには、最初に読むべきREADMEファイルが入ってる。

Xerces Java Build Instructions
------------------------------

===========================================================================
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
===========================================================================

Before building Xerces, you need the source package and tools
package available from the Apache XML Project's distribution
web page:

http://xml.apache.org/dist/xerces-j/

Download both the Xerces-J-src.X.Y.Z.zip and Xerces-J-tools.X.Y.Z.zip
files for the appropriate Xerces release (where "X.Y.Z" is the version
number) and extract them in the same directory. If you are using Unix,
download the equivalent .tar.gz files instead of the .zip files.

You also need to have a Java Development Kit (JDK) version 1.2 (or
higher) installed on your system. Before initiating any part of the
build, set the JAVA_HOME environment variable to the installation
directory of your JDK.

The Ant program is used to build everything in Xerces, including
the documentation. This tool, and the others needed (besides the
pre-requisite JDK) are contained within the tools package. To
make building the packages easier, a Windows batch file and a Unix
shell script are included.

If you only want to compile the source code and make the JAR files,
run the following command on Windows:

build.bat jars

or from Unix (make sure that build.sh is executable):

build.sh jars

This will compile all of the source code and generate the JAR
files that are available as part of the binary package. After
building, these files will be located in the build/ directory.

If you want to build everything, including the documentation,
run the build batch file (or shell script) specifying the "all"
target instead of "jars".


手順はこんな感じ
1. src と tools は同じディレクトリに解凍

2.JAVA_HOME環境変数を設定
$乖離のぶろぐ(*´∀`)吸い込んで応援


3.cmd.exeを実行し、set って打ってみる

$乖離のぶろぐ(*´∀`)吸い込んで応援


4.ビルド

C:\Users\user>cd C:\tmp\a\workspace\xerces-2_11_0

C:\tmp\a\workspace\xerces-2_11_0>dir

2010/11/26 15:42 2,234 build.bat
2010/11/26 15:42 2,517 build.sh
2010/11/26 15:42 81,036 build.xml
2012/09/21 00:21 <DIR> data
2012/09/21 00:21 <DIR> docs
2010/11/26 15:42 11,560 LICENSE
2010/11/26 15:42 436 LICENSE-SAX.html
2010/11/26 15:42 5,023 LICENSE.DOM-documentation.html
2010/11/26 15:42 4,167 LICENSE.DOM-software.html
2010/11/26 15:42 11,558 LICENSE.resolver.txt
2010/11/26 15:42 11,558 LICENSE.serializer.txt
2010/11/26 15:42 911 NOTICE
2010/11/26 15:42 388 NOTICE.resolver.txt
2010/11/26 15:42 864 NOTICE.serializer.txt
2010/11/26 15:42 2,617 README
2010/11/26 15:42 1,662 Readme.html
2012/09/21 00:21 <DIR> samples
2012/09/21 00:21 <DIR> src
2012/09/21 00:21 <DIR> tools

C:\tmp\a\workspace\xerces-2_11_0>build.bat jars
Xerces-Java Build System
------------------------
Building with ant classpath C:\Program Files\Java\jdk1.7.0_07\lib\tools.jar;C:\P
rogram Files\Java\jdk1.7.0_07\lib\classes.zip;.\tools\ant.jar;.\tools\ant-nodeps
.jar;.\tools\ant-launcher.jar;.\tools\ant-junit.jar;.\tools\xml-apis.jar;.\tools
\xercesImpl.jar;.\tools\bin\xjavac.jar
Starting Ant...
Buildfile: build.xml

init:
[echo] ---------------- Xerces-J 2.11.0 [1999-2010] ---------------

prepare:
[mkdir] Created dir: C:\tmp\a\workspace\xerces-2_11_0\build

prepare-common:
[mkdir] Created dir: C:\tmp\a\workspace\xerces-2_11_0\build\src
[mkdir] Created dir: C:\tmp\a\workspace\xerces-2_11_0\build\classes
[mkdir] Created dir: C:\tmp\a\workspace\xerces-2_11_0\build\classes\META-INF

[mkdir] Created dir: C:\tmp\a\workspace\xerces-2_11_0\build\classes\META-INF
\services
[copy] Copying 1 file to C:\tmp\a\workspace\xerces-2_11_0\build\classes\MET
A-INF\services
[copy] Copying 1 file to C:\tmp\a\workspace\xerces-2_11_0\build\classes\MET
A-INF\services
[copy] Copying 1 file to C:\tmp\a\workspace\xerces-2_11_0\build\classes\MET
A-INF\services
[copy] Copying 1 file to C:\tmp\a\workspace\xerces-2_11_0\build\classes\MET
A-INF\services
[copy] Copying 1 file to C:\tmp\a\workspace\xerces-2_11_0\build\classes\MET
A-INF\services
[copy] Copying 1 file to C:\tmp\a\workspace\xerces-2_11_0\build\classes\MET
A-INF\services

prepare-src:
[copy] Copying 1 file to C:\tmp\a\workspace\xerces-2_11_0\build\classes\MET
A-INF\services
[copy] Copying 733 files to C:\tmp\a\workspace\xerces-2_11_0\build\src
[copy] Copying 1 file to C:\tmp\a\workspace\xerces-2_11_0\build\src\org\apa
che\xerces\impl\msg
[copy] Copying 1 file to C:\tmp\a\workspace\xerces-2_11_0\build\src\org\apa
che\xerces\impl\msg
[copy] Copying 1 file to C:\tmp\a\workspace\xerces-2_11_0\build\src\org\apa
che\xerces\impl\msg
[copy] Copying 1 file to C:\tmp\a\workspace\xerces-2_11_0\build\src\org\apa
che\xerces\impl\msg
[copy] Copying 1 file to C:\tmp\a\workspace\xerces-2_11_0\build\src\org\apa
che\xerces\impl\msg
[copy] Copying 1 file to C:\tmp\a\workspace\xerces-2_11_0\build\src\org\apa
che\xerces\impl\msg
[copy] Copying 1 file to C:\tmp\a\workspace\xerces-2_11_0\build\src\org\apa
che\xerces\impl\msg
[copy] Copying 1 file to C:\tmp\a\workspace\xerces-2_11_0\build\src\org\apa
che\xerces\impl\msg
[copy] Copying 1 file to C:\tmp\a\workspace\xerces-2_11_0\build\src\org\apa
che\xerces\impl\msg
[copy] Copying 1 file to C:\tmp\a\workspace\xerces-2_11_0\build\src\org\apa
che\xerces\impl\xpath\regex
[unzip] Expanding: C:\tmp\a\workspace\xerces-2_11_0\tools\xml-commons-extern
al-src.zip into C:\tmp\a\workspace\xerces-2_11_0\build\src

compile:
[copy] Copying 23 files to C:\tmp\a\workspace\xerces-2_11_0\build\classes
[xjavac] Compiling 707 source files to C:\tmp\a\workspace\xerces-2_11_0\build
\classes
[xjavac] 警告:[options] ブートストラップ・クラスパスが-source 1.6と一緒に設定
されていません

( 省略 )

[xjavac] エラー3個
[xjavac] 警告1個

BUILD FAILED
C:\tmp\a\workspace\xerces-2_11_0\build.xml:311: Compile failed; see the compiler
error output for details.

Total time: 10 seconds

C:\tmp\a\workspace\xerces-2_11_0>


(゚ω゚)ビルド失敗。1.6を使えと言ってるようだ。
(゚ω゚)xerces-2_11_0\buildがビルド結果っぽいから、buildディレクトリは消す。


C:\tmp\a\workspace\xerces-2_11_0>set JAVA_HOME=C:\tmp\a\java\6

C:\tmp\a\workspace\xerces-2_11_0>build.bat jars
Xerces-Java Build System
------------------------
Building with ant classpath C:\tmp\a\java\6\lib\tools.jar;C:\tmp\a\java\6\lib\cl
asses.zip;.\tools\ant.jar;.\tools\ant-nodeps.jar;.\tools\ant-launcher.jar;.\tool
s\ant-junit.jar;.\tools\xml-apis.jar;.\tools\xercesImpl.jar;.\tools\bin\xjavac.j
ar
Starting Ant...
Buildfile: build.xml

init:
[echo] ---------------- Xerces-J 2.11.0 [1999-2010] ---------------

prepare:
[mkdir] Created dir: C:\tmp\a\workspace\xerces-2_11_0\build

prepare-common:
[mkdir] Created dir: C:\tmp\a\workspace\xerces-2_11_0\build\src
[mkdir] Created dir: C:\tmp\a\workspace\xerces-2_11_0\build\classes
[mkdir] Created dir: C:\tmp\a\workspace\xerces-2_11_0\build\classes\META-INF

[mkdir] Created dir: C:\tmp\a\workspace\xerces-2_11_0\build\classes\META-INF
\services
[copy] Copying 1 file to C:\tmp\a\workspace\xerces-2_11_0\build\classes\MET
A-INF\services
[copy] Copying 1 file to C:\tmp\a\workspace\xerces-2_11_0\build\classes\MET
A-INF\services
[copy] Copying 1 file to C:\tmp\a\workspace\xerces-2_11_0\build\classes\MET
A-INF\services
[copy] Copying 1 file to C:\tmp\a\workspace\xerces-2_11_0\build\classes\MET
A-INF\services
[copy] Copying 1 file to C:\tmp\a\workspace\xerces-2_11_0\build\classes\MET
A-INF\services
[copy] Copying 1 file to C:\tmp\a\workspace\xerces-2_11_0\build\classes\MET
A-INF\services

prepare-src:
[copy] Copying 1 file to C:\tmp\a\workspace\xerces-2_11_0\build\classes\MET
A-INF\services
[copy] Copying 733 files to C:\tmp\a\workspace\xerces-2_11_0\build\src
[copy] Copying 1 file to C:\tmp\a\workspace\xerces-2_11_0\build\src\org\apa
che\xerces\impl\msg
[copy] Copying 1 file to C:\tmp\a\workspace\xerces-2_11_0\build\src\org\apa
che\xerces\impl\msg
[copy] Copying 1 file to C:\tmp\a\workspace\xerces-2_11_0\build\src\org\apa
che\xerces\impl\msg
[copy] Copying 1 file to C:\tmp\a\workspace\xerces-2_11_0\build\src\org\apa
che\xerces\impl\msg
[copy] Copying 1 file to C:\tmp\a\workspace\xerces-2_11_0\build\src\org\apa
che\xerces\impl\msg
[copy] Copying 1 file to C:\tmp\a\workspace\xerces-2_11_0\build\src\org\apa
che\xerces\impl\msg
[copy] Copying 1 file to C:\tmp\a\workspace\xerces-2_11_0\build\src\org\apa
che\xerces\impl\msg
[copy] Copying 1 file to C:\tmp\a\workspace\xerces-2_11_0\build\src\org\apa
che\xerces\impl\msg
[copy] Copying 1 file to C:\tmp\a\workspace\xerces-2_11_0\build\src\org\apa
che\xerces\impl\msg
[copy] Copying 1 file to C:\tmp\a\workspace\xerces-2_11_0\build\src\org\apa
che\xerces\impl\xpath\regex
[unzip] Expanding: C:\tmp\a\workspace\xerces-2_11_0\tools\xml-commons-extern
al-src.zip into C:\tmp\a\workspace\xerces-2_11_0\build\src

compile:
[copy] Copying 23 files to C:\tmp\a\workspace\xerces-2_11_0\build\classes
[xjavac] Compiling 707 source files to C:\tmp\a\workspace\xerces-2_11_0\build
\classes
[xjavac] 注:一部の入力ファイルは推奨されない API を使用またはオーバーライドし
ています。
[xjavac] 注:詳細については、-Xlint:deprecation オプションを指定して再コンパイ
ルしてください。
[xjavac] 注:入力ファイルの操作のうち、未チェックまたは安全ではないものがあり
ます。
[xjavac] 注:詳細については、-Xlint:unchecked オプションを指定して再コンパイル
してください。

jar:
[copy] Copying 1 file to C:\tmp\a\workspace\xerces-2_11_0\build
[jar] Building jar: C:\tmp\a\workspace\xerces-2_11_0\build\xercesImpl.jar

samples:
[mkdir] Created dir: C:\tmp\a\workspace\xerces-2_11_0\build\samples
[copy] Copying 50 files to C:\tmp\a\workspace\xerces-2_11_0\build\samples
[xjavac] Compiling 49 source files to C:\tmp\a\workspace\xerces-2_11_0\build\
classes
[xjavac] 注:一部の入力ファイルは推奨されない API を使用またはオーバーライドし
ています。
[xjavac] 注:詳細については、-Xlint:deprecation オプションを指定して再コンパイ
ルしてください。
[xjavac] 注:入力ファイルの操作のうち、未チェックまたは安全ではないものがあり
ます。
[xjavac] 注:詳細については、-Xlint:unchecked オプションを指定して再コンパイル
してください。

sampjar:
[jar] Building jar: C:\tmp\a\workspace\xerces-2_11_0\build\xercesSamples.j
ar

jars:
[copy] Copying 1 file to C:\tmp\a\workspace\xerces-2_11_0\build
[copy] Copying 1 file to C:\tmp\a\workspace\xerces-2_11_0\build
[copy] Copying 1 file to C:\tmp\a\workspace\xerces-2_11_0\build

BUILD SUCCESSFUL
Total time: 13 seconds

C:\tmp\a\workspace\xerces-2_11_0>


(゚ω゚)今度はうまくビルド出来たようだ。