Apple Developer Connection
Advanced Search
Member Login Log In | Not a Member? Contact ADC

Using Sun Java Studio Creator 2 on Mac OS X

Thanks to its highly optimized and fully standard Java implementation, Mac OS X is an excellent platform for developing and deploying Java applications. The recently released Sun Java™ Studio Creator 2 for Mac OS X—a visual IDE for developing Web applications—only strengthens the case. This article provides a quick overview of Java Studio Creator 2 for Mac OS X, and explains how to download the latest version and get started.

NOTE: For system requirements, supported systems and supported versions of Java, see the Supported Systems section at the end of this article.

What Is Java Studio Creator?

Java Studio Creator is an easy-to-use visual tool for developing Web applications with Java. Designed for the corporate developer who needs to be productive and doesn't have the time to learn the details of Java (tm) technologies, the product combines the Java integrated development environment (IDE) with a rapid visual designer, a smart code editor, synchronized editing, and easy deployment resulting in rapid iterative development of Web applications and Portlets.

Java Studio Creator on the Mac is an excellent on-ramp to Java for any developer and an easy way to build Web applications in Java. Built on the solid foundation of NetBeans developer platform plus proven Java standard technologies like JavaServer Faces and JDBC Rowsets, Java Studio Creator provides visual access to databases and Web services, creating a complete Java development and deployment solution for portable applications, portable source code, and portable developer skill sets.

Ease of Development Features

Developers are a diverse group of professionals with varying degrees of coding and application development experience. Java Studio Creator speeds development by providing a rich visual environment with an intuitive interface for sophisticated Java application development tasks, so that developers can start creating applications immediately.

The IDE's application model provides hooks into sophisticated and flexible Java technologies, so that programmers can build applications visually, without having to delve into many of the details of Java programming. Its unified development environment provides access to all the elements needed to design a Web application: user interface components;  backend data services such as Web services, databases and Enterprise Java Beans (EJBs); query design and page navigation. In short, Java Studio Creator does all the J2EE heavy lifting, automatically accessing Java technologies like JavaServer Faces and JDBC Rowsets so that developers can master the skills they really need to focus on to be productive. 

Specific ease-of-development features include:

  • Visual development environment, based on NetBeans 4.1, for layout of user interface components,  page navigation query design, access to Web services, databases and Enterprise JavaBeans (EJBs).
  • Hooks into powerful, reliable, and proven Java technologies like JavaServer Faces, JDBC Rowsets, and the Java Web Services Developer pack, making it unnecessary to master the breadth and depth of these APIs.
  • Synchronized editing so that changes made in one view are propagated throughout the other views of the IDE, including the visual designer property sheet and the code editors.
  • Data-aware JavaServer Faces components can be configured via drag-and-drop.  For example, when developers drag a database table onto a component, the target component automatically links the data in the table to the control and makes intelligent choices about how to display the data, how to represent events, and what events to launch.
  • A visual editor for page navigation allows linking of HTML pages quickly and visually  without any coding required. Instead, navigation is defined by dropping a visual representation of the connection onto the target page.
  • Easy discovery and use of databases, Web services and  EJBs allow developers to drag-and-drop them right onto a page or even a JavaServer Faces component.
  • New set of JavaServer Faces components that support themes.

Figure 1 shows a sample application on the Mac OS X user interface, Jump Start Cycles. To set the project's visual appearance, the developer simply sets a theme using the context menu on the Themes node (see the Projects window, lower right).

Java Studio Creator User Interface

Figure 1: Java Studio Creator User Interface on Mac OS X.

Cross-Platform Development with Java Standards

Mac OS X plus Java Studio Creator allows Java developers of all skillsets to create portable applications among deployment environments, and source code that is portable across development tools. Corporate developers charged with deploying lightweight tactical applications for day-to-day business processes can develop rich user interfaces for complex systems. These developers appreciate the IDE's highly productive, predictable development environment, quick access to existing data and Web services, for completing applications reliably and on schedule.

Java class libraries created by an enterprise developer can be easily passed onto the corporate developer for use in their Java Studio Creator applications. An application built in Java Studio Creator can be easily passed from the corporate to the enterprise developer to flesh out features like transactional business logic. Or an enterprise developer working alone can create prototype applications quickly and easily.

Why Do Java Development on the Mac?

Java Studio Creator is available for free after a free registration with the Sun Developer Network (SDN). In addition to the tool, developers who subscribe to SDN are equipped with everything they need to get up and running. In addition, Apple Computer, Inc. offers the power and stability of UNIX, with all the standard UNIX tools, languages, and utilities, such as XCode, NetBeans and of course, Sun Java Studio Creator, all running on Java from Apple.

UNIX users feel at home in Darwin, the robust UNIX-based environment that underlies Mac OS X. That environment is accessible at any time from the Terminal application. All of the standard UNIX utilities and scripting languages are included in Mac OS X-editors such as emacs, vim and pico; file management tools such as cp, mv, ls and gnutar; shell scripts including bash, tcsh (csh) and zsh; and scripting languages such as Perl, PHP, tcl, Ruby and Python. For Java-based Web engineers, Apache, Tomcat and JBoss are also included, so you can also do JSP development or enterprise class J2EE applications.

Mac OS X also gives you a highly mobile platform. The PowerBook G4 or the MacBook Pro series provides a high-powered workstation that is completely portable and allows you to pick up and go, and then quickly resume work at a new location. Right when you open your laptop, network connections are reestablished and the computer is immediately up and running.

Apple has made Java a core component of Mac OS X.  Every Mac ships with the full version of Java 2, Standard Edition included—meaning you have the Java Developer Kit (JDK) and the HotSpot virtual machine (VM) without downloading, installing or configuring anything. And because Apple has optimized Java on Mac OS X, Java applications act as first-class citizens on this operating system.

In addition to Java Studio Creator, many of the industry leading tools are available, including IntelliJ's IDEA, Borland's JBuilder, Oracle's JDeveloper, Eclipse, and Sun's NetBeans, just to name a few. Mac OS X also includes free developer tools including Xcode and Shark that support rapid Java development right out of the box.

Download a Free Copy of Java Studio Creator 2

You can get a copy of Java Studio Creator 2 by visiting the Sun Developer Network (SDN site) and downloading the software. The SDN offers tutorials, technical articles, tips, a community forum, sample applications, technology news and much more.  (Sun Java Studio Creator 2 requires Mac OS X v10.3 Panther or 10.4 Tiger)

Downloading and installing Java Studio Creator:

  1. Using your Safari browser, visit the Java Studio Creator Downloads page.
  2. Please register for the Sun Developer Network to continue the download. Don't worry, it's free!
  3. Under Mac OS Platform - Sun Java Studio Creator 2, click the arrow next to Sun Java Studio Creator 2 Multilanguage.
  4. When the download is complete, find and open the creator-2-mac-ml.dmg file in your Downloads folder.
  5. Double-click the creator-2-mac-ml.command file to start the installer, and then follow the steps to complete the installation.
  1. Click the Java Studio Creator icon to launch the IDE.

The first time you run the software, it completes a few remaining install tasks—such as creating a workspace directory—before the IDE appears in your Applications folder.

Get Familiar with the Java Studio Creator IDE

To get a quick overview of Java Studio Creator, watch the product tour and view the screenshots on the Java Studio Creator website. After installing and starting Java Studio Creator, take the next step and try out a tutorial, available on the Tutorials page. Note that some tutorials and samples require the bundled database to be running. To start the database, choose Data->Start Bundled Database

To see an overview of the features click the Help menu within the IDE, and view the Help contents.

Try Out a Sample Application

To show off Java Studio Creator running on Mac OS X, first create a new project based on one of the included sample applications. This is a good place to start getting acquainted with Java Studio Creator's features and development environment.  The next step is to follow an exercise to extend the sample application.

Create a Project

  1. First, start the bundled database by choosing the Data->Start Bundled Database menu item.
  2. Choose Create New Project from the Welcome screen, or select File > New Project. A dialog box appears with a list of types of projects in the left pane.  
  3. Choose the Sample Applications project and select the Jump Start Cycles application. As shown in Figure 2, click Next> , then click Finish. After a few seconds, the Jump Start Cycles sample project opens. Make sure the Project window is open, on the right side. If the Project window is not open then open it using the View menu.
new project

