Blame | Last modification | View Log | Download
@ECHO OFFREM Copyright (C) Cay S. Horstmann 1997. All rights reserved.REM Distributed with TextPad with the permission of Cay S. Horstmann,REM (www.horstmann.com) joint author of "Core Java" (ISBN 0-13-596891-7).REMREM This crazy batch file does the following.REM 1. It finds if the .java file contains the word Applet. If so, it assumesREM it is an applet. So don't confuse it with silly things like displayingREM "This isn't an applet."REM 2. If it is an applet, it makes a quick-and-dirty HTML file. I am givingREM it the extension .HTM so that your well-crafted HTML files aren'tREM overwritten. The weird sequence of quotation marks is necessary becauseREM ECHO can't echo unquoted "<" and ">" charactersREM 3. If it is an applet, appletviewer is started. Otherwise the javaREM interpreter is started.REM 4. If it is a console applet (not deriving from Frame), then the batchREM file pauses for you to admire the output.if "%1"=="" goto endif not exist %1.class javac %1.javafind "Applet" %1.java > NUL:if ERRORLEVEL 1 goto notappletecho "<APPLET CODE="%1.class" WIDTH=400 HEIGHT=300 IGNORE=""></APPLET>" > %1.HTMREM Mercifully, appletviewer ignores the quotes outside the Applet tagappletviewer %1.HTMgoto end:notappletfind "Frame" %1.java > NUL:if ERRORLEVEL 1 goto notframejava %1goto end:notframejava %1pause:end