These are simplified instructions for setting up
Eclipse using the source tree.
See eclipse.htm
for instructions about how to set up Eclipse using
the Subversion version control system.
Subversion allows you to get updates from the
Ptolemy development tree. The instructions here
provide access to a static source code tree, such
as what is shipped with the Ptolemy II release.
These instructions assume you are using Eclipse Helios 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:
ptolemy/backtrack/ from the build.
Eclipse is available as both 32-bit and 64-bit binaries. Deciding which one to download can be complex.
The basic idea is that to use a 64-bit version of Eclipse, you must have a 64-bit JVM and an operating system that will support 64-bit applications. When in doubt, choose the 32-bit version of Eclipse, it is more likely to work than the 64-bit version.
See below for details.
uname -a. If the result
contains x64, you are running a 64-bit version of Linux and
would select the 64-bit version of Eclipse.. Also,
try java -version. Below is a run on a 64-bit Linux
machine:
-bash-3.2$ uname -a Linux sisyphus.eecs.berkeley.edu 2.6.18-164.11.1.el5xen #1 SMP \ Wed Jan 6 13:43:33 EST 2010 x86_64 x86_64 x86_64 GNU/Linux -bash-3.2$ java -version java version "1.5.0_22" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_22-b03) Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_22-b03, mixed mode)
2010-10-10 11:50:02.263 java[7823:613] java.lang.NullPointerException at apple.awt.CToolkit.postEvent(CToolkit.java:1086) at apple.awt.EventFactoryProxy.forwardEvent(EventFactoryProxy.java:53)The bug happens when running from Eclipse or from the command line. The bug requires UI interactions such as mouse movement or clicking. The bug is probably a threading bug and may only show up on multi-core machines. The downside is that when the bug occurs, the debugging session in Eclipse may become non-responsive.
For further information, see:
http://lists.apple.com/archives/java-dev/2010/May/msg00140.html.
So, at this time, we are recommending the 32-bit version with Java 1.5.
Download
eclipse-rcp-helios-SR1-macosx-cocoa.tar.gz
uncompress it and move eclipse/ into /Applications, which
will create /Applications/eclipse/Eclipse.app.
Firefox Mac OS X Details:
/Downloads
eclipse-rcp-helios-SR1-macosx-cocoa.tar.gz
which will create the eclipse directory.
eclipse directory to your
Applications directory.
eclipse.ini.
/Applications/eclipse,
find the Eclipse executable and right click (Control + click)
and choose "Show Package Contents".
Contents/MacOS and double click on
eclipse.ini, which will open up the file in TextEdit
-vm /System/Library/Frameworks/JavaVM.framework/Versions/1.5/Home/bin/java
-vmargs line.
eclipse.ini, see
http://wiki.eclipse.org/Eclipse.ini
Eclipse | About Eclipse
| Installation Details | Configuration.
java.class.version property should be
49.0.
java.vm.name property might
have the string 64 in it.
http://windows.microsoft.com/en-US/windows7/32-bit-and-64-bit-Windows-frequently-asked-questions.
for details.
C:\Program Files, which will
create C:\Program Files\eclipse\eclipse.exe.
eclipse\eclipse.exe is not created, then it could
be that the security policy on your machine is preventing the creation
of .exe files. If this is the case, then try right
clicking on the zip file, select "Properties" and then at the bottom,
hit "Unblock" and then "Apply". Or try running
unzip from the command line.
/Applications/eclipse/Eclipse.app or eclipse/eclipse.exe.
eclipse.exe and a dll executable:
chmod a+x eclipse.exe
eclipse directory.
find . -name *.dll -exec chmod a+x {} \;
Eclipse has the notion of a workspace, which is a collection of
one or more projects. Ptolemy II is a project.
When the "Workspace Launcher" window comes up, either stick with the default
or choose a new directory. Note that the projects can be located outside
of the workspace directory. One caveat is that Eclipse will not permit
the project directory to be a parent of the workspace directory, so placing the
workspace in a subdirectory such as the default location is best.
Click "OK" to create the workspace and open Eclipse.
Below is the Workspace Launcher Window:

