Re: Getting Workbench to Work
- To: mathgroup at smc.vnet.net
- Subject: [mg99677] Re: Getting Workbench to Work
- From: Hannes <HannesKessler at hushmail.com>
- Date: Mon, 11 May 2009 06:22:31 -0400 (EDT)
- References: <gu3as0$t7t$1@smc.vnet.net>
Hello Karsten, from what you write it seems that your example would not run even outside the Workbench. Try the following to load a function with Needs ["myTest`myPackage`"] from your personal Applications directory: 1. Set your environment variable MATHEMATICA_USERBASE to C:\local\Mma (you did that already) 2. Create a directory C:\local\Mma\Applications 3. Create a directory C:\local\Mma\Applications\myTest 4. Create a notebook C:\local\Mma\Applications\myTest\myPackage.nb 5. Write your package code in the notebook myPackage.nb, for example BeginPackage["myTest`myPackage`"]; addone::usage="addone[n_Integer] adds one to an integer n"; ... Begin["`Private`"]; addone[n_Integer]:=n+1; ... End[]; EndPackage[]; 6. Select all input cells (Alt + click on the cell bracket of an arbitrary input cell) and make them to initialization cells (menu Cell- >Cell properties->Initialization cell) 7. Save your file and answer yes on the question "Create autosave package?". This will save all initialization cells to the package file C:\local\Mma\Applications\myTest\myPackage.m 8. Open a fresh Mathematica session in any notebook, load your package with Needs["myTest`myPackage`"] from the package file and use the function addone. Every time you change or create an initialization cell in myPackage.nb the package file myPackage.m will be updated. Alternatively you could create the package file myPackage.m with any text editor or in the Workbench. The advantage of myPackage.nb is that you can write additional explanations in text cells (Alt+7) or do additional test calculations in non-initialization cells without saving these to the package file. I create all my packages in this way and never look in any of the automatically created .m files. An additional advantage is that you can use special Mathematica characters in variable names which look as expected in the notebook but not when editing the .m file with a normal text editor. I cannot help you regarding Workbench specifics as I tried the first release, encountered many problems and stopped after that. But try it yourself. Presumably the initial bugs are fixed now. Best regards, Hannes Kessler On 9 Mai, 09:20, "Karsten W." <Karsten.G.Wein... at googlemail.com> wrote: > Hello, > > after watching the screencasts I decided to try out the Wolfram > Workbench. But now I am stuck with organization of the package files. > > I have set the MATHEMATICA_USERBASE environment variable to my > personal path, say C:\local\Mma > > Then I have set the Workbench workplace to C:\local\Mma\Applications > and created a new application project myTest and added a small > function to the package. > > Now when I start the notebook myTest.nb and call the function, it is > not found. The same happens if I create a new package myPackage in the > project and try to load it with Needs["myTest`myPackage`"]. > > Can you help to get started here? > > Kind regards, > Karsten.