SAPBC46 How to add my own classjar files to a package

Hi
I have a problem with SAPBC 4.6.
I want to add class/jar files to my package and write a java service to import those class/jar files.

I have add the class/jar files in \sapbc46\Server\packages<mypackage>\code\jars, but when I compile the java service there is this error:

“\sapbc46\Server\packages<mypackage>\code\source\util\file.java:19: ‘.’ expected
import <myjarfile>;”

The code is getting saved but not compiling, I can’t use the class/jar files.
Any help is greatly appreciated.

yamne

Hello yamme, try to put your class/jar file in \Server\packages&#60;mypackage>\code\jars\static

Regards,

Hermann

Thank you Hermann,
but the problem is the same:
"\sapbc46\Server\packages&#60;mypackage>\code\source\util\file.java:19: ‘.’ expected

import <myjarfile>;
^
1 error"

Have you got another help for me?

Are you compiling the source in an IDE such as Eclipse?

  1. Compile the source, and make sure that you don’t have any compile errors.

  2. Put the class files in \sapbc46\Server\packages&#60;mypackage>\code\classes
    OR
    Put the jar file in
    \sapbc46\Server\packages&#60;mypackage>\code\jars\static\
    Note: you can eliminate the static directory if you don’t need the jar on the server classpath

  3. Restart the IS to pick up the classes/jars

The IS isn’t going to compile the files in the source directory for you.

I don’t know if the source was compiling the source with Eclipse…I have only the jar file.
I put the jar file in \sapbc46\Server\packages&#60;mypackage>\code\jars\static\ but the problem remains.
So, I put the class file in \sapbc46\Server\packages&#60;mypackage>\code\classes\ but the problem remains the same.

sapbc doesn’t recognize the path where the jar file or class file are.

“import <myjarfile>”

You cannot import a jar file, if that’s what you’re trying to do. Import the class that you need to use.

Put the jar in \Server\packages&#60;mypackage>\code\jars

If you only want a specific class from the jar, put the class file in the appropriate directory under \Server\packages&#60;mypackage>\code\classes. For example, if your class is com.mycompany.Foobar you’d place Foobar.class in \Server\packages&#60;mypackage>\code\classes\com\mycompany.

In either case be sure to reload the package.

In your Java service use import com.mycompany.Foobar;

HTH

Rob, now the error is:

.\sapbc46\Server\packages\SUPPORT\code\source\util\file.java:19: cannot access WCardDirFilter.WCardDirFilter

bad class file: .\packages\SUPPORT\code\classes\WCardDirFilter\WCardDirFilter.class

class file contains wrong class: WCardDirFilter

Please remove or make sure it appears in the correct subdirectory of the classpath.

import WCardDirFilter.WCardDirFilter;
^
1 error

???

The installed sdk is 1.4.2_09 and someone has modify the server.bat

If this class file was pulled from a jar file, look inside the jar to see what the proper directory name is for the file.

This is some pretty basic Java stuff–you might want to pull in someone that has a bit more Java experience to help out.

If you look in the Manifest file for this class, you’ll see that the class was created with JVM 1.2.2. I don’t thik this will work with JVM 1.4.2.