Mathematica 9 is now available
Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2006

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

Search the Archive

Problem creating image file via J/Link

  • To: mathgroup at
  • Subject: [mg70108] Problem creating image file via J/Link
  • From: "Neil M" <anilm411 at>
  • Date: Wed, 4 Oct 2006 05:58:46 -0400 (EDT)


For some reason, the very simple J/Link code segment:

      <get kernel link stuff here>
       byte[] gifData = ml.evaluateToImage("Plot[Sin[x],{x,0,2
Pi}]",0,0,0, false);
        try {
            FileOutputStream s = new FileOutputStream(new
        } catch (IOException e) {System.out.println("Failed to open

creates a graphics file "foo.gif" with nothing in it except the text

I attached a packet listener to see what was happening and it produced
this little nugget:

Packet type was ReturnPacket. Contents follows.
"In[1]:= "
Packet type was ReturnPacket. Contents follows.

I tried another route. Created a little stub routine Test.m which had
the function:
disFig[] := [<stuff>
                  Display["foo.gif", Plot[Sin[x], {x, 0, 2 Pi}], "GIF"]
Then I called Test.m in a J/Link program via the lines:

Same result: A file foo.gif with only the line "In[1]:=".
Any ideas on what's going wrong? 


  • Prev by Date: Re: Bessel K expansion, large argument?
  • Next by Date: Re: Draw approximated normal distribution based on mean, median, percentiles?
  • Previous by thread: Re: Program to add continued fractions with polynomial partial quotients
  • Next by thread: Re: Problem creating image file via J/Link