Applications/eclipse, drag the
Eclipse.app icon to the Finder Dock on the edge of your
screen. This will give you fast access to starting Eclipse.
eclipse.exe by going to the
directory where Eclipse is installed, right clicking on eclipse.exe
and selecting Create Shortcut.
Pin to Start Menu
eclipse.ini file.
Window | Preferences.
Eclipse | Preferences.
Apply. When all the changes are done, hit
OK, which will close the Eclipse Preferences Window.
in the preferences window
Eclipse | Preferences)
Window | Preferences)
Java | Code Style | Formatter and click
New
ptolemy/actor/ptalon uses generics,
which require Java 1.5 (aka Java 5.0) or later.
However, the Ptolemy II development trunk that includes changes after
Ptolemy II 8.0 uses some features of Java 1.6 (aka Java 6.0).
In particular, ptdb to uses javax.swing.GroupLayout.
which requires Java 1.6 (also known as 6.0) or later.
Eclipse | Preferences)
Window | Preferences)
Java | Compiler
Eclipse | Preferences)
Window | Preferences)
Java | 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.
Eclipse | Preferences)
Window | Preferences)
Java | Installed JREs
JVM 1.5.0.
JVM 1.6.0.
tools.jar must be added the external jars:
Edit | Add External Jars.
c:\Program Files\Java JDK1.6.0_22\lib
Open, select tools.jar and then finish.
Eclipse will manage your ptII code tree as a project called the ptII project.
http://ptolemy.eecs.berkeley.edu/ptolemyII/ptIIlatest
.classpath file to set paths and exclude files.
There are two choices:
.classpath.default to .classpath.
This choice is the simpler choice, but might exclude optional
third party packages.
./configure. This choice is more complex,
especially for Windows users. However, this choice will include
optional third party software that is already installed on your
machine.
.classpath. One solution
is to follow the instructions from:
http://www.macworld.com/article/51830/2006/07/showallfinder.html:
/Utilities/Terminal.app. Enter:
defaults write com.apple.Finder AppleShowAllFiles YES
/Utilities/Terminal.app
cd /Applications/Ptolemy/ptII8.0.1
cp .classpath.default .classpath
c:\Ptolemy\ptII8.0.1.
.classpath and select delete.
.classpath.default, select copy.
.classpath.default.
OR
configureThe 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.
- (Mac OS X): Using the Terminal to run configure
- Start up the Terminal application, which may be found as
/Utilities/Terminal.app
- In the Terminal, change to the directory where the Ptolemy II
source code was installed. For example:
cd /Applications/Ptolemy/ptII8.0.1
- Set
$PTII to the location of the source tree:
export PTII=`pwd`
- Make
configure executable.
chmod a+x configure
- Run
./configure
./configure
- (Windows): Install Cygwin and run configure
Unfortunately Windows does not ship with Unix shell commands
like
make. The workaround is to install Cygwin,
see http://ptolemy.eecs.berkeley.edu/ptolemyII/ptIIlatest/cygwin.htm
- Start up the Cygwin Bash shell:
Start | Run | Cygwin
- Change to the directory where the Ptolemy II source code was
installed. For example:
cd c:/Ptolemy/ptII8.0.1
Note that if there are spaces in the path name to the directory
where your Ptolemy installation is located, then you should use
double quotes around the path:
cd "c:/Documents and Settings/yourLogin/workspace/ptII"
- Set
$PTII to the location of the Ptolemy II source tree:
export PTII=c:/Ptolemy/ptII8.0.1
Again, if there are spaces in the path, use double quotes:
export PTII="c:/Documents and Settings/yourLogin/workspace/ptII"
- Run:
./configure
This will create $PTII/.classpath
- If Eclipse is not running, start up Eclipse
- In Eclipse, do
File | New | Project.
- In the "New Project" window, select "Java" > "Java project", Click Next.

- In the "New Java Project" window:
In "Project Name", enter any project name, ptII
is a common choice.
Uncheck "Use default location" and browse to the location of
the source tree.
(Mac OS X): For example, browse to /Applications/Ptolemy/ptII8.0.1
Press "Next". There might be a delay as Eclipse scans your ptII tree.
Below is the New Java Project window:

Warning: If the "Setting Build Paths" window comes up with a message
"The output folder has changed. Do you want to remove all generated resources
from the old location ptII/bin", then the problem is that the
.classpath file was not found. It is best if you exit
Eclipse, create the .classpath file and redo the above steps.
- In the "New Java Project" window, select
"Allow output folders for source folder", then click "Finish"
Below is the second New Java Project window:

- When asked if you want to shift to the Java perspective, click on Yes.
- The workspace will take a few minutes to build.
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.
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, when building, the Problem tab shows "Assert cannot be resolved", then the problem is that Junit is not being found.
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.