System/Starting J

From J Wiki
Jump to navigation Jump to search

Command line parameters

The J Front End puts the command line parameters in ARGV_z_. Some parameters affect JFE actions and others affect profile actions. With -jprofile and -js parameters you can start J in various ways.

In the following J is a JFE, F is the name of a script, A is 0 or more additional parameters:

J               - load profile
J F A           - load profile; profile loads F

J -jprofile     - no profile
J -jprofile F A - load F (special profile)

J -js A         - load profile
                  profile sets ARGVVERB_z_ from A and runs it

Parameters that apply only to jconsole; these will not appear in ARGV_z_:

-lib JE - path to alternate JE
-prompt - force prompt (avoid isatty test)

Examples with -js:

jconsole -js a=.23 b=.3 "echo a*b"
jconsole -js a=.23 b=.3 "echo a*b" "exit''"

Initialization sentence

JFE runs a first sentence that defines BINPATH_z_ and ARGV_z and performs other required initialization (such as loading the J profile).

BINPATH_z_ is set as the full path to the J bin folder.

ARGV_z_ is set as list of boxed string parameters from the command line.

The load of a script is done with an unnamed verb (3 : '0!:0 y') so that =. is local to the verb.

The sentence always ends with:

[A[B indicates this standard ending in the following examples.

Without -jprofile the first sentence has the form:
(3 : '0!:0 y')<BINPATH,'\profile.ijs'[A[B

With -jprofile F:
(3 : '0!:0 y')2{ARGV[A[B

Jconsole with just -jprofile:
i.0 0[A[B

Profile sequence

JFE loads the profile which in turn loads several other files to initialize your J session. The foreign 4!:3 returns script names in the order they were loaded. This can be a powerful tool in understanding the initialization process.

Start Jconsole and see what scripts are loaded.


Profile errors

JFE loads profile.ijs which in turn loads several other scripts. A profile error can be difficult to debug.

In jconsole you see the error but have no information on which script has the error.

In a gui JFE there probably isn't even an ijx window to show the error.

Debugging profile errors can be difficult, but the following steps may help.

1. Start jconsole with -jprofile. This will give a bare bones ijx window in which to track down the error.

2. BINPATH_z_ is the full path to the profile.ijs to load. First make sure that it exists.


3. Define DisplayLoad_j_ as 1 before loading profile so that scripts are reported as as they are loaded.


4. Use a text editor to examine the script with the error and fix it.