⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 run

📁 帮助你系统进入JAVA的学习中来
💻
字号:
#!/bin/sh -e## Note to readers: This shell script is more complicated than simply# running the commands because it must handle many error conditions,# especially those that first time users are likely to encounter.# The meat of the script is down below the functions, where the first# "show" command is issued (that is, the first line that starts with# "show").  If you simply want to see what's done, read the# documentation.  The important commands are:##	javac -d ../.. *.java#	rmic -d ../.. examples.stock.StockServer examples.stock.StockApplet#	java examples.stocks.StockServer &#	appletviewer index.html## So if you're looking for information on how to run things yourself,# just ignore the entire script and use the above commands.### the directories in the path#pathdirs=`echo $PATH | tr ':' ' '`## find a binary somewhere in the path#findbin(){    prog=$1;    for dir in $pathdirs; do	if [ -x $dir/$prog ]; then	    echo $dir/$prog	    return;	fi    done    echo "Cannot find $prog in your path--please check your PATH variable" 1>&2    exit 1}## run a command, showing it (if -v is given, only in verbose mode)#run(){    if [ x"$1" = "x-v" ]; then	show "$@"	shift    else	show % "$@"    fi    eval "$@" || (	echo Running "$@" 1>&2	exit 2    )}## show some string (if -v, only in verbose)#show(){    if [ x"$1" = x"-v" ]; then	if [ "$verbose" != "" ]; then	    shift	    echo "..." "$@"	fi    elif [ x"$1" = x"-c" ]; then	shift	echo ""	echo "$@"    else	echo "$@"    fi}## kill off all processes#killpids() {    kill 0}## Process options#set +ewhile getopts vc opt; do    case $opt in      v) verbose="yes";;      c)	show -v cleaning out old stuff	rm -rf */. *.class core;;      \?)	echo "usage: run [-v] [-c]"	echo "   -c: clean before running"	echo "   -v: verbose"	exit 1	;;    esacdoneshift `expr $OPTIND - 1`set -e## Ensure that these programs can be found#javac=`findbin javac`rmic=`findbin rmic`show -v "javac is $javac"show -v "rmic is $rmic"## (There is no need to run rmiregistry for this example since# the StockServer class bundles its own registry.)## The top of the packagetop=../..show -v origCLASSPATH=$CLASSPATHorigCLASSPATH=$CLASSPATHexport CLASSPATHcase "$CLASSPATH" in    "")	CLASSPATH=$top	;;    $top:* | *:$top:* )	;;    *)	CLASSPATH="$top:$CLASSPATH"	;;esacshow -v "CLASSPATH=$CLASSPATH"## Compile the source#show -c "Compiling Java sources"run javac -d $top *.java## Run rmic#server=examples.stock.StockServerapplet=examples.stock.StockAppletshow -c "Running rmic on the implementations"run rmic -d $top $server $applet## Set up traps so that interrupt kills things off#trap killpids INT EXIT## Running the server#show -c "Start server $server"run java $server &# sleep to give the server time to start up and print its messagerun -v sleep 6## Run the appletviewer, after setting the class path back to the original# so that class loading is done via the codebase, not the class path.#show -v CLASSPATH=$origCLASSPATHCLASSPATH=$origCLASSPATHshow -c "Starting the appletviewer"run appletviewer index.html

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -