Virtual Machine Image

To use the Virtual Machine image:

The CDAP Standalone Virtual Machine is configured with the recommended settings for Standalone CDAP:

  • 4 GB of RAM
  • Ubuntu Desktop Linux
  • 10 GB of disk space

It has pre-installed all the software that you need to run and develop CDAP applications:

  • Java JDK 7 or 8 and Node.js are both installed.
  • Maven is installed and configured to work for CDAP.
  • The Standalone CDAP SDK is installed under /Software/cdap-sdk-3.4.3 and will automatically start when the virtual machine starts.
  • Both IntelliJ and Eclipse IDE are installed and will start when the virtual machine starts.
  • The Firefox web browser starts when the machine starts. Its default home page is the CDAP UI, http://localhost:9999.

No password is required to enter the virtual machine; however, should you need to install or remove software, the admin user and password are both cdap.

Development Environment Setup

Creating an Application

When writing a CDAP application, it’s best to use an integrated development environment that understands the application interface to provide code-completion in writing interface methods.

The best way to start developing a CDAP application is by using the Maven archetype:

$ mvn archetype:generate \
    -DarchetypeGroupId=co.cask.cdap \
    -DarchetypeArtifactId=cdap-app-archetype \
    -DarchetypeVersion=3.4.3
> mvn archetype:generate ^
-DarchetypeGroupId=co.cask.cdap ^
-DarchetypeArtifactId=cdap-app-archetype ^
-DarchetypeVersion=3.4.3

This creates a Maven project with all required dependencies, Maven plugins, and a simple application template for the development of your application. You can import this Maven project into your preferred IDE—such as IntelliJ or Eclipse—and start developing your first CDAP application.

For an application that contains a MapReduce program, use -DarchetypeArtifactId=cdap-mapreduce-archetype instead; for Spark, use either cdap-spark-java-archetype or cdap-spark-scala-archetype.

Using IntelliJ

  1. Open IntelliJ and import the Maven project.
  2. Go to menu File -> Import Project...
  3. Select the pom.xml in the Maven project’s directory.
  4. Select the Import Maven projects automatically and Automatically download: Sources, Documentation boxes in the Import Project from Maven dialog.
  5. Click Next, complete the remaining dialogs, and the new CDAP project will be created and opened.

Using Eclipse

  1. In your Eclipse installation, make sure you have the m2eclipse plugin installed.
  2. Go to menu File -> Import
  3. Enter maven in the Select an import source dialog to filter for Maven options.
  4. Select Existing Maven Projects as the import source.
  5. Browse for the Maven project’s directory.
  6. Click Finish, and the new CDAP project will be imported, created and opened.

Starting and Stopping Standalone CDAP

Use the cdap.sh script (or, if you are using Windows, use cdap.bat) to start and stop the Standalone CDAP (the location will vary depending on where the CDAP SDK is installed):

$ cd cdap-sdk-3.4.3
$ ./bin/cdap.sh start
. . .
$ ./bin/cdap.sh stop
> cd cdap-sdk-3.4.3
> .\bin\cdap.bat start
. . .
> .\bin\cdap.bat stop

Note: There is an issue with running Microsoft Windows and using the CDAP Standalone scripts when JAVA_HOME is defined as a path with spaces in it. A workaround is to use a definition of JAVA_HOME that does not include spaces, such as C:\PROGRA~1\Java\jdk1.7.0_79\bin or C:\ProgramData\Oracle\Java\javapath.

Note that starting CDAP is not necessary if you use either the Virtual Machine or the Docker image, as they both start the Standalone CDAP automatically on startup.

Once CDAP is started successfully, in a web browser you will be able to see the CDAP UI running at http://localhost:9999, where you can deploy example applications and interact with CDAP.

Building and Running CDAP Applications

See Building and Running CDAP Applications for information on accessing the CDAP CLI and CDAP SDK bin utilities, building examples, starting CDAP, and deploying, starting, and stopping applications.