MathGroup Archive 2002

[Date Index] [Thread Index] [Author Index]

Search the Archive

JLink problem

  • To: mathgroup at smc.vnet.net
  • Subject: [mg38433] JLink problem
  • From: "Steven Hodgen" <steven at twitch.net>
  • Date: Sun, 15 Dec 2002 02:09:56 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

I'm trying to get JLink working and am having some difficulties.  I need to
change the CommandLine property for InstallJava[], and I wanted to set it up
so it did it automatically.  In the Help it says to add a SetOptions[] to
the init.m file.  I tried adding the code it suggests:

<<JLink`
SetOptions[InstallJava, CommandLine->"mypath"]

but it doesn't work.  If I add this line in an external editor, I get an
error when I run Mathematica.  If I open the init.m file in Mathematica, it
just doesn't stick.  The init.m file has a huge giant SetOptions in it.  In
fact, that's all it is is one big SetOptions call.  Am I supposed to add my
option to that call?  If so, how.  The format of the SetOptions[] in the
init.m file looks very different.  Everything is enclosed in double quotes,
including what looks like the property names.  Here's the first few lines:

SetOptions[$FrontEnd,
NotebookDirectory:>FrontEnd`FileName[{$RootDirectory, "C:", "Documents and \
Settings", "steven", "Application Data", "Mathematica", "FrontEnd"}, \
CharacterEncoding -> "WindowsANSI"],
AutoOpenPalettes->{"BasicInput.nb", "AlgebraicManipulation.nb"},
AutoOpenNotebooks->{},
ScreenRectangle->{{0, 1024}, {0, 721}},
NotebooksMenu->{

If I need to add my option change in here, where should I put it.  This
SetOptions[] is so complex it's hard to see where one thing starts and
another end, especially since I'm so new to Mathematica.  Also, where do I
put the "<<JLink`" statement?  If I add it at the top, it just dissapears
next time I load Mathematica.

The instructions in the help are so short and not much help.  Here they are:

If you determine that you need to use any of the options to InstallJava on a
regular basis, you should put a SetOptions command in your Mathematica
init.m file. Not only is this a convenience to you (you do not have to
always remember and type the values), but more importantly it is required
for you to use packages written by others that make use of J/Link. This is
because developers need to call InstallJava in their code, but they cannot
know what options their users need. Some users will be using jre, others
java, others Microsoft's jview, and so on. Simply put, anyone writing code
for a wide audience of users must call InstallJava with no arguments and
require that their users have used SetOptions ahead of time to configure
InstallJava appropriately. Here are example lines for an init.m file for a
Windows user who wants to use the Microsoft Java runtime:

-------------
<<JLink`
SetOptions[InstallJava, MicrosoftJava->True]
----------------

How can I make this happen?

Thank You!

--
Steven Hodgen
steven at twitch.net




  • Prev by Date: Re: More about ellipse and circle intersection
  • Next by Date: Re: Re: Re: Why can't Mathematica find this root?
  • Previous by thread: Determining the size of text in graphics
  • Next by thread: Re: JLink problem