Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2003
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2003

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

Search the Archive

Java prog opens nb in Mathematica frontend which prompts for input - fails in background

  • To: mathgroup at smc.vnet.net
  • Subject: [mg39491] Java prog opens nb in Mathematica frontend which prompts for input - fails in background
  • From: Knud Steven Knudsen <ksk at ieee.org>
  • Date: Wed, 19 Feb 2003 04:42:25 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,

I apologize for the rather complicated subject; it's a problem that's
hard to describe...

I have a Java program that links to Mathematica to start up a notebook. The Java
program is acting as a project manager for legacy Mathematica notebooks. When a
user creates a new project using the Java program, it links to Mathematica,
creates and evaluates a temporary notebook (I like the notebook since
then I have a hard-record to look at if something goes wrong...). As
part of the temporary notebook evaluation, a custom function is called
which prompts for user input.

The problem arises the first time the link is made to Mathematica from the Java
program. 

When I first start the Java program, it links immediately to Mathematica and
opens and executes an initialization notebook using the front end
(UseFrontEnd[]). Thus, Mathematica is running in the background.

Then, if I initiate a new project in the Java program, it should talk to
Mathematica and create and execute the aforementioned temporary notebook. I can
see it create the notebook, select all its cells and try to evaluate
them, but I don't see the input prompt.

However, if I start the Java program and, before initiating a new
project, I bring Mathematica to the foreground and then switch back to the Java
program, I can initiate a new project and get the input prompt to come
up. After that, I can repeat the project initiation steps and have
success regardless of "how far in the background" Mathematica is put.

Does this sound familiar to anyone? I suspect that I have some kind of
blocking IO call. It's interesting in the failure scenario that it
doesn't matter if I then bring Mathematica to the foreground and try again to
initiate a project, it will never work... no matter what I do.

One possble solution would be to have my Java program bring Mathematica to the
foreground right after the initial kernel link is made. This seems
kludgey and may be a problem under different OSes. 

BTW, I'm running Mathematica 4.1 under Win2K. JDK1.3.x.

thanks

-- 
Knud Steven Knudsen <ksk at ieee.org>


  • Prev by Date: Re: Trouble with Integrate
  • Next by Date: Re: Simplify a module
  • Previous by thread: Re: Re: Porting graphics to MicroSoft Point, with quality - no
  • Next by thread: EMM Mathematica code