Figure 2: Opening the Jump Start Cycles Sample Project.

  1. The Jump Start Cycles project has opened once a node for this project appears in the Projects window.  Here in the Projects window, you can open the files of the project in the Page Designer or Java Editor to become more familiar with the project's contents. Also, it's important to become familiar with other windows, such as the Palette, Servers, Outline and Properties windows. If these windows are not visible, you can open them from the View menu
    • The Servers window shares space with the Palette. To switch to the Servers window, simply click on the Servers tab at the top of the window. Another useful window contains Dynamic Help. When a component of a Page is selected, the Dynamic Help contents update automatically with relevent Help topics. 
    • In addition to the Designer and the Java Editor, there is also a Java Server Pages (JSP) Editor and a Navigation Editor. The JSP Editor has syntax highlighting, tag completion, cut/copy/paste capability and other useful Editor features.
    • Page navigation is controlled in the Page Navigation editor. For example, to connect multiple pages in a web application together, use the Navigation editor to link the pages by selecting a component in a page then dragging a link to another page. To open Page Navigation, open a page in the Visual Designer, press the control key and click the mouse button at the same time, then choose the Page Navigation menu item.
    • The Code Clips window opens automatically when the Java source editor is opened. To switch the editors from the Visual Designer to JSP to Java, simply click the tab near the top of the open editor. This is where you'll find sample, usable source code that can be added to a Java source file simply by selecting, then dragging and dropping the code clip to an appropriate location in the Java source file.
  2. Execute the Jump Start Cycles project by pressing the Green arrow in the toolbar near the top or run the project from the Projects window.  After building a bicycle, login using ht for the username and ht for the password. Happy shopping!
  3. To learn more, try out the Getting Started With Sun Java Studio Creator tutorial or continue on to the next exercise.

Extend a Sample application to see Java Studio Creator's features

Once you've become familiar with Java Studio Creator's features and IDE layout, you can try extending the Jump Start Cycles Sample application.  In this exercise, you'll replace a StaticText component with a hyperlink, add a new page that can be navigated to by clicking the hyperlink, add some new table components to the new page, bind the tables to Web services and Enterprise JavaBeans (EJB) methods, then run the modified application.

Begin Extending the Application

  1. From the Projects window (pane in the lower right corner) double-click Buy.jsp, as shown in Figure 3.
buy

Figure 3: Opening Buy.jsp in the Jump Start Cycles Sample Application.

  1. Select the label  Step 3: Verify located near the top of the Design view of Buy.jsp. Notice the elements of the page are displayed in a tree structure in the Outline window. (See Figure 2, lower left pane.)
  2. A StaticText component with the label, Step 3: Verify, appears selected.
  3. From the Palette, with the Basic section expanded and the Outline window open, drag a Hyperlink component and drop it directly on top of the stepPanel3 node in the Outline window (not the design surface). See Figure 4.
  4. With the hyperlink selected in the Visual Designer, use the Property window to set the hyperlink id property value to orderHistory and locate the text property and replace Hyperlink with Step 3: Order History. 

Add hyperlink to the Outline window

Figure 4: Drag and Drop a Hyperlink Component to the Outline Window below OutputText3.

 

Next, select outputText3 from the Outline, press the control key and click the mouse to open the context menu. Choose Delete.


After removing the output text

 

Figure 5: After Deleting outputText3.

Try Out Page Navigation

  1. Select a background area in the Visual Design view of Buy.jsp. Press the control key and click the mouse to open a context menu.  Choose Page Navigation.
  2. The Navigation editor opens. Again press the control key and click the mouse to open a context menu and choose New Page.
  3. Name the page OrderHistory. Note that a node for OrderHistory.jsp appears in the the Projects window, in the right lower pane.
  4. Next, locate Buy.jsp and click on it. The icon for the page expands and displays the components that can be used to connect pages. Locate the orderHistory hyperlink in Buy.jsp, click on it, and while holding down the mouse button, drag the connector to the OrderHistory page icon and release the mouse button.  This creates a connection named case1.
  5. Next, in the Navigation editor, double-click the OrderHistory icon.  This opens OrderHistory in the Visual Designer as shown in Figure 6.
HelloWeb Design: First Pass

 

Figure 6: OrderHistory Page Added to Jump Start Cycles and New Navigation Link Added to Connect the Hyperlink Component to the OrderHistory Page.  

Creating the OrderHistory Page

  1. Drag and drop two Table components from the Palette (Basic section, shown in Figure 4), to the Visual Design view of OrderHistory.jsp (shown in Figure 6). Here we use getCustomerOrders as shown in Figure 7.


