These instructions assume you are using Eclipse 3.4 under Windows or Mac OS X. Other ways of setting up and building Ptolemy II are described on the Ptolemy II install page.
Contents of this page:
Other local pages:ptolemy/backtrack/ from the build.
C:\Program Files, which will create C:\Program Files\eclipse\eclipse.exe.
eclipse/eclipse.exe.
The default configuration of Eclipse has some difficulties with Ptolemy II, so a few changes are necessary.
Create Shortcut.
Then right mouse click on the shortcut and select Properties and change
the target to increase the memory allocated by default. E.g.,
if you installed Eclipse in C:\Program Files\eclipse,
then the Target should read:
"C:\Program Files\eclipse\eclipse.exe" -vmargs -Xmx256MThe maximum memory size will now be 256 megabytes when you restart Eclipse. You may allocate more memory if you wish.
To add Eclipse to the start menu, right click on the shortcut and
select Pin to Start Menu
Window | Preferences.
Eclipse | Preferences.
Apply. When all the changes are done, hit
OK, which will close the Eclipse Preferences Window.
Window | Preferences)
Eclipse | Preferences)
General | Workspace
Build automatically.
Window | Preferences).
Code Style | Formatter
ptolemy/actor/ptalon uses generics,
which require Java 5.0 or later.
Window | Preferences).
Compiler
Window | Preferences).
Compiler | Errors/Warning
$PTII/doc/doclets/PtDoclet.java
requires tools.jar, which is only in the Java Development
Kit (JDK), not the Java Runtime Environment (JRE). So, be sure that a
JDK is selected for building, not a JRE.
Window | Preferences)
Eclipse | Preferences)
Java | Installed JREs
Eclipse will manage your ptII code tree as a project called the ptII project. There several ways to set up the ptII project,
svn) from the command line)
svn) from the command line)
svn command)
Please choose one of the methods below to set up Eclipse for Ptolemy II.
http://ptolemy.eecs.berkeley.edu/ptolemyII/ptIIlatest
.classpath.default. below.
File | New | Project,
select 'Java project'.
In the 'Contents' box, click on 'Create project from existing source'
and browse to the PTII directory. Finish.
svn co svn://source.eecs.berkeley.edu/chess/ptII/trunk ptII
svn:// because
they will be accessing the tree with read-only Subversion access.
source.eecs.berkeley.edu, then check out ptII with
read/write access:
svn co svn+ssh://source.eecs.berkeley.edu/chess/ptII/trunk ptIIOr, if your user id on source.eecs is different than your current user id on your machine:
svn co svn+ssh://yourID@source.eecs.berkeley.edu/chess/ptII/trunk ptII
.classpath.default. below.
File | New | Project,
select 'Java project'.
In the 'Contents' box, click on 'Create project from existing source'
and browse to the PTII directory. Finish.
The Subclipse
Eclipse plugin adds Subversion to Eclipse. After installation,
you can use either Eclipse to manage your project, or the svn
from the command line.
Follow the Subclipse installation instructions. Upgrade users should see the
Subclipse update instruction otherwise the automatic update might not work.
For your convenience, an abbreviated version of the Subclipse instructions
are below:
is the only Subclipse feature required for accessing the ptII subversion repository.
Help | Software Updates | Find and Install | Search for new features to install | New Remote Site.
Mac OS X:
Help | Software Updates | Available
Software | Add Site.
Name: Subclipse 1.2.x (Eclipse 3.2+)
URL: http://subclipse.tigris.org/update_1.2.x
Update sites to visit window, select Subclipse 1.2.x (Eclipse 3.2+)
Subclipse 1.2.x (Eclipse 3.2+) tree and check the box next to Subclipse Plugin. If you select all of Subclipse, you may need to install other modules. The Subclipse Plugin
Install All
Yes.
Note: Most users will not need to do this configuration because they will be accessing the tree with read-only Subversion access. Read-only users can skip to Check Out Ptolemy II from the Subversion repository
To access the ptII repository with read/write access, you will
need configure Subclipse to use your password. If don't do this step
and you leave the default
settings, and have Cygwin ssh installed, then
c:/cygwin/bin/ssh.exe window will pop up each time ssh
is called.
The fix is to set Subclipse to use SVNKit
Window | Preferences | Team | SVN | SVN interface | SVNKit (Pure Java)
| OK
ls -ltr will
quickly show which files were changed when
To change the Subversion configuration, hunt for the
.subversion/config file.
Under Windows with Cygwin, you
might find it as On the Mac, try If the directory does not exist, try running Make this change to Find the See To set the style on already checked in files, run:
Eclipse will manage your ptII code tree as a project called
the ptII project. Assuming Eclipse is running:
Note: Most users will select
$HOME/.subversion/config. Another place to look
is c:/Documents and Settings/yourlogin/Application Data/Subversion/config.
Build All.
(If Build All is greyed out, then perhaps "Build Automatically" was
not disabled and Ptolemy has been built. See above for more about Build Automatically.)
You will get many warnings that you can ignore, but hopefully no errors.
/Users/yourlogin/.subversion.
svn --version to create the directory.
.subversion/config
### Set use-commit-times to make checkout/update/switch/revert
### put last-committed timestamps on every file touched.
use-commit-times = yes
Tell Subversion to automatically set the eol style
With the default settings, if you use Subversion to add a makefile,
then the file will be checked in with binary settings. When the
file is checked on out non-Windows platforms, then the file will have
\r\n characters, which will break Solaris /usr/ccs/bin/make and cause other problems.
.subversion/config file and uncomment the
enable-auto-props line so that it looks like:
enable-auto-props = yes
Also, uncomment the [auto-props] and the section below that
sets the properties for the files. Also, set props for
at least makefile, *.tcl and *.mk files.
See $PTII/doc/coding/svn-config-auto-props.txt for a more complete set of properties.
The bottom of the .subversion/config file should look like:
### Set enable-auto-props to 'yes' to enable automatic properties
### for 'svn add' and 'svn import', it defaults to 'no'.
### Automatic properties are defined in the section 'auto-props'.
enable-auto-props = yes
### Section for configuring automatic properties.
### The format of the entries is:
### file-name-pattern = propname[=value][;propname[=value]...]
### The file-name-pattern can contain wildcards (such as '*' and
### '?'). All entries which match will be applied to the file.
### Note that auto-props functionality must be enabled, which
### is typically done by setting the 'enable-auto-props' option.
[auto-props]
*.MF = svn:eol-style=native
*.aart = svn:eol-style=native
*.ac = svn:eol-style=native
*.am = svn:eol-style=native
*.apt = svn:eol-style=native
*.avi = svn:mime-type=video/avi
*.bat = svn:eol-style=native
*.bsh = svn:eol-style=native
*.c = svn:eol-style=native
*.cat = svn:eol-style=native
*.cgi = svn:eol-style=native
*.classpath = svn:eol-style=native
*.cmd = svn:eol-style=native
*.cnd = svn:eol-style=native
*.conf = svn:eol-style=native
*.config = svn:eol-style=native
*.cpp = svn:eol-style=native
*.css = svn:eol-style=native
*.cwiki = svn:eol-style=native
*.data = svn:eol-style=native
*.dcl = svn:eol-style=native
*.doc = svn:mime-type=application/msword
*.dsp = svn:eol-style=CRLF
*.dsw = svn:eol-style=CRLF
*.dtd = svn:eol-style=native
*.egrm = svn:eol-style=native
*.ent = svn:eol-style=native
*.fn = svn:eol-style=native
*.ft = svn:eol-style=native
*.fv = svn:eol-style=native
*.g = svn:eol-style=native
*.gif = svn:mime-type=image/gif
*.grm = svn:eol-style=native
*.gz = svn:mime-type=application/x-gzip
*.h = svn:eol-style=native
*.handlers = svn:eol-style=native
*.htc = svn:eol-style=native
*.html = svn:eol-style=native
*.ico = svn:mime-type=image/x-icon
*.ihtml = svn:eol-style=native
*.in = svn:eol-style=native
*.java = svn:eol-style=native
*.jmx = svn:eol-style=LF
*.jpg = svn:mime-type=image/jpeg
*.jpg= svn:mime-type=image/jpeg
*.js = svn:eol-style=native
*.jsp = svn:eol-style=native
*.junit = svn:eol-style=native
*.jx = svn:eol-style=native
*.m = svn:eol-style=native
*.m4 = svn:eol-style=native
*.manifest = svn:eol-style=native
*.mdo = svn:eol-style=native
*.meta = svn:eol-style=native
*.mf = svn:eol-style=native
*.mk = svn:eol-style=native
*.mod = svn:eol-style=native
*.mov = svn:mime-type=video/quicktime
*.mpg = svn:mime-type=video/mpeg
*.ms = svn:eol-style=native
*.n3 = svn:eol-style=native
*.nroff = svn:eol-style=native
*.patch = svn:eol-style=native
*.pdf = svn:mime-type=application/pdf
*.pen = svn:eol-style=native
*.php = svn:eol-style=native
*.pl = svn:eol-style=native
*.pm = svn:eol-style=native
*.png = svn:mime-type=image/png
*.pod = svn:eol-style=native
*.pom = svn:eol-style=native
*.ppt = svn:mime-type=application/powerpoint
*.project = svn:eol-style=native
*.properties = svn:eol-style=native
*.py = svn:eol-style=native
*.rb = svn:eol-style=native
*.rdf = svn:eol-style=native
*.rnc = svn:eol-style=native
*.rng = svn:eol-style=native
*.rnx = svn:eol-style=native
*.roles = svn:eol-style=native
*.rss = svn:eol-style=native
*.schemas = svn:eol-style=native
*.sh = svn:eol-style=native
*.sh = svn:eol-style=native;svn:executable
*.sql = svn:eol-style=native
*.svg = svn:eol-style=native
*.tcl = svn:eol-style=native
*.tgz = svn:mime-type=application/x-compressed
*.tif = svn:mime-type=image/tiff
*.tiff = svn:mime-type=image/tiff
*.tld = svn:eol-style=native
*.txt = svn:eol-style=native
*.types = svn:eol-style=native
*.vm = svn:eol-style=native
*.vsl = svn:eol-style=native
*.wsdd = svn:eol-style=native
*.wsdl = svn:eol-style=native
*.xargs = svn:eol-style=native
*.xcat = svn:eol-style=native
*.xconf = svn:eol-style=native
*.xegrm = svn:eol-style=native
*.xgrm = svn:eol-style=native
*.xhtml = svn:eol-style=native
*.xhtml2 = svn:eol-style=native
*.xlex = svn:eol-style=native
*.xlog = svn:eol-style=native
*.xls = svn:mime-type=application/excel
*.xmap = svn:eol-style=native
*.xml = svn:eol-style=native
*.xroles = svn:eol-style=native
*.xsamples = svn:eol-style=native
*.xsd = svn:eol-style=native
*.xsl = svn:eol-style=native
*.xslt = svn:eol-style=native
*.xsp = svn:eol-style=native
*.xtest = svn:eol-style=native
*.xul = svn:eol-style=native
*.xweb = svn:eol-style=native
*.xwelcome = svn:eol-style=native
*.zip = svn:mime-type=application/zip
.htaccess = svn:eol-style=native
INSTALL = svn:eol-style=native
KEYS = svn:eol-style=native
LICENSE = svn:eol-style=native
Makefile = svn:eol-style=native
NOTICE = svn:eol-style=native
README = svn:eol-style=native
abs-linkmap = svn:eol-style=native
abs-menulinks = svn:eol-style=native
makefile = svn:eol-style=native
Subversion Users: Re: Setting svn:eol-style
svn propset svn:eol-style native filename
Check Out Ptolemy II from the Subversion repository
Below we describe how to set up Eclipse so Eclipse
manages the Subversion interaction.
Window | Show View | Other | SVN | SVN Repository
New and set the url.
To check out the ptII svn repository with read-only access:
svn://source.eecs.berkeley.edu/chess/ptII
svn:// because
they will be accessing the tree with read-only Subversion access.
If you have an
ssh account on source.eecs.berkeley.edu, then check out ptII with
read/write access:
svn+ssh://source.eecs.berkeley.edu/home/svn/chess/ptII
Or, if your user id on source.eecs is different than your current user id
on your machine:
svn co svn+ssh://yourID@source.eecs.berkeley.edu/chess/ptII
Read/write users will be prompted for their source.eecs.berkeley.edu
username and password. This typically happens more than once since in case the svn+ssh protocol is being used passwords are not cached.
trunk and select checkout
Follow the wizard, creating selections as follows:
Be sure to check out the
trunk not the
entire tree, which include all the branches and the trunk.
Check out as a project configured using the New Project Wizard, then hit Finish.
Java | Java Project, then hit Next.
ptII
then click The project you created, ptII, contains resources other than the standard .project file. If any of those resources have the same name and relative location of a resource you are checking out, the local resource will be replaced with the resource from the repository
OK.
Note:If you did not disable build automatically, as
suggested above, then Eclipse will build the project and produce
thousands of errors. This is not really a problem. You will
fix the errors below with the .classpath.default file.
Window | Open Perspective | Java
in the menu.
By default, Eclipse offers a "Package Explorer" as the main navigation
mechanism for the source files. Many developers much
prefer to use the "Navigator."
To get the Navigator, select
Window | Show View | Navigator
in the menu.
You can now browse the source files.
.classpath.default and copy it into a new file called
.classpath.
Note that you can use the Eclipse Navigator browse to the
.classpath.default file, open the file, copy the contents,
open .classpath, paste the contents and save .classpath.
Or, you can use Windows Explorer or the shell.
Window | Open Perspective | Java Go to the Package Explorer or the Navigator.
Right mouse click on the ptII icon and select Refresh.
Note:If you do not do copy .classpath.default
and select "Refresh", then Eclipse will produce
thousands of errors. This is not really a problem. It reflects
that you probably don't have installed many optional packages that
are needed to build subsets of Ptolemy II. You can ignore the errors
(not advised, since they will mask errors you make), or you can copy
the .classpath.default file and rebuild.
Alternatively, you can install
the optional packages and run configure.
Project |
Vergil
ptII
ptolemy.vergil.VergilApplication
You may now wish to read the Using Vergil tutorial.
Run | Add/Remove Breakpoint
Run | Run.
On the Main
tab, select the Ptolemy II package and enter
ptolemy.vergil.VergilApplication as Main class.
Run | Debug, and
as above. Open the Lorenz CT demo from the Quick Tour and run it.
Ptolemy II includes a number of packages that rely on software that you may or may not have installed, such as MATLAB, the Java comm package (for serial port connections), joystick support, Java Advanced Imaging (JAI), the Java Media Framework (JMF), and Java 3D. If you wish to use or extend these features, you will need to perform a few extra steps. These steps require execution of a script called "configure" in the Ptolemy II home directory, which in turn requires (on Windows) installation of Cygwin, a package that offers Unix-like facilities within Windows. You can find instructions for installing Cygwin at http://ptolemy.eecs.berkeley.edu/ptolemyII/ptIIlatest/cygwin.htm.
The procedure below will modify the .classpath file that is provided in the version control repository to customize it for the software that you have installed. The procedure is as follows:
export PTII=c:/Program\ Files/yourLogin/workspace/ptII
export PTII=c:/Users/yourLogin/workspace/ptII
cd "$PTII"Note that we use double quotes around
PTII because
the value of PTII has spaces in it.
./configureThis will create
$PTII/.classpath
$PTII/bin on the command line, you will probably
want to run the following commands within Cygwin bash:
cd $PTII/bin make
WindowOpen Perspective | Java
ptII/.classpath and to build
the project (or you may have to manually rebuild if you turned
off automatic rebuild).
-Dptolemy.ptII.dir=your PtII directory
-Dptolemy.ptII.dir=c:\hyzheng\ptII)
C:\hyzheng\ptII\ptolemy\domains\de\lib\test)
workspace directory in the
Eclipse directory. The workspace directory will only
appear if you have already run Eclipse. Note that removing the
workspace directory will cause Eclipse to 'forget'
about any projects that you may have set up
If you have problems where clicking on build briefly flashes up
a window, look in $PTII/.classpath for and empty
exclusion that looks like ||
If you have problems with the classpath, look in the
workspace/.metadata/log file that is in
the directory where eclipse is installed. For more information
about the .metadata directory, see
below.
Basically, when eclipse starts up, it might try to update
H:/workspace/.metadata
. The solution is covered in
http://www.eclipse.org/documentation/html/plugins/org.eclipse.platform.doc.user/doc/tasks/running_eclipse.htm:
The way I figured this out was by running Norton Antivirus and
doing View -> File System Realtime Scan Statistics and then I noticed
that my machine was updating H:/workspace/.metadata
I think I introduced the problem by clicking on the Eclipse.exe binary and selecting Pin to Start Menu. My solution was to remove the Eclipse bogus entry in the start menu and then create a shortcut, change Start in property and then pin that shortcut to my start menu.