cancel
Showing results for 
Search instead for 
Did you mean: 

Classpath for jar files?

Former Member
0 Kudos

Hi all,

i am trying to run a standalone java program using JRC through command promt.

my problem is i am importing few classes from jar files into my java class. but its not getting imported.

how to resolve it?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Saravana

You can use batch file to run your standalone java program.

The contents of the batch file would be as follows:

@echo off

if "%OS%" == "Windows_NT" setlocal

rem

rem Sets the CLASSPATH environment variable to include all JAR files

rem required for the JRC then compiles and jars Java file(s).

rem

rem Edit the environment variable BOBJ_JAVA_LIB to point to the

rem location where you have the JRC jar files.

rem

rem Make sure to define any other required libraries in the environment

rem variable CLASSPATH.

rem

rem Make sure you have defined the environment variable JAVA_HOME

rem

set BOBJ_JAVA_LIB=c:\Program Files\Business Objects\Common\3.5\java\lib

set CURRENT_DIR=%cd%

echo Using JAVA_HOME: %JAVA_HOME%

echo Using CURRENT_DIR: %CURRENT_DIR%

set RUNJAVA="%JAVAHOME%/bin/java"

set RUNJAVAC="%JAVAHOME%/bin/javac"

set RUNJAR="%JAVAHOME%/bin/jar"

set CLASSPATH=%BOBJ_JAVA_LIB%\ReportViewer.jar;%BOBJ_JAVA_LIB%\ReportPrinter.jar;%BOBJ_JAVA_LIB%\CrystalCommon.jar;%BOBJ_JAVA_LIB%\CrystalDatabaseConnectors.jar;%BOBJ_JAVA_LIB%\CrystalReportingCommon.jar;%BOBJ_JAVA_LIB%\CrystalFormulas.jar;%BOBJ_JAVA_LIB%\CrystalQueryEngine.jar;%BOBJ_JAVA_LIB%\CrystalReportEngine.jar;%BOBJ_JAVA_LIB%\keycodeDecoder.jar;%BOBJ_JAVA_LIB%\MetafileRenderer.jar;%BOBJ_JAVA_LIB%\rpoifs.jar;%BOBJ_JAVA_LIB%\jrcerom.jar;%BOBJ_JAVA_LIB%\jrcadapter.jar;%BOBJ_JAVA_LIB%\rascore.jar;%BOBJ_JAVA_LIB%\rasapp.jar;%BOBJ_JAVA_LIB%\Serialization.jar;%BOBJ_JAVA_LIB%\external\log4j.jar;%BOBJ_JAVA_LIB%\external\icu4j.jar;%BOBJ_JAVA_LIB%\external\Concurrent.jar;%BOBJ_JAVA_LIB%\external\xercesImpl.jar;%BOBJ_JAVA_LIB%\external\xml-apis.jar;%BOBJ_JAVA_LIB%\CrystalCharting.jar;%BOBJ_JAVA_LIB%\CrystalContentModels.jar;%BOBJ_JAVA_LIB%\CrystalExporters.jar;%BOBJ_JAVA_LIB%\CrystalExportingBase.jar;%CURRENT_DIR%;%CLASSPATH%

%_RUNJAVAC% -classpath "%CLASSPATH%" *.java

%_RUNJAVA% -classpath "%CLASSPATH%" HelloWorldSwing

// HelloWorldSwing is the name of your .java file

Make sure you have all the jar files in the lib directory.

Hope this helps you.

Thanks

Soni

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Saravana

Sometimes the we are able to import jar fileto classpath becuase of the spaces between.

for eg. C:/*Program Files*/jarpath/<jar file name>.

Classpath set will broke at C:/Program.

Putting ReportViewer.jar and jrcerromis important to run you thick client application.

To test whether all the jar are included or not set path of jars without any space.

i.e. C:/jarpath/<jar file name>.

It is also important to keep CrConfig.xml file in classapth for keycode and other information and report location tab has to be commented out i.e. <!-- <reportlocation> ../..</reportlocation> -->

Hope this helps

Thanks.