Loading ...
Sorry, an error occurred while loading the content.

[Clip] More Clips for Java

Expand Messages
  • Lawrence M Hamilton, Jr.
    Hey Clippers! I have been busy this weekend, actually Friday and some Saturday, developing some new clips to help me in learning and using Java. They follow
    Message 1 of 1 , Mar 26, 2000
    • 0 Attachment
      Hey Clippers!

      I have been busy this weekend, actually Friday and some Saturday,
      developing some new clips to help me in learning and using Java.

      They follow below, I tried to include enough documentation to make it
      clear what they do.

      The Run with Java Clip shows my initial lack of understanding of how to
      use the GetInput function. Run with Java2, shows the improvement that
      comes with using this command.

      Get Usage is a clip designed to send only a Java command to the command
      line. In Java this results in a message to the error stream that gives
      the user information on how to use the command. This lead to
      GetUsageVersatile, which can easily be modified to send any command line
      command to the command line. This is most useful for learning Java. I did
      not want to dig out my DOS manual to figure out how to copy to file the
      messages using DOS. I like using NoteTab MUCH better than DOS, and it was
      nice and neat, and brings it into a windows form quite nicely!

      All clips have default paths that you will need to modify for your
      system.

      Any suggestions for improvement will be most welcome! Especially from you
      Java experts! (Hint, hint, Wayne <g>)!



      *********************
      ---------< start clip >---------
      H="Run with Java"
      ;Larry Hamilton, Jr. <lmhamilton@...>
      ;03/26/2000, 10:25:17 PM
      ;^!SetDebug On

      ;
      ;----------------------[begin long line]---------------------------
      ;This Clip will run Java applets from the command line, if their *.java
      file is focused in NoteTab. Need a way to get output into a text file or
      applet display. See RunWithJava2
      ;-----------------------[end long line]----------------------------
      ;

      ;
      ;----------------------[begin long line]---------------------------
      ;This command only gives the name of the file, so can use to get name of
      *.java to run *.class.
      ;-----------------------[end long line]----------------------------
      ;
      ^!ChDir D:\NoteTab\Documents\java\
      ^!Set %file%=^$GetName(^**)$
      ;Command line to run a java applet from command line.
      ^!SetClipboard=java ^%file%
      ;Sets the directory with the java applet to be run.
      ;^!ChDir D:\NoteTab\Documents\java\
      ^!Delay 20
      ;
      ;----------------------[begin long line]---------------------------
      ;Opens DOS window, if paste button is available, can paste in contents of
      clipboard, which is the above command line.
      ;-----------------------[end long line]----------------------------
      ;
      ^!DOS Command
      ;From DOS Box with command line: D:\java\demo\NervousText
      ;
      ;----------------------[begin long line]---------------------------
      ;ENTERED D:\java\bin\appletviewer example.html, and the Applet Viewer
      worked.
      ;-----------------------[end long line]----------------------------
      ;
      ---------< end clip >-----------

      ---------< start clip >---------
      H="Run with Java2"
      ;Larry Hamilton, Jr. <lmhamilton@...>
      ;03/26/2000, 10:26:04 PM
      ;^!SetDebug On
      ;
      ;----------------------[begin long line]---------------------------
      ;This is a more elegant clip than "Run with Java", since it does not
      require the DOS window to have the toolbar for manual pasting of the
      command at the command prompt. Rather it uses the GetOutput clip command.
      ;-----------------------[end long line]----------------------------
      ;
      ;This Clip will run Java applets from the command line, if their *.java
      file is focused in NoteTab. So far this only works with JDBC applets,
      that output to command line. Need a way to get output into a text file or
      applet display.
      ^!SET %ErrorFile%=^$GetStdErrorName$
      ^!DestroyDoc ^%ErrorFile%
      ;
      ;----------------------[begin long line]---------------------------
      ;This command only gives the name of the file, so can use to get name of
      *.java to run *.class.
      ;-----------------------[end long line]----------------------------
      ;
      ^!ChDir D:\NoteTab\Documents\java\
      ^!Set %file%=^$GetName(^**)$
      ;Command line to run a java applet from command line.
      ;^!SetClipboard=java ^%file%
      ;
      ;----------------------[begin long line]---------------------------
      ;^!Info ^$GetOutput("D:\jdk1.1.8\bin\JAVA -classpath
      D:\NoteTab\Documents\java\ ^%File%")$
      ;-----------------------[end long line]----------------------------
      ;
      ^!Info ^$GetOutput("JAVA -classpath
      D:\jdk1.1.8\lib\classes.zip;D:\jdk1.1.8\lib\solid\jdbc\;D:\NoteTab\Docume
      nts\java\ ^%File%")$
      ;
      ;----------------------[begin long line]---------------------------
      ;java -classpath
      D:\jdk1.1.8\lib\classes.zip;D:\jdk1.1.8\lib\solid\jdbc\;D:\Downloads\Java
      \sj23win\samples\ sample1
      ;-----------------------[end long line]----------------------------
      ;
      ;^!Info ^$GetStdErrorName$

      ^!If ^$GetTextSize$ > 1 SKIP
      ^!Close DISCARD
      ;// Check for an error file
      ^!IFFILEEXIST "^%ErrorFile%" DISPLAYERROR
      ;// No errors to refocus on source code document
      ^!SetDocIndex ^%DocIndex%
      ^!GOTO END
      ;// Load and display errors
      :DISPLAYERROR
      ^!Info ^$GetFileText(^%ErrorFile%)$
      ^!OPEN ^%ErrorFile%
      ^!SetWordWrap ON
      ^!SOUND SystemExclamation
      ---------< end clip >-----------

      ---------< start clip >---------
      H="Get Usage"
      ;Larry Hamilton, Jr. <lmhamilton@...>
      ;03/26/2000, 10:26:50 PM
      ;03/24/2000
      ;
      ;----------------------[begin long line]---------------------------
      ;This Clip will send Java commands to the command line, and will return
      the usage to an info box. CAUTION: If a command does not generate usage
      information, this could cause problems.
      ;-----------------------[end long line]----------------------------
      ;
      ;^!SetDebug On
      ^!ClearVariables
      ^!SET %ErrorFile%=^$GetStdErrorName$
      ;^!Set %pgm%=^?{Java Exe=}
      ;^!Set %param%="-help"
      ^!DestroyDoc ^%ErrorFile%

      ^!SetHintInfo Calculating...
      ^!SetListDelimiter=^%SPACE%
      ;
      ;----------------------[begin long line]---------------------------
      ^!SetArray
      %FileList%=^$GetFiles(^?[(T=D)Directory=D:\jdk1.1.8\bin];"*.exe")$
      ;-----------------------[end long line]----------------------------
      ;

      ^!Set
      %list%=^$StrReplace("D:\jdk1.1.8\bin\";"|";"^%FileList%";False;True)$
      ^!Set %list2%=^$StrReplace(".exe ";"^%EMPTY%";"^%List%";False;True)$
      ^!Set %Show%=^$StrDelete("^%List2%";1;1)$

      ^!SetWizardTitle Get Java Command Usage
      ^!SetWizardLabel These are the Java commands in your JDK:
      ^!Info ^%Show%
      ^!Set %pgm%=^?{(T=C;H=24)Exe's=^%Show%}

      ;^!ChDir D:\NoteTab\Documents\java\
      ;Command line to run a java applet from command line.
      ^!SetWizardTitle Command Usage
      ^!Info ^$GetInputOutput("^%pgm%")$
      ;^!Info ^$GetOutput("^%pgm%")$

      ;
      ;----------------------[begin long line]---------------------------
      ;java -classpath
      D:\jdk1.1.8\lib\classes.zip;D:\jdk1.1.8\lib\solid\jdbc\;D:\Downloads\Java
      \sj23win\samples\ sample1
      ;-----------------------[end long line]----------------------------
      ;

      ^!If ^$GetTextSize$ > 1 SKIP
      ^!Close DISCARD
      ;// Check for an error file
      ^!IFFILEEXIST "^%ErrorFile%" DISPLAYERROR
      ;// No errors to refocus on source code document
      ^!SetDocIndex ^%DocIndex%
      ^!GOTO END
      ;// Load and display errors
      :DISPLAYERROR
      ^!SetWizardTitle Error Stream
      ^!Info ^$GetFileText(^%ErrorFile%)$
      ;^!OPEN ^%ErrorFile%
      ^!SetWordWrap ON
      ;^!SOUND SystemExclamation
      ---------< end clip >-----------

      ---------< start clip >---------
      H="Get Usage Versatile"
      ;Larry Hamilton, Jr. <lmhamilton@...>
      ;03/26/2000, 10:29:55 PM
      ;03/25/2000
      ;
      ;----------------------[begin long line]---------------------------
      ;This Clip is a more versatile clip that can send any desired commands to
      the command line. Currently it still has the default functionality to
      return the Java usage to an info box. CAUTION: If a command does not
      generate usage information, this could cause problems.
      ;-----------------------[end long line]----------------------------
      ;
      ;It could easily be modified to only include the desired "default"
      directories that have command line exe's, such as DOS, Java, the Cscript
      portion of the WSH, Perl, or Gawk.
      ;
      ;----------------------[begin long line]---------------------------
      ;Use with Perl or Gawk should rely on the RunPerl and RunGawk commands.
      See Wayne VanWeerthuizen's NoteAwk clip library for more on Perl and
      Gawk.
      ;-----------------------[end long line]----------------------------
      ;
      ;^!SetDebug on
      ^!ClearVariables
      ^!SET %ErrorFile%=^$GetStdErrorName$
      ^!DestroyDoc ^%ErrorFile%
      ;^!SetHintInfo Calculating...
      ^!SetListDelimiter=^%SPACE%
      ;
      ;----------------------[begin long line]---------------------------
      ^!SetArray
      %FileList%=^$GetFiles(^?[(T=C)Directory=D:\jdk1.1.8\bin|C:\Windows\Comman
      d|D:\java\bin\|];"^?[File type(s) *.txt;*.bat;*.com;*.exe (all types
      shown)=*.bat|*.com|_*.exe|*.pl|*.awk|*.*]")$
      ;-----------------------[end long line]----------------------------
      ;
      ;TESTING - ^!SetArray
      %FileList%=^$GetFiles(^?[(T=C)Directory=D:\jdk1.1.8\bin|C:\Windows\Comman
      d|D:\java\bin\|D:\Perl\bin\|D:\Perl\lib|D:\Perl\myperl|D:\Gawk\gnu\lib\aw
      k];"^?[File type(s) *.txt;*.bat;*.com;*.exe (all types
      shown)=*.bat|*.com|_*.exe|*.pl|*.*]")$
      ^!Set %path1%=^%FileList1%
      ^!Set %snoop%=^$StrPosRight("\";"^%Path1%";false)$
      ^!Set %end%=^$StrSize("^%Path1%")$
      ^!Set %index%=^$Calc(^%snoop%+1)$
      ^!Set %amount%=^$Calc(^%end%-^%index%+1)$
      ^!Set %final%=^$StrDelete("^%Path1";^%Index%;^%amount%)$
      ^!Info ^%final%

      ^!Set %list%=^$StrReplace("^%final%";"|";"^%FileList%";False;True)$
      ^!Set %list2%=^$StrReplace(".exe ";"^%EMPTY%";"^%List%";False;True)$
      ^!Set %show%=^$StrDelete("^%List2%";1;1)$

      ^!SetWizardTitle Get Java Command Usage
      ^!SetWizardLabel These are the Java commands in your JDK:
      ^!Set %pgm%=^?{(T=C;H=24)Exe's=^%show%}

      ;^!ChDir D:\NoteTab\Documents\java\
      ;Command line to run a java applet from command line.
      ^!SetWizardTitle Command Usage
      ;^!Info ^$GetInputOutput("^%pgm%")$
      ^!Info ^$GetOutput("^%pgm%")$

      ^!If ^$GetTextSize$ > 1 SKIP
      ^!Close DISCARD
      ;// Check for an error file
      ^!IFFILEEXIST "^%ErrorFile%" DISPLAYERROR
      ;// No errors to refocus on source code document
      ^!SetDocIndex ^%DocIndex%
      ^!GOTO END
      ;// Load and display errors
      :DISPLAYERROR
      ^!SetWizardTitle Error Stream
      ;
      ;----------------------[begin long line]---------------------------
      ;If you prefer a file instead of or in addition to an info box, uncomment
      the ^!Open line. This file exists already.
      ;-----------------------[end long line]----------------------------
      ;
      ^!Info ^$GetFileText(^%ErrorFile%)$
      ;^!OPEN ^%ErrorFile%
      ^!SetWordWrap ON
      ;^!SOUND SystemExclamation
      ---------< end clip >-----------


      Larry Hamilton, Jr. lmhamilton@...
      Hamilton National Genealogical Society, Inc.
      http://www.HamiltonGenSociety.org/
      My Web Site: http://notlimaH.tripod.com

      ________________________________________________________________
      YOU'RE PAYING TOO MUCH FOR THE INTERNET!
      Juno now offers FREE Internet Access!
      Try it today - there's no risk! For your FREE software, visit:
      http://dl.www.juno.com/get/tagj.
    Your message has been successfully submitted and would be delivered to recipients shortly.