alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Java example source code file (jrunscript.1)

This example Java source code file (jrunscript.1) is included in the alvinalexander.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Learn more about this Java project at its project page.

Java - Java tags/keywords

general, javascript, license, public, this

The jrunscript.1 Java example source code

'\" t
.\" Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
.\" Title: jrunscript
.\" Language: English
.\" Date: 2013年11月21日
.\" SectDesc: スクリプティング・ツール
.\" Software: JDK 8
.\" Arch: 汎用
.\"
.\" DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
.\"
.\" This code is free software; you can redistribute it and/or modify it
.\" under the terms of the GNU General Public License version 2 only, as
.\" published by the Free Software Foundation.
.\"
.\" This code is distributed in the hope that it will be useful, but WITHOUT
.\" ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
.\" FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
.\" version 2 for more details (a copy is included in the LICENSE file that
.\" accompanied this code).
.\"
.\" You should have received a copy of the GNU General Public License version
.\" 2 along with this work; if not, write to the Free Software Foundation,
.\" Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
.\"
.\" Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
.\" or visit www.oracle.com if you need additional information or have any
.\" questions.
.\"
.pl 99999
.TH "jrunscript" "1" "2013年11月21日" "JDK 8" "スクリプティング・ツール"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
jrunscript \- 対話型モードとバッチ・モードをサポートするコマンドライン・スクリプト・シェルを実行します。このコマンドは試験的なもので、サポートされていません。
.SH "概要"
.sp
.if n \{\
.RS 4
.\}
.nf
\fIjrunscript\fR [\fIoptions\fR] [\fIarguments\fR]
.fi
.if n \{\
.RE
.\}
.PP
\fIoptions\fR
.RS 4
コマンドライン・オプション。オプションを参照してください。
.RE
.PP
\fIarguments\fR
.RS 4
引数を使用する場合、オプションまたはコマンド名の直後に記述してください。引数を参照してください。
.RE
.SH "説明"
.PP
\fIjrunscript\fRコマンドは、言語に依存しないコマンドライン・スクリプト・シェルです。\fIjrunscript\fRは、対話型(read\-eval\-print)モードとバッチ(\fI\-f\fRオプション)・モードの両方のスクリプト実行をサポートします。デフォルトの使用言語はJavaScriptですが、\fI\-l\fRオプションを使用すれば他の言語も指定できます。\fIjrunscript\fRコマンドは、Javaとスクリプト言語との通信を使用して探求的なプログラミング・スタイルをサポートします。
.SH "オプション"
.PP
\-classpath \fIpath\fR
.RS 4
スクリプトがアクセスする必要のあるクラス・ファイルの場所を示します。
.RE
.PP
\-cp \fIpath\fR
.RS 4
\fI\-classpath\fR
\fIpath\fRと同じです。
.RE
.PP
\-D\fIname\fR=\fIvalue\fR
.RS 4
Javaのシステム・プロパティを設定します。
.RE
.PP
\-J\fIflag\fR
.RS 4
\fIflag\fRを、\fIjrunscript\fRコマンドが実行されているJava仮想マシンに直接渡します。
.RE
.PP
\-I \fIlanguage\fR
.RS 4
指定されたスクリプト言語を使用します。デフォルトではJavaScriptが使用されます。他のスクリプト言語を使用するには、\fI\-cp\fRまたは\fI\-classpath\fRオプションを使用して、対応するスクリプト・エンジンのJARファイルを指定する必要があります。
.RE
.PP
\-e \fIscript\fR
.RS 4
指定されたスクリプトを評価します。このオプションを使用すれば、コマンドラインにすべてが指定された1行スクリプトを実行できます。
.RE
.PP
\-encoding \fIencoding\fR
.RS 4
スクリプト・ファイルの読取り時に使用する文字エンコーディングを指定します。
.RE
.PP
\-f \fIscript\-file\fR
.RS 4
指定されたスクリプト・ファイル(バッチ・モード)を評価します。
.RE
.PP
\-f \-
.RS 4
標準入力からスクリプトを読み取り、それを評価します(対話型モード)。
.RE
.PP
\-help
.RS 4
ヘルプ・メッセージを表示して終了します。
.RE
.PP
\-?
.RS 4
ヘルプ・メッセージを表示して終了します。
.RE
.PP
\-q
.RS 4
利用可能なすべてのスクリプト・エンジンを一覧表示したあと、終了します。
.RE
.SH "引数"
.PP
argumentsが存在していて、かつ\fI\-e\fR、\fI\-f\fRのいずれのオプションも使用されなかった場合、最初の引数がスクリプト・ファイルとなり、他の引数が存在する場合はスクリプトに渡されます。argumentsと、\fI\-e\fRまたは\fI\-f\fRオプションが使用されている場合、すべてのargumentsがスクリプトに渡されます。arguments、\fI\-e\fR、\fI\-f\fRがどれも存在しなかった場合は、対話型モードが使用されます。スクリプトからスクリプト引数を使用するには、\fIarguments\fRという名前の\fIString\fR配列型のエンジン変数を使用します。
.SH "例"
.SS "インライン・スクリプトの実行"
.sp
.if n \{\
.RS 4
.\}
.nf
jrunscript \-e "print(\*(Aqhello world\*(Aq)"
jrunscript \-e "cat(\*(Aqhttp://www\&.example\&.com\*(Aq)"
.fi
.if n \{\
.RE
.\}
.SS "指定された言語の使用およびスクリプト・ファイルの評価"
.sp
.if n \{\
.RS 4
.\}
.nf
jrunscript \-l js \-f test\&.js
.fi
.if n \{\
.RE
.\}
.SS "対話型モード"
.sp
.if n \{\
.RS 4
.\}
.nf
jrunscript
js> print(\*(AqHello World\en\*(Aq);
Hello World
js> 34 + 55
89\&.0
js> t = new java\&.lang\&.Thread(function() { print(\*(AqHello World\en\*(Aq); })
Thread[Thread\-0,5,main]
js> t\&.start()
js> Hello World
 
js>
.fi
.if n \{\
.RE
.\}
.SS "スクリプト引数を指定したスクリプト・ファイルの実行"
.PP
test\&.jsファイルはスクリプト・ファイルです。\fIarg1\fR、\fIarg2\fRおよび\fIarg3\fRの各引数がスクリプトに渡されます。スクリプトはarguments配列を使用してこれらの引数にアクセスできます。
.sp
.if n \{\
.RS 4
.\}
.nf
jrunscript test\&.js arg1 arg2 arg3
.fi
.if n \{\
.RE
.\}
.SH "関連項目"
.PP
JavaScriptが使用される場合、ユーザー定義スクリプトを評価する前に、\fIjrunscript\fRコマンドはいくつかの組込み関数や組込みオブジェクトを初期化します。これらのJavaScriptの組込みについては、http://code\&.google\&.com/p/jsdoc\-toolkit/にある
JsDoc\-Toolkitを参照してください。
.br
'pl 8.5i
'bp

Other Java examples (source code examples)

Here is a short list of links related to this Java jrunscript.1 source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.