How to compile copies not to default package


we are using VC2.3 and have the problem, that the copies, which are in a Copybook-project are compiled in the default package.
The cobol programs within a Cobol-JVM-Project which are using the copies are compiled in the package which is defined as PROGRAM-ID.
The problem is, that classes of a java project can not use classes of default package, e.g. we can instanciate the programs but not the copies .
Is there a possibility to compile all copies a package mycopies, maybe with an directive ?

Thanks a lot !

  • I don't understand the problem that you are reporting.

    A copybook project does not get compiled at all. It is used to hold copybook members so that by referencing the copybook project from another project the compiler will resolve the references and bring the required copybook members in during compilation.

    What error is it that you are receiving?

  • Thanks for your answer!

    I have 3 projects:

    - MyCopyBook   -> Copy1.cpy

    - MyJvmProject (referencec MyCopyBook-Copybooks)  -> Program1.cbl which is using copy1.cpy and has the program-id de.herbert.program1

    PROGRAM-ID. de.herbert.PROGRAM1.

    - MyJavaProject: This project references MyJvmProject, here i want to call program1 with copy1  ->

    In the bin folder of MyJvmProject I can found the classes which are generated:

    /bin/de/herbert/Program1.class <- de.herbert package

    /bin/Copy1.class <- default package

    Now, in, I try to call Program1:


    package de.herbert.coboldemo;

    import de.herbert.Program1; // <- works fine ...

    import copy1 // <- will not work 

    public static void main(String[] args) throws Exception {

    PROGRAM1 program1 = new PROGRAM1(); // -> no Problem

    Copy1 copy1 = new Copy1(); //  <- will not work, because you can not instanciate an object which is in default package

    program1.program1(copy1); ..


    When i move to the default package, it works, because in default-package you can create instances from classes which are in default package. But that woud only move the problem to an other position.

  • Verified Answer

    Hi Herbkoeg,

    I have a suggestion. JVM COBOL provides an alternate way to specify the namespace (or package name) with a compiler directive. Try removing the "de.herbert" from the Program ID in your program, so that the Program ID is just "Program1". Then, add the directive ilnamespace(de.herbert) to your specified compiler directives in the JVM COBOL project, and rebuild that project. This way, you should end up with both the Program1.class and the Copy1.class created under /bin/de/herbert.