faqts : Computers : Programming : Languages : Tse : Language : Computer : Java

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

1 of 1 people (100%) answered Yes
Recently 1 of 1 people (100%) answered Yes

Entry

TSE: Language: Computer: Compile: Java: How to compile Java from TSE v4.x?

Aug 24th, 2004 11:36
Knud van Eeden,


----------------------------------------------------------------------
--- Knud van Eeden --- 16 September 2003 - 06:11 pm ------------------

TSE: Language: Computer: Compile: Java: How to compile Java from TSE 
v4.x?

Steps: Overview:

 1. make sure you have Java installed, so that e.g. Java.exe and 
Javac.exe
    can be found on your computer

    e.g. goto URL:

     http://www.sun.com

 2. create a batchfile 'comJAVA.bat', containing this text
    (adapt it to your system) and store this batchfile in your TSE 
directory
    (e.g. save to c:\mytsedirectory\comJava.bat)

--- cut here ---------------------------------------------------------

      @SET filenameS=%3
      javac.exe %filenameS%
      java %1
      @SET filenameS=
      @PAUSE
      @EXIT

--- cut here ---------------------------------------------------------

 3. This is the batch file 'comJAVA.bat' I use myself currently

--- cut here ---------------------------------------------------------

     @REM this batch file is made for use in 4DOS / 4NT

     @REM add the path to your javac.exe on this computer
     SET PATHOLD=%PATH%
     SET PATH=%PATH%;c:\j2sdk1.4.1_03\bin\

     @REM set the path to your java on this computer
     SET HOMEOLD=%HOME%
     SET HOME=c:\

     @REM make sure you have the long filename, given the short 
complete filename
     @SET filenamelongS=%@LFN[%3]
     @IF EXIST %@NAME[%filenamelongS%].class @DEL %@NAME[%
filenamelongS%].class
     @REM javac.exe %filenamelongS%
     javac.exe %filenamelongS%
     @IF NOT EXIST %@NAME[%filenamelongS%].class GOTO error

     @REM search now for the occurrence of the word 'main' in the 
source file
     @REM if yes, run java.exe else run the htm file
     @grep main %filenamelongS% > c:\temp\dddxyy.ddd
     @IF "%@FILESIZE[c:\temp\dddxyy.ddd]"=="0" GOTO applet
     java %@NAME[%filenamelongS%]
     @DEL c:\temp\dddxyy.ddd
     @GOTO end

     :applet
     @IF EXIST c:%@NAME[%filenamelongS%].htm goto appletrun
     @ECHO the html file c:%@NAME[%filenamelongS%].htm necessary
     @PAUSE to run the applet is not found.
     @GOTO end

     :appletrun
     start c:%@NAME[%filenamelongS%].htm
     @GOTO end

     :error
     @ECHO.
     @ECHO.
     @ECHO Error(s) have occurred in the compilation
     @ECHO.

     :end
     @SET filenamelongS=
     @SET PATH=%PATHOLD%
     @SET HOME=%HOMEOLD%
     @PAUSE
     @EXIT

--- cut here ---------------------------------------------------------

4. Adapt the compiler information

   (in TSE, after loading any file, press <SHIFT><F9>
   then 'D' for debug compiler setup
   then <ALT><C> to copy one of the compiler settings present
   then change the fields:

   'Extension' to: .jav
   'Description' to: Java
   'Command' to: c:\mytsedirectory\comJava.bat &name& &ext& &fn& > 
&output&

   ---

   Note: if you want to force your batch file to be executed by another
         command line processor like 4NT (or 4DOS),
         you can use instead:

   'Command' c:\4dos\4nt.exe c:\mytsedirectory\comJava.bat &name& 
&ext& &fn& > &output&

   ---

    If you get an empty screen, use instead:
   'Command' to: c:\mytsedirectory\comJava.bat &name& &ext& &fn&

   make sure this information is permanently stored in the compiler
   information (via <ENTER>, then <ESCAPE>)

4. If you now load a .Java file, fill in some program code for Java,
   for example type or copy this text in a file 'HelloWorld.jav'

    public class HelloWorld {
     public static void main( String[] args ) {
      System.out.println( "Hello World" );
     }
    }

   save that text in your TSE directory,
   then press <CTRL><F9> or <ESCAPE><M><C> to compile, this will run 
that
   batch file, which runs Java.exe and javac.exe with your file as 
parameter

---
---

Internet: see also:

Computer: Wordprocessor: TSE: Language: Computer: Compile: Run: 
Overview
http://www.faqts.com/knowledge_base/view.phtml/aid/24311/fid/895

----------------------------------------------------------------------