Getting Started with Sun Studio: Setting Up Your  UNIX Account

Before you read this document, read Sun Studio for an overview of the package and information on its use.

The Sun Studio package is installed in the directory /opt. We will refer to this installation directory as $SUNSTUDIO throughout this document. It is important to note that Sun Studio and its language compilers are only available on Strauss. 

There may be newer test versions of Sun Studio on Strauss. If you want to use a test version, you must set the SUNSTUDIO environment variable to the version you want to use. You do not need to set this variable if you want the default version.

Here are the environment variables that you must set to use a alternate Sun Studio version with its compilers.

MANPATH ${SUNSTUDIO}/SUNWspro/man:/opt/man:/usr/man

This documentation assumes that your UNIX account's configuration ("dot") files match, or are based upon, the Client Support and Services recommended configuration files: .cshrc, .login, .localalias, and .localenv. These files are found in the /opt/proto directory. Typing the UNIX command:


will cause your current configuration files to be renamed (for backup purposes) and replaced with the standard configuration files. The system will display the names of the renamed and replacement files.

Start a new shell for working with the Sun Studio package

The environment variables listed above will set your paths so that the Sun Studio commands, programming libraries, and online documentation are first in your path. In some cases, this replaces standard UNIX commands with ones just for Sun Studio. We recommend that you always start a new shell with these environment variables. When you are done, type


to get back to the default environment. 

Configuration changes to identify the Sun Studio package location

Add the following lines to your ~/.localenv file:

   # For Sun Studio with IDE
#setenv SUNSTUDIO /opt/studio11

These are both comment commands. Remove the # before the setenv command to use the alternate version of Sun Studio. You may need to update the setenv command with a new Sun Studio location.

Configuration changes to add a studioshell command

Add the following lines to your ~/.localalias file,>

   alias studioshell "(setenv NEED_STUDIO; newgrp \!*)"
if $?NEED_STUDIO then
unsetenv NEED_STUDIO
if $?SUNSTUDIO then
setenv PATH ${SUNSTUDIO}/SUNWspro/bin:$PATH
setenv MANPATH ${SUNSTUDIO}/SUNWspro/man:/opt/man:/usr/man
if $?DISPLAY then
xset fp+ tcp/

The next time you log onto Strauss, you will be able to start an IDE-configured shell with the command


To associate the new shell with a different group project id (e.g., a UNIX group assigned to a class), type the following command instead:

   studioshell project

where project is your 4-digit group project number.

Testing your new configuration

Once you have made the changes to both ~/.localenv and ~/.localalias files, logout and login again. To test your setup, type

to start a new shell, and the use the man command and which command to check your paths for on-line documentation and compilers. Here is a sample session to test your setup.

   <99>% studioshell
<1>% man intro
Reformatting page. Please Wait... done

User Commands intro(1)

intro - introduction to Sun Studio command-line manual pages

The Section 1 Sun Studio man pages include man pages for all
the command-line applications delivered with the Sun Studio
compilers and tools.

A complete index can be found by pointing a browser at


which assumes that the software has been installed in /opt

SunOS 5.9 Last change: July 2004 1

<2>% which CC

Command <1>% shows the man command is getting the expected Sun Studio documentation, and command <2>% show the CC compiler is the correct version.

Command Line verses IDE

This all you need to edit, compile, debug and run your packages using standard UNIX command-line tools such as, CC and make. To run the IDE, which is based on netbeans, you run an X Windows server and properly connect to strauss. See: X Windows Configuration Setup for Using Sun Studio IDE


Search IT Help

My UD Search for forms & applications.