# Trouble with calling include in julia C api. v0.7

**URL:** <https://discourse.julialang.org/t/trouble-with-calling-include-in-julia-c-api-v0-7/15466>\
**Category:** General Usage\
**Created:** [September 25, 2018, 1:47pm UTC](https://discourse.julialang.org/t/trouble-with-calling-include-in-julia-c-api-v0-7/15466 "2018-09-25T13:47:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mikeando](https://avatars.discourse-cdn.com/v4/letter/m/f08c70/32.png) [@mikeando](https://discourse.julialang.org/u/mikeando)\
**Post date:** [September 25, 2018, 1:47pm UTC](https://discourse.julialang.org/t/trouble-with-calling-include-in-julia-c-api-v0-7/15466/1 "2018-09-25T13:47:20Z")

</div>

I’m having some trouble including a file from the C api (via Java - but hopefully that doesn’t matter)

My code is:

```julia
#include <jni.h>
#include <stdio.h>
#include <julia.h>

void REPT() {
    if (jl_exception_occurred()) {
        jl_call2(
            jl_get_function(jl_base_module, "show"),
            jl_stderr_obj(),
            jl_exception_occurred());
        jl_printf(jl_stderr_stream(), "\n");
    } else {
        printf("OK\n");
    }
}

extern "C" JNIEXPORT jint JNICALL sayHello
        (JNIEnv * env, jobject self) {
    jl_init();
    REPT();
    printf("Printing include...\n");
    jl_eval_string("print(include)");
    REPT();
    jl_eval_string("include(\"code.jl\")");
    REPT();
    jl_atexit_hook(0);
}

```

and it is outputting :

```julia
OK
Printing include...
UndefVarError(:include)
UndefVarError(:include)

```

This suggests to me that the include function is not getting setup for some reason.

In contrast if I do a `print(include)` from the julia REPL I get `Base.MainInclude.include` as I’d expect.

What am I doing wrong?
