Make a Standalone Application

After you develop your application, you need to decide how to include or reference any dependent libraries. See the details for each language.

Java

If your Java application doesn’t depend on library classes, then you can create a JAR file. By default, a JAR file includes only the class files generated from the source files.

If your Java application depends on library classes, then your package must include them when it’s deployed. You can accomplish this in one of two ways:

  • Create an uber JAR. When create your application, include all dependent libraries in the JAR file with the application. If you’re using Maven, then you can use the Maven build tool and either the assembly or shade plug-in to copy the required libraries into the JAR file. Instructions for creating an uber JAR file with the assembly plug-in are in this tutorial: Tutorial icon Creating a Basic REST Web Service using Grizzly, Jersey, and Maven.

  • Use the classpath. All dependent libraries are included in separate JAR files, but the path to each file is included in the -classpath option on the command line. If you include a lot of libraries in your application, then the classpath can get long. If that’s the case, then you can put the command line into a Bash shell script and execute that. If you’re using Maven, then you can use the appassembler plugin to write the Bash script.

Java EE

Your web application must include all dependent classes that aren’t included in WebLogic Server. To deploy your application, you can create either a single .war file or a .zip, .tar, or .tar.gz file with an optional manifest.json file and a single .war file at the root.

Node

If your application doesn’t use any third-party libraries or have any NPM dependencies, then you can compress your project files the code and the manifest.json file. If your application has dependencies, then your application and its dependencies must be bundled in a .zip, .tar, or .tar.gz file. You must install the libraries in a local directory (node_module) and then compress your code, the manifest.json, the package.json files, and the node_module directory.

PHP

Compress your project in a .zip, .tar, or .tar.gz file that contains your code, the manifest.json, script files, and the dependencies (if any).

Python

If your application doesn’t depend on any third-party libraries, then compress your project in a .zip, .tar, or .tar.gz file that contains the .py, manifest.json, and script files. If your application uses third-party libraries, then you must first install the libraries in a local directory, and then compress your project files along with the manifest.json file, scrip files, and the directory with the dependencies.

Example 3-1 Sample start.sh Script for a Python Application

#!/bin/sh
export PYTHONPATH=modules
python app.py 

Ruby

If your application doesn’t depend on third-party libraries, then it must be compressed in a .zip, .tar, or .tar.gz file that contains the .rb, manifest.json, and script files. If your application has dependencies, then you must specify them in the Gemfile file and create a script to install the dependencies specified in the Gemfile file.

After you do that, you can compress your project (.rb and script files, and the dependencies directory) and the manifest.json file.

Example 3-2 Sample start.sh Script for a Ruby Application

#Install the dependencies specified in the Gemfile
bundle install
#Run the database migration to create the Employee table.
bundle exec rake db:migrate
#Run the Sinatra application. Your application must run on the port specified in the PORT environment variable and in the 0.0.0.0 host.
rackup -p ${PORT} --host 0.0.0.0

Go

If your application has dependencies, then you must specify them in a script file and Oracle Application Container Cloud Service manages them when you deploy your application.

Compress your project in a .zip, .tar, or .tar.gz file that contains your code, the manifest.json file and script files.

Example 3-3 Sample start.sh Script for a Go Application

# Extract LIBAOI libs from Debian package (into ./lib/x86_64-linux-gnu)
dpkg-deb -R libaio1_0.3.110-1_amd64.deb ${APP_HOME}
export PKG_CONFIG_PATH=${APP_HOME}/Oracle/instantclient_12_2

# Add OCI and LIBAIO to shared library path
export LD_LIBRARY_PATH=${APP_HOME}/Oracle/instantclient_12_2:${APP_HOME}/lib/x86_64-linux-gnu 

# Finalize OCI installation by creating required softlink
ln -s -f ${APP_HOME}/Oracle/instantclient_12_2/libclntsh.so.12.1 ${APP_HOME}/Oracle/instantclient_12_2/libclntsh.so
ln -s -f ${APP_HOME}/Oracle/instantclient_12_2/libocci.so.12.1 ${APP_HOME}/Oracle/instantclient_12_2/libocci.so

# Install Go dependencies
go get github.com/mattn/go-oci8
go get github.com/ant0ine/go-json-rest/rest

# Launch the application
go run oracle-db.go

.Net

To make your standalone application you need to update the project's dependencies and tools:

dotnet restore

Create a debug build of your application:

dotnet build 

Create a self-contained deployment for the Linux platform:

dotnet publish -c Release -r linux-x64

Compress your project in a .zip, .tar, or .tar.gz file that contains your code, the manifest.json file, and the publish directory.