Book Image

OpenShift Cookbook

By : Shekhar Gulati
Book Image

OpenShift Cookbook

By: Shekhar Gulati

Overview of this book

Table of Contents (19 chapters)
OpenShift Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Running OpenShift on a Virtual Machine
Index

Choosing between Java 6 and Java 7


OpenShift supports both Java 6 and Java 7 to run your applications. By default, all the Java applications use OpenJDK 7, but you can configure your application to use OpenJDK 6 as well. To get the exact version of your Java installation, you can SSH into the application gear and run the java -version command or run the following command:

$ rhc ssh --app jobstore --command "java -version"

In this recipe, you will learn how you can choose among different supported versions of Java.

Note

This recipe will work with all the four supported Java cartridges (Apache Tomcat 6, Apache Tomcat 7, JBoss AS7, and JBoss EAP).

How to do it…

Perform the following steps to switch to OpenJDK 6:

  1. Create a new JBoss AS 7 application by running the following command. If you already have a Java application deployed on OpenShift, then you can use that as well.

    $ rhc create-app myapp jbossas-7
    
  2. Once the application is created, you can check the default Java version by running the java...