Last week I was struggling to get the APEXExport utility to work. I was messing around with environment variables, different Java versions, and ugly bash syntax while constantly getting the exact same error message. Anyway, after some frustrating moments, I decided to start all over again and then I came up with a solution pretty fast. Here’s my way to quickly get the APEXExport command-line utility to function properly.

Preparation

1. Download the installation files for your specific APEX version. Unzip and put the resulting folder in an accessible location on your file system.

2. The Java Development Kit (JDK) version 1.5 or greater is required on your machine. Make sure Java is in the PATH environment variable.

>> java -version
java version "1.7.0_07"
Java(TM) SE Runtime Environment (build 1.7.0_07-b10)
Java HotSpot(TM) 64-Bit Server VM (build 23.3-b01, mixed mode)

3. Download the Oracle JDBC driver that is compatible with the version of your Oracle Database. For example, I’m on version 11.2.0.3.0 and I ended up using the ojdbc6.jar file. Execute the below query to find out your database version.

select *
from v$version;

Execution

1. Open up a terminal window and change the directory to the utilities folder in the APEX installation folder. It is absolutely mandatory to execute the APEXExport utility starting from this folder.

>> cd Documents/nick/software/apex/utilities/
>> pwd
/Users/Nick/Documents/nick/software/apex/utilities

2. You should now be able to invoke the APEXExport utility. Here’s the command I used to export an application.

>> java -cp .:/path/to/ojdbc6.jar oracle.apex.APEXExport -db localhost:1521:apex -user nick_demo -password secret -applicationid 999
Exporting application 999
  Completed at Mon Nov 25 20:08:54 CET 2013

Explanation

  • cp: set the classpath parameter to the current folder (.) and the path to the Oracle JDBC driver file (/path/to/ojdbc6.jar). You could have used an environment variable instead:
>> export CLASSPATH=.:/path/to/ojdbc6.jar
  • db: the database JDBC connection URL
  • user: the parsing schema of the application you want to export
  • password: the password of the above user
  • applicationid: the ID of the application to be exported

Any problems? Post your question in the comments section.