EJB and Web Services methods

Figure 7: Servers Window Listing the EJB and Web Services Methods.


EJB added to Table component

Figure 8:  Drop EJB getCustomerOrders Method onto the First Table Component.
  1. Next, click the Servers tab (adjacent to the Palette tab).
  2. Expand the Enterprise Java Beans node and its Jump Start Cycles node, then drag and drop the getCustomerOrders method onto the first Table component in the Visual Designer. If a dialog opens with the title Select a target component to receive the drop then select table1.
  3. Expand the Web Services node and its Jump Start Cycles subnode then drag and drop the getCustomerOrders method onto the second Table component.

Using Code Clips to link the Order Information to the EJB and Web Services Data Providers in the OrderHistory Page

  1. At the top of the Visual Designer, for OrderHistory, click on the Java tab. This opens the source editor for OrderHistory.java.
  2. Locate the prerender() method. Inside the prerender() method and after the starting brace '{' press the Enter key then type trc<space> to create a Try-Catch block. (<space> is the spacebar, and do not add any spaces after trc.)
  3. Notice that the Palette switches to show code clips. Code clips are sample source code that can be used to add functionality to your application.  For more information on code clips, see the Adding and Managing Code Clips Online Help topic available online.  Locate the JSC: prerender order EJB code clip. Then drag and drop the clip, as shown in Figure 9.
    	try {
    <code clip is dropped here>
            		}catch 
  4. Create another try-catch block, same as step 2.
  5. Back in the Code Clips pane, locate the JSC: prerender order Web Services code clip (see Figures 9 and 10), then drag-and-drop the code clip inside the second try-catch block (just as you did in step 3).

codeclips1

Figure 9: Locating the JSC: prerender order Web Services Code Clip.


codeclips2

Figure 10: Using Code Clips.

  1. Next, click the Design tab to switch to the OrderHistory visual design. Since the Table adjusts to the number of columns in the data object and overlaps the right edge, you need to remove some columns. To adjust the Table, select the Table component, press the control key and click the mouse, chooseing Table Layout. Here you can remove columns by selecting an item in the right pane and clicking the left arrow button. See Figure 11 for an example.
Properties

Figure 11: Table Layout Customizer Dialog.


Running the Application

  1. Make sure the Bundled database has been started by choosing the Data->Start Bundled Database menu item.
  2. Make sure that your Java code does not contain any errors in the Java Editor (indicated by red underlines or red boxes along the left side). Your project will not build if there are errors in the code.
  3. Click the green arrow at the top of the screen, or choose Build > Run Project.

All your files are saved and the project begins to build. (You can also save all your files at any time by choosing File > Save All). The Build Output window appears at the bottom of the screen, displaying relevant status messages. Once your application is built and deployed, the IDE launches your Web browser (if it is not already running), and your Web application appears. (See Figure 12.)

Jump Start Cycles: Building a bike

Figure 12: Jump Start Cycles: Building a Bike.

  1. At the bottom left of the Web application, click each tab and an image for a bike color, seat type, wheel type and handlebar type, then click Next Step. Here, you can log in or create a new account, as shown in Figure 13.
Jump Start Cycles, submitting an order

Figure 13: Jump Start Cycles, After Submitting an Order.

  1. Log in and enter ht for the user and ht for the password. Click Next Step then click the Step 3: Order History link that you added earlier.  After a couple of seconds, the OrderHistory page appears with the Order details as in Figure 14. The first table retrieves data using EJB methods while the second table uses Web services to retrieve the data.

Jump Start Cycles, viewing the order history

Figure 14: Viewing the Order History.

Summary

This article explains the benefits of developing professional Web applications using Mac OS X and Sun Java Studio Creator 2. In addition, a short tutorial is provided to demonstrate how to extend one of Java Studio Creator's sample applications. Mac OS X plus Java Studio Creator 2 team up to provide an excellent development platform.

For More Information

Supported Systems

  • iMac or MacBook Pro running the Intel Core Duo processor
  • Mac G5, PowerMac G5 and PowerBook G4

Supported Versions of Java on Mac 

  • JDK 1.4.2_05 for Mac OS X 10.3 Panther
  • JDK 1.4.2_09 for Mac OS X 10.4 Tiger

Updated: 2006-05-08


Copyright 2004 Sun Microsystems, Inc. All rights reserved. Used by permission.