Joey and all Unix gurus,
Background is that I wante J Unix install to be able to work as follows:
1. everything (JFE, JE, etc.) in the J folder
2. no sudo move of anything elsewhere
3. no admin/root privilege required
4. no environment variables used or required
This requires the JFE to be able to find find the J folder so that it can
then load the JE and profile.ijs etc.
Windows has an API call that returns the fullpath to the JFE executable and
everything is easy.
In Unix I can't find an equivalent and instead have code that tries to
determine the J folder from ARGV[0]. This mostly works but requires some
messy stuff such as resolving ./ and ../ in ARGV[0]. It doesn't work for
hardlinks. I thought it worked for symlinks (by using readlink). But
symlinks don't work if they are found by being on the PATH. And since
symlinks are most usefull if they are in PATH this is big problem.
The trouble is that if jxx is a symlink on PATH then if it is invoked with
just its name ARGV[0] is just jxx. Currently the code doesn't know how to
get from just jxx to the fullpath to the J folder. The first step would be
something like which to find the full name of jxx and then to use readlink.
But this isn't at all nice.
Right now I am stumped. Is there a way in UNIX to know the full path to the
program that is running? Is there an easy way (C library call, not use of a
proram like which which can be aliased and otherwise messed with) to find
the full path to a name that is on PATH?
If there is no solution, is it acceptable to say symlinks don't work and
require a shell script that provides a fullpath so the program can get the J
folder from ARGV[0]?
----- Original Message -----
From: "Joey K Tuttle" <[EMAIL PROTECTED]>
To: "Beta forum" <[email protected]>
Sent: Sunday, September 30, 2007 2:33 PM
Subject: Re: [Jbeta] J602 installation
BUT that's what I'm saying - I agree about not putting j602 in
PATH and all of J in its own folder is ideal (and BTW makes it
look like standard OS X applications).
My complaint is that I don't want my "short name" or "alias"
i.e. symlink, to have to reside in my current working directory
(which would mean that I needed to make one in lots of places).
e.g.
iMg5:~ jkt$ ln -s /usr/local/lib/j602/jconsole jxx
iMg5:~ jkt$ ls
Desktop Documents Library Magazines
Movies Music Pictures Public
Sites jxx
iMg5:~ jkt$ ./jxx # annoying to have to use ./
i. 2 3
0 1 2
3 4 5
exit 0
While that works as you say - surely you can agree that
putting the short name (symlink) in one place (such as
/usr/local/bin/) which is in my PATH would be a nicer
solution than putting the name in every directory I might
use - annoying even/especially in directories created for
a short project. Not to mention that I have to use ./jxx
rather than just jxx (taking advantage of the fact that
some trust is given to executables in a common place
such as /bin (or /j602 if in an explicit path).
- joey
At 14:01 -0400 2007/09/30, Eric Iverson wrote:
Although my examples used fullpaths I did so only to try to make things
clearer. I believe the things I showed would work with symlink or the
shell script located somewhere in $PATH . Then you could just use the
names jsymlink and jsymlinkjpwd anywhere and get jconsole running with
either the current folder or the J folder.
I would say don't put .../j602 into $PATH. There is no need and it can
create other problems (conflicts with other jconsole programs for
example).
Just put all of J in its very own folder. Then use normal Unix stuff to
invoke it. This includes symlinks with fullpaths and shell scripts.
I am not very familiar with the use of alias but can't see why they won't
work or compliate things.
----- Original Message ----- From: "Joey K Tuttle" <[EMAIL PROTECTED]>
To: "Beta forum" <[email protected]>
Sent: Sunday, September 30, 2007 1:24 PM
Subject: Re: [Jbeta] J602 installation
Re: Unix shell install.
I think that seems more in line with the intent to be more
portable, even allowing copy to a USB memory stick.
-- regards earlier remarks --
But having to include a full path to invoke JFE seems too
arduous. What changed is that in the past I put an alias
for JFE in my bin directory which is in $PATH -- now, even
if I put .../j602/ in my $PATH variable, it doesn't work
to use a short alias.
Amusing side effect of trying - even with .../j602/ added
to my PATH, invoking jconsole gets sun.java.Jconsole.
For things like CGI scripts, editing all of them to include
an absolute path is painful. In recent releases, I maintained
3 aliases ja for production, jo for previous release, and jb
for active beta test. Admittedly, if I wanted to test a CGI
script with jb, I had to edit the script. But when the stable
release was announced, I could change the links the aliases
represented and existing scripts would use the new system.
The only solution I've thought of (as shown way below) is
to put cover scripts in my .../bin/ but then I don't know
how to pass in parameters such as -jprofile and -jnew ...
At 10:33 -0400 2007/09/30, Eric Iverson wrote:
I have been thinking about the various suggestions on the Unix shell
install. I am considering changes along the following lines and am
interested in your comments.
~/temp/j602abeta_linux32.bin
Run again with -install argument to install: jsoftware/j602
The install is in folder: /home/eric/jsoftware/j602
After the install you can rename or move the jsoftware/j602 folder.
~/temp/j602abeta_linux32.bin -install
Installation finished in: /home/eric/jsoftware/j602
Read jwd for jwd trouble shooting.
Run J console (ctrl+d exits) or J GUI with commands:
...\>"/home/eric/jsoftware/j602/jconsole"
...\> "/home/eric/jsoftware/j602/jwd"
----- Original Message ----- From: "Eric Iverson"
<[EMAIL PROTECTED]>
To: "Beta forum" <[email protected]>
Sent: Sunday, September 30, 2007 10:02 AM
Subject: Re: [Jbeta] J602 installation
I don't think this has changed between 601 and 602.
Sometimes one wants jconsole to run in the current working directory.
This is the default and is the same in J601 or J602.
Starting jconsole doesn't do a cd and if you want one you have to do it
explicitly. A symlink to jconsole starts jconsole in the current folder
as no cd is done.
If you want to start jconsole with the J directory as the pwd then you
need to explicitly do a cd. There are several ways but perhaps the
easiest is
sketched out below (jsymlinkx script defined with cat or whatever):
cd ~
ln -s ~/jsoftware/j602 jsymlink
cat jsymlinkjpwd
cd ~/jsoftware/j602
~/symlink "$@"
./jsymlink
2!:0'pwd'
/home/eric
ctrl+d
./jsymlinkjpwd
2!:0'pwd'
/home/eric/jsoftware/j602
ctrl_d
jwd does an explicit cd to the J diretory. This is because this is the
case in windows and most casual use of jwdp assumes this. The cd isn't
required and running j.jar without it will start J with the current
directory which is useful if the pwd is an argument to what you want to
do.
----- Original Message ----- From: "Joey K Tuttle" <[EMAIL PROTECTED]>
To: "Beta forum" <[email protected]>
Sent: Sunday, September 30, 2007 3:32 AM
Subject: Re: [Jbeta] J602 installation
OK - I am dense and/or stubborn...
I have read and tried various things with little happiness.
What I want to be able to do is be in a working directory
(terminal session) and invoke jconsole (or jwd) and have
the j session in pwd. e.g.
iMg5:~ jkt$ cd Music
iMg5:~/Music jkt$ pwd
/Users/jkt/Music
iMg5:~/Music jkt$ ls -l
total 0
drwxr-xr-x 7 jkt jkt 238 Sep 29 21:05 iTunes
drwxrwxrwx 7 jkt jkt 238 Sep 2 2005 iTunes 2002.02.16
iMg5:~/Music jkt$ ja
host 'ls -l'
total 0
drwxr-xr-x 7 jkt jkt 238 Sep 29 21:05 iTunes
drwxrwxrwx 7 jkt jkt 238 Sep 2 2005 iTunes 2002.02.16
host 'pwd'
/Users/jkt/Music
version ''
Binary: j601binc_darwin_powerpc
Library: j601libc
Help: j601hlpc
Engine: j601/2006-11-17/17:05
ProductName: Mac OS X
ProductVersion: 10.4.10
BuildVersion: 8R218
java version "1.5.0_07" Java(TM) 2 Runtime Environment, Standard
Edition (build 1.5.0_07-164) Java HotSpot(TM) Client VM (build
1.5.0_07-87, mixed mode, sharing)
---
In the past, I did this with a sym link of /usr/local/bin/ja
to jconsole - but in j602 that doesn't work. I rather object
to having to use:
iMg5:~/Music jkt$ /usr/local/lib/j602/jconsole
host 'pwd'
/Users/jkt/Music
or for that matter /User/jkt/jsoftware/jconsole
....
If I create a /usr/local/bin/script such as the following:
iMg5:~/Music jkt$ cat /usr/local/bin/jbeta
#!/usr/local/lib/j602/jconsole
iMg5:~/Music jkt$ jbeta
host 'pwd'
/Users/jkt/Music
Then I get part way back to what I had in j601 - but I have
lost the ability to pass in parms and file arguments... If
I use a shell script such as:
iMg5:~ jkt$ cat /usr/local/bin/jb
#! /bin/bash
/usr/local/lib/j602/jconsole $*
Then I can pass in file names, but I don't know how to invoke
a parameter e.g. -jconsole is there a way?
I can't think of a way to do what I want with jwd (i.e. start
j.app in some directory other than the installation one) - is
there a way?
Some of these issues are most important in CGI scripts (or at
least will take considerable rethinking there) I don't believe
my current ways of setting up Apache will work at all with j602
but maybe Oleg or someone can suggest better ways than I am
currently doing it.
- joey
At 12:31 -0400 2007/09/29, Eric Iverson wrote:
J602 does not use JPATH... env var.
Please read Help|Release Hightlights and Help|User Manual|J602
Install for more information.
Short answer is that J602 JFE finds the J directory that contains the
JFE and then requires everything to be there (JFE, JE, profile.ijs,
etc).
Hardlinks to the JFE are not supported and symlinks to the JFE must
be absolute paths.
----- Original Message ----- From: "Joey K Tuttle" <[EMAIL PROTECTED]>
To: "Beta forum" <[email protected]>
Sent: Saturday, September 29, 2007 12:00 PM
Subject: Re: [Jbeta] J602 installation
Actually, sigh, I spoke too soon. What really happened
was that it worked fine while my working directory was
/usr/local/lib/j602 - from any other directory, I got:
iMg5:~ jkt$ jb
Load library /Users/jkt/libj.dylib failed.iMg5:~ jkt$
Even worse, I can't find a way to correct it. In past
releases I set /etc/bashrc to look like:
iMg5:~ jkt$ cat /etc/bashrc
# System-wide .bashrc file for interactive bash(1) shells.
if [ -n "$PS1" ]; then PS1='\h:\w \u\$ '; fi
# Make bash check it's window size after a process completes
shopt -s checkwinsize
if ! echo $PATH | /usr/bin/grep -q "/usr/local" ; then
PATH=$PATH:/usr/local/bin/
fi
# For J users in bash
JPATHj602="/usr/local/lib/j602/"
JPATHj601="/usr/local/lib/j601/"
JPATHj504="/usr/local/lib/j504/"
export PATH JPATHj601 JPATHj504 JPATHj602
and while it works for j601 and j504, no joy with j602.
- joey
----
At 20:29 -0700 2007/09/28, Joey K Tuttle wrote:
I should have added that on my third installation
(into /usr/local/lib/) things worked very nicely
and a symbolic link in /usr/local/bin works "out
of the box" (except for my missing personal profile).
This is a very nice improvement - thanks.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm