Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I am facing a problem in loading the package. My code is working in Mathematica but after deploying it into CDF, it is unable to load the package and shows error.

The code was not even working in Mathematica when I evaluated it for the first time but when I evaluated it one more time it worked.

I got help from this stackexchange question

And now it is working in Notebook but not in CDF, after relaunching the Mathematica Kernel.

share|improve this question

1 Answer 1

As I understand, three things are needed:

  • Explicitly list the contexts of the functions that are in the package. For example, if you are using the function f in package test call it test`f[] instead of just f[].

  • Call Needs on the package inside the initialization option for the Manipulate that makes up your CDF. I would recommend calling needs with the syntax that gives the full file path to the package. For example: Initialization->{Needs["Plambda","filepathhere"]}`

  • Place the package inside the installation directory for CDFPlayer under AddOns\Applications. For example under windows:

    C:\Program Files\Wolfram Research\Wolfram CDF
    Player\8.0\AddOns\Applications
    

My honest recommendation is that you create a simple example package and CDF and try to get this to work before getting a real world example working. The example will be much easier to debug and think about.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.