Changeset 10228


Ignore:
Timestamp:
10/25/05 14:52:53 (16 years ago)
Author:
piso
Message:

Work in progress.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/j/src/org/armedbear/lisp/tests/jl-config.cl

    r10177 r10228  
     1;; $Id: jl-config.cl,v 1.2 2005-10-25 14:52:53 piso Exp $
    12
    2 ;; $Id: jl-config.cl,v 1.1 2005-10-22 12:15:14 piso Exp $
     3(in-package :cl-user)
    34
    4 (in-package :user)
     5(setf javatools.jlinker:*jlinker-java-home*
     6      #+linux "/home/peter/blackdown/j2sdk1.4.2"
     7      #+mswindows "C:\\Program Files\\Java\\jdk1.5.0_05")
    58
    6 ;;;
    7 ;;; SAMPLE FILE with DUMMY values to be customized for each site
    8 ;;;
    9 ;;; The purpose of this file is to set some configuration variables
    10 ;;; used by jLinker.  These variables are required ONLY if Java is
    11 ;;; started from Lisp with a call to (jlinker-init [:start] ... ).
    12 ;;; If the Java application is started some other way, this file
    13 ;;; may be safely ignored.
    14 ;;;
    15 ;;;??? marks places that MUST be customized
    16 
    17 
    18 ;;;??? - Comment out the following statement in the customized
    19 ;;;       copy of this file.
    20 ;;(error "This file must be renamed and customized before it can be used")
    21 
    22 (eval-when (compile load eval) (require :jlinker))
    23 
    24 ;; The variable javatools.jlinker:*jlinker-java-home* must be set to
    25 ;; the directory (folder) where Java is installed.
    26 ;;
    27 ;; Expected value of this symbol:
    28 ;;
    29 ;; string -> Path namestring of Java home directory
    30 ;;           jLinker will construct a suitable value for PATH
    31 ;;           and for CLASSPATH
    32 ;;
    33 ;; nil    -> jLinker makes no modifications to PATH or CLASSPATH
    34 ;;           User must make sure that the file jlinker.jar is
    35 ;;           visible to Java.
    36 
    37 ;;;??? - Modify the following expression to set an appropriate value.
    38 ;;       Use one (and only one) of case A or case B.
    39 ;; Case A: You are the only user of jLinker and jLinker will be only
    40 ;;         be used on one machine.
    41 ;;      Step A.1: Modify the string "???" to the path of the Java
    42 ;;                installation in your machine.
    43 ;;      Step A.2: Uncomment the next line.
    44 (setf javatools.jlinker:*jlinker-java-home* "/home/peter/blackdown/j2sdk1.4.2")
    45 ;;      Step A.3: Skip forward to the line ;; Set *jlinker-run-java*
    46 
    47 
    48 
    49 ;; Case B: If jLinker must run on several different machines with different
    50 ;;         Java configurations, the following expression allows one
    51 ;;         jl-config.cl file to be used on all the machines.
    52 ;; If using Case B, comment out the following (#+...) line
    53 #+ignore
    54 (setf javatools.jlinker:*jlinker-java-home*
    55       (case
    56 
    57     ;; normalize the machine name to a keyword
    58     ;; in the current readtable case
    59     (read-from-string
    60        (concatenate 'string ":" (string-downcase (short-site-name))))
    61 
    62 ;;;???(Case B only)  Insert your own machine names here.
    63 
    64   (:proa       "c:\\Franz\\Java\\jdk150")
    65   (:foray     "/usr/java/j2sdk1.4.2_06")
    66   (:gazelle   "/usr/java/j2sdk1.4.2_06")
    67   (:edge      "/usr/j2sdk1.4.2_06")
    68   (:blade     "/usr/j2sdk1.4.2_06")
    69   (:hobart     "c:\\j2sdk1.4.2_04")
    70   (:corba      "/b/jdk1.1.6")      ;; pre 7.0
    71   (:spot       "/usr/j2se-1.3.1")  ;; pre 7.0
    72   (:cobweb     "/usr/java/jdk1.3.1")
    73   (:killer     "/usr/java/jdk1.3")  ;; pre 7.0
    74 
    75   ;; The value "" implies that java is already in the path
    76   ;;  the current directory will be added to CLASSPATH.
    77   ;; The value NIL implies that both path and CLASSPATH
    78   ;;  are preset correctly outside this script.
    79   (otherwise   "")
    80   )
    81       )
    82 
    83 
    84 
    85 ;; Set *jlinker-run-java*
    86 ;;
    87 ;; The variable javatools.jlinker:*jlinker-run-java* must be set to the
    88 ;; name of the function that will be used to start Java.  The default
    89 ;; setting suggested below should be adequate for most installations.
    90 ;;
    91 ;; Expected value of this symbol:
    92 ;;
    93 ;;  symbol -> The name of a function of at least five (5) optional arguments.
    94 ;;            The default value shown below is a function included
    95 ;;            with jLinker.  This value can also be replaced with
    96 ;;            the name of a suitable user-written function.
    97 ;;  other  -> Error
    98 ;;
    99 ;;;??? - Modify the following statement if the default function is not
    100 ;;;       suitable for running Java in your installation.
    1019(setf javatools.jlinker:*jlinker-run-java* 'javatools.jlinker::run-java)
    102 
    103 
    104 
    105 ;; jLinker default settings
    106 ;;
    107 ;; The following variables have default values that may be changed
    108 ;; to suit special situations (such as heavy debugging).  The symbols
    109 ;; are described in more detail in the reference manual.
    110 ;;
    111 ;;(setf javatools.jlinker:*jlinker-error-p* t)            ;; default is nil
    112 ;;
    113 ;;(setf javatools.jlinker:*jlinker-verbose* t)            ;; default is nil
    114 ;;(setf javatools.jlinker:*jlinker-debug* t)              ;; default is nil
    115 ;;(setf javatools.jlinker:*jlinker-retry-number* 3)       ;; default is 3
    116 ;;(setf javatools.jlinker:*jlinker-retry-delay*  5)       ;; default is 5
    117 
    118 
    119 
    120 ;; The following variable is used only in Unix implementations.
    121 ;; When t, Java is started directly, without invoking a shell (and
    122 ;; shell profile).  In general, this is a good idea because it avoids user
    123 ;; shell profiles when we call Java (after setting up path and CLASSPATH).
    124 ;;(setf javatools.jlinker:*jlinker-unix-vector-p* t)        ;; default is t
    125 
    126 
    127 
    128 
    129 
    130 
    131 
    132 ;; The code for javatools.jlinker::run-java is included below as a
    133 ;; sample that can be renamed and  modified to satisfy the
    134 ;; requirements of a particular installation.
    135 #|
    136 
    137 (defun run-java (&optional debug lport lhost jport jhost &rest more)
    138   (let* ((op-val #+unix      "java"
    139      #+mswindows
    140      (if* (not debug)
    141           then "javaw.exe"
    142           elseif (excl::ms-win95-p)
    143           then "command.com /c start /wait /b java.exe"
    144           else "cmd.exe /c start /wait /b java.exe")
    145      )
    146    (*print-circle* nil) ;;; dont bother showing shared strings...
    147    (*print-level* nil)
    148    (*print-length* nil)
    149    (class javatools.jlinker::*java-link-base-class*)
    150    (cmdl (append (list op-val)
    151            (and more (consp (first more))
    152           (eq :options (first more))
    153           (mapcar #'(lambda (m) (format nil "~A" m))(cdr (pop more))))
    154            (list class)
    155            (when lport (list "-lport" (format nil "~D" lport)))
    156            (when lhost (list "-lhost" lhost))
    157            (when jport (list "-jport" (format nil "~D" jport)))
    158            (when jhost (list "-jhost" jhost))
    159            (when debug (list "-debug"))
    160            (mapcar #'(lambda (m) (format nil "~A" m)) more)
    161            ))
    162    (command
    163     #+mswindows (format nil "~{~A ~}" cmdl)
    164     #+unix
    165     (if *jlinker-unix-vector-p*
    166         (make-array (1+ (length cmdl))
    167         :initial-contents (cons (car cmdl) cmdl))
    168       (format nil "~{~A ~}" cmdl))
    169     )
    170    (log
    171     #+mswindows (and debug (jlinker-slot :java-out)
    172          (concatenate
    173           'string (jlinker-slot :java-out) ".log"))
    174     #+unix nil
    175     )
    176    (elog (when log
    177      (concatenate 'string (jlinker-slot :java-out) "e.log")))
    178    (show (if (and debug (null log)) :showna :hide))
    179    )
    180     (set-java-paths)
    181     (when log (jlinker-slot :java-out :wrap))
    182     (jcollect-pid
    183    command
    184    :output log
    185    :if-output-exists :supersede
    186    :error-output elog
    187    :if-error-output-exists :supersede
    188    :show-window show
    189    :wait nil)))
    190 
    191 (defun jcollect-pid (&rest args)
    192   (multiple-value-bind (rc x pid)
    193       (apply #'run-shell-command args)
    194       (declare (ignore x))
    195       (if pid
    196     (jlinker-slot :pid pid)
    197   rc)))
    198 
    199 (defun set-java-paths ()
    200   (let* ((delim #+mswindows "\\" #+unix "/")
    201    (break #+mswindows ";" #+unix ":")
    202    (jhome *jlinker-java-home*)
    203    #+ignore class
    204    oldcp
    205    path)
    206     (when (and jhome (file-directory-p jhome))
    207       (when (equal jhome "") (setf jhome "."))
    208       (setf (sys:getenv "JAVA_HOME") jhome)
    209 
    210       #+ignore (setf class (sys:getenv "CLASSPATH"))
    211       #+ignore (if (or (null class) (equal class ""))
    212        (setf class "")
    213      (setf class (concatenate 'string class break)))
    214 
    215       (setf oldcp (sys:getenv "CLASSPATH"))
    216       (when (or (null oldcp) (equal oldcp "")) (setf oldcp ""))
    217       #+mswindows (when (eql 0 (search "\"" oldcp))
    218         (setf oldcp (subseq oldcp 1 (1- (length oldcp)))))
    219       (or (and oldcp (search "jlinker.jar" oldcp))
    220     (setf (sys:getenv "CLASSPATH")
    221     (apply #'concatenate 'string
    222            #+ignore class
    223            "." delim break
    224            "jlinker.jar"
    225            ;;break jhome delim "lib"
    226            (when oldcp (list break oldcp))
    227            )))
    228       (or (and (setf path (sys:getenv "PATH"))
    229          (search jhome path))
    230     (setf (sys:getenv "PATH")
    231     (concatenate 'string jhome delim "bin" break path))))))
    232 
    233 |#
    234 
    235 
    236 
    237 
Note: See TracChangeset for help on using the changeset viewer.