[Jprogramming] detecting j on windows

Oleg Kobchenko olegykj at yahoo.com
Tue Jul 7 15:42:57 HKT 2009


.NET and COM find COM components through none other than
the registry. They ain't called registered for nothing.
Search regedit for JEXEServer. It's going to be the ProgID,
which will also have a CLSID, which in turn will have the
location of the EXE file in Local Server.
(Or so, I write from memory.)



> From: Alex Rufon <alex_rufon at ist-systems.com>
> 
> Hi. 
> 
> If you need to detect J on windows using .NET code, I usually do it this way,
> 
> 1. Create an instance of J and try to send or execute any command there.
> 2. Enclose the code in a try ... catch and handle the error.
> 
> The following example code does exactly that. I have a wrapper class called 
> J.Session() which is a .NET wrapper to J.EXE, if any of the methods fail, it 
> would assume that J is in the current directory and try to register it. You can 
> use any other method of finding out where J is though.
>         Try
>             'What we do is we try to make an instance of jSession and close it 
> immediately
>             jSession = New J.Session(False)
>             'Execute a magic number
>             jSession.variable("WIFE", "Vilma")
>             jSession.eval("temp=. i. 42")
>             'If we got here, J is properly installed
>             jSession.Dispose()
>         Catch ex As Exception
>             'Were here so that means J is not properly installed
>             returnValue = False
>             If (register) Then
>                 'We start by getting the application path
>                 appPath = 
> System.Reflection.Assembly.GetExecutingAssembly.Location
>                 appPath = System.IO.Path.GetDirectoryName(appPath)
>                 'We now register the library
>                 Shell(appPath + "\j.exe /regserver", AppWinStyle.NormalNoFocus, 
> True, -1)
>             End If
>         End Try
> 
> For more info on the J.NET wrapper class, go to: 
> http://www.jsoftware.com/jwiki/Guides/J%20VB.NET
> 
> -----Original Message-----
> From: programming-bounces at jsoftware.com 
> [mailto:programming-bounces at jsoftware.com] On Behalf Of Jack Andrews
> Sent: Tuesday, July 07, 2009 9:38 AM
> To: Programming forum
> Subject: Re: [Jprogramming] detecting j on windows
> 
> >> > dir "%APPDATA%\Microsoft\Windows\Start Menu\Programs\j*"
> >
> > I guess you already got a solution.  What's wrong with it?  Or you
> > prefer the J installer to add that to %PATH% automatically?
> 
> nothing wrong with it.  i just posted that solution for the benefit
> of future readers of this thread.
> 
> while on the topic of %PATH%, it seems the equivalent of unix's
> /usr/bin is c:\windows\system32.  i've been considering using
> the system32 dir as an install location in the way unix dumps
> binaries in /usr/bin.   no problems with %PATH% then :)
> 
> examples of exe's in system32:
>   calc.exe
>   ftp.exe
>   java.exe
>   notepad.exe
>   mspaint.exe
> 
> 
> ta, jack
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm



      


More information about the Programming mailing list