3

Suppose I enter the following (edited) snippet of code into Mathematica.

manip = Manipulate[x, {x, 0, 1}];
nb = Developer`UseFrontEnd[
    CreateDocument[manip, ShowCellBracket -> False, 
    Visible -> False]];
nbTest = ExportString[nb, "NB"] =!= $Failed;
cdfTest = ExportString[nb, "CDF"] =!= $Failed;
version = First[StringSplit[SystemInformation["Kernel", "ReleaseID"]]];
{{nbTest, cdfTest},version}

I find that both nbTest and cdfTest are True. If I run the same command from within webMathematica, nbTest is True but cdfTest is False. You can see that result here:

http://www.cs.unca.edu:8082/webMathematica/generateCDF.jsp

You can see the code that generates that result here:

http://www.cs.unca.edu:8082/webMathematica/generateCDF.jsp.txt

I have searched the security configuration of webMathematica to find a way to enable CDF export but have found none. Does anyone know a way to enable this? Of course, it might be disabled in this context intentionally.

My intention is to serve CDF documents generated dynamically from a JSP page accessed via an HTML form. This should allow nice CDF interaction in conjunction with textual input.

Edit: I've updated the version of Mathematica on our server and updated the code above so that the full version string appears. Thus, we can see that it is version 8.0.1. The problem persists.

Verbeia
  • 4,400
  • 2
  • 23
  • 44
Mark McClure
  • 4,862
  • 21
  • 34
  • Are you sure your webMathematica is the same version (presumably 8)? – ragfield May 03 '11 at 23:32
  • I get _ExportString::format: "CDF"is not a recognized ExportString format."_ in Mma 8.0.0 standard frontend – Dr. belisarius May 04 '11 at 02:47
  • @belisarius No errors for me on mma 8.01 win7-64. Perhaps this is, as @Ragfield suggests, a difference issue between 8.00 and 8.01? I don't have webMMA, so can't test that. – Sjoerd C. de Vries May 04 '11 at 10:28
  • Thank you all for your comments. In fact, belisarius is correct that CDF export really appears for the first time in V8.0.1 and the link I point to in my original post uses V8.0.0 - I'll update that soon. However, I can run webMathematica on my local machine and access Mathematica via localhost/webMathematica and the problem persists. In that case, I'm not just running the same version of Mathematica but actually the exact same copy of Mathematica. – Mark McClure May 04 '11 at 12:35
  • Post is now edited to reflect update to version 8.0.1 of Mathematica. – Mark McClure May 04 '11 at 17:41

1 Answers1

4

Mark,

Could you try wrapping the ExportString[ ..., "CDF" ] in UsingFrontEnd and see if that helps?

C:\Users\arnoudb>math.exe
Mathematica 8.0 for Microsoft Windows (64-bit)
Copyright 1988-2011 Wolfram Research, Inc.

In[1]:= nb = CreateDocument[ Manipulate[x,{x,0,1}] ] // UsingFrontEnd

Out[1]= -NotebookObject-

In[2]:= ExportString[ nb, "CDF" ]

FrontEndObject::notavail:
   A front end is not available; certain operations require a front end.

Export::nofe: A front end is not available; export of CDF
     requires a front end.

Out[2]= $Failed

In[3]:= ExportString[ nb, "CDF" ] // UsingFrontEnd // Head

Out[3]= String

In[4]:= $Version

Out[4]= 8.0 for Microsoft Windows (64-bit) (October 7, 2011)

In[5]:= $ReleaseNumber

Out[5]= 4
Arnoud Buzing
  • 15,383
  • 3
  • 20
  • 50