<p><a class="user-mention" data-hovercard-type="user" data-hovercard-url="/hovercards?user_id=63080" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/linuxmaniac">@linuxmaniac</a>  here's the makefile<br>
`include ../../Makefile.defs<br>
auto_gen=<br>
NAME=app_java.so</p>
<p>USE_GCJ ?= no</p>
<p>#DEFS += -DEXTRA_DEBUG</p>
<p>DIST = $(shell if [ -f "/etc/redhat-release" ]; then cat /etc/redhat-release | sed "s/.<em>([0-9]).[0-9].</em>/\1/g"; fi)<br>
ifeq ($(DIST),6)<br>
JVM_PATH = $(shell dirname <code>find /usr/lib/jvm/java/ -name "libjvm.so"</code>)<br>
DEFS += $(shell pkg-config libgcj-4.4 --cflags)<br>
LIBS += $(shell pkg-config libgcj-4.4 --cflags) -L$(JVM_PATH) -ljvm<br>
else</p>
<h1>try to detect JAVA_HOME</h1>
<p>ifeq ($(USE_GCJ),yes)<br>
JAVA_HOME ?= $(shell readlink -f /usr/bin/javac | sed "s:bin/javac::")<br>
DEFS += $(shell pkg-config libgcj --cflags) -I$(JAVA_HOME)/include<br>
LIBS += $(shell pkg-config libgcj --libs) -L$(JAVA_HOME)/lib  -ljvm<br>
else<br>
ifeq ($(ARCH),i386)<br>
ATYPE=i386<br>
else ifeq ($(ARCH),x86_64)<br>
ATYPE=amd64<br>
endif<br>
JAVA_HOME = /usr/lib/jvm/java<br>
DEFS += -I/usr/lib/jvm/java-11-openjdk-amd64/include<br>
LIBS += -L/usr/lib/jvm/java-11-openjdk-amd64/server -ljvm<br>
endif</p>
<h1>On Debian 7.5 there is a bug with JAVA_HOME detection.</h1>
<h1>$(shell readlink -f /usr/bin/javac | sed "s:bin/javac::") points to perl wrapper script (/usr/bin/gcj-wrapper-4.7)</h1>
<h1>whereas the real compiler is at /usr/bin/gcj-4.7. As the result, JAVA_HOME will not be a directory, that is incorrect.</h1>
<h1>At this point I don't see any universal method as explicit setting this variable at the compile phase.</h1>
<h1>-- ez</h1>
<p>ifeq ($(USE_GCJ),yes)<br>
ifeq ($(shell [ -d "${JAVA_HOME}" -a -f "$(JAVA_HOME)/include/jni.h" -a -f "$(JAVA_HOME)/lib/libjvm.so" ] && echo 1 || echo 0),0)<br>
ifneq ($(DOCBUILD),yes)<br>
JAVA_HOME = /usr/lib/jvm/java<br>
DEFS += -I/usr/lib/jvm/java-11-openjdk-amd64/include -I/usr/lib/jvm/java-11-openjdk-amd64/include -I/usr/lib/jvm/java-11-openjdk-amd64/include/linux<br>
LIBS += -L/usr/lib/jvm/java-11-openjdk-amd64/server -ljvm<br>
endif<br>
endif<br>
else<br>
ifeq ($(shell [ -d "${JAVA_HOME}" -a -f "$(JAVA_HOME)/include/jni.h" -a -f "$(JAVA_HOME)/jre/lib/$(ATYPE)/server/libjvm.so" ] && echo 1 || echo 0),0)<br>
ifneq ($(DOCBUILD),yes)<br>
JAVA_HOME = /usr/lib/jvm/java<br>
DEFS += -I/usr/lib/jvm/java-11-openjdk-amd64/include -I/usr/lib/jvm/java-11-openjdk-amd64/include/linux<br>
LIBS += -L/usr/lib/jvm/java-11-openjdk-amd64/server -ljvm<br>
endif<br>
endif<br>
endif</p>
<p>ifeq ($(OS), freebsd)<br>
LIBS+=-pthread<br>
endif<br>
ifeq ($(OS), linux)<br>
DEFS += -I/usr/lib/jvm/java-11-openjdk-amd64/include -I /usr/lib/jvm/java-11-openjdk-amd64/include/linux<br>
endif<br>
endif</p>
<h1>disable optimisation for segfaults debugging</h1>
<p>ifeq ($(USE_GCJ),yes)<br>
INCLUDE += -O0 -g<br>
INCLUDES += -O0 -g<br>
endif</p>
<p>include ../../Makefile.modules<br>
`</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/kamailio/kamailio/issues/1969?email_source=notifications&email_token=ABO7UZLYV2O2OZQZ4PENDFLPYE2SVA5CNFSM4HRDQRTKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWVNGFA#issuecomment-497734420">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABO7UZKWUO2ZFUEHM2BXU7TPYE2SVANCNFSM4HRDQRTA">mute the thread</a>.<img src="https://github.com/notifications/beacon/ABO7UZJYJUHEK6JNWGHX4JLPYE2SVA5CNFSM4HRDQRTKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWVNGFA.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/kamailio/kamailio/issues/1969?email_source=notifications\u0026email_token=ABO7UZLYV2O2OZQZ4PENDFLPYE2SVA5CNFSM4HRDQRTKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWVNGFA#issuecomment-497734420",
"url": "https://github.com/kamailio/kamailio/issues/1969?email_source=notifications\u0026email_token=ABO7UZLYV2O2OZQZ4PENDFLPYE2SVA5CNFSM4HRDQRTKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWVNGFA#issuecomment-497734420",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>