daust / JasperReportsIntegration

JasperReportsIntegration provides an interface to use the JasperReports reporting engine in an Oracle database application, specifically with Oracle Application Express (Oracle APEX).
BSD 3-Clause "New" or "Revised" License
55 stars 25 forks source link

Batch files on Windows throw error: main class not found #51

Closed daust closed 4 years ago

daust commented 4 years ago

This is an unfortunate error in the current release 2.6.1.

When running the batch files:

you will encounter an error: "could not find main class".

In all of those scripts the statement "pop" needs to be moved to the end of the file, e.g. change from

@echo off

REM ###########################################################
REM # set the environment for JasperReportsIntegration first
REM ###########################################################

set DIR=%~dp0
pushd %DIR%\..
set OC_JASPER_CONFIG_HOME=%CD%
popd

REM pass ALL parameters to the class
java -cp "lib/*" main/CommandLine encryptPasswords %*

to

@echo off

REM ###########################################################
REM # set the environment for JasperReportsIntegration first
REM ###########################################################

set DIR=%~dp0
pushd %DIR%\..
set OC_JASPER_CONFIG_HOME=%CD%

REM pass ALL parameters to the class
java -cp "lib/*" main/CommandLine encryptPasswords %*
popd

Actually, the script can be simplified even further, the setting of the environment variable is not required for those calls, only for startJasperReportsIntegration.cmd. Thus, we can eliminate that part and change the classpath to ../lib:

@echo off
REM pass ALL parameters to the class
java -cp "../lib/*" main/CommandLine encryptPasswords %*