ClassFormatError :Absent Code attribute Exception


I wrote this test program to reproduce a problem I am having with Kotlin in Eclipse Oxygen.2 Release (4.7.2). The program works in the IDE but does not work as a run-able jar. Had same problem with Idea 2017.3. Spent hours trying to figure this out. Any help would be appreciated. These are the only two classes in the project. The reason I am using a java main class is that neither IDE will recognize a Kotlin main class when building the jar. And I do have the main class specified in the build configuration. In Eclipse I am using FIle > Export to build a run-able jar.

Windows 8.1x64

h:\KOTPROJECTS\TEST\jar>java -jar test.jar

Testing reveal function

Exception in thread “main” java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(
Caused by: java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file com/edrinx/netfa
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at Source)
at Source)
at$100(Unknown Source)
at$ Source)
at$ Source)
at Method)
at Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at com.edrinx.netfaxservice.AppDriver.main(
… 5 more

This is the main java class:
package com.edrinx.netfaxservice;

public class AppDriver {

public static void main(String[] args) {
	System.out.println("Testing reveal function");
	FaxBase.Companion.reveal(false, "Testing reveal function");


This is the target Kotlin class:
package com.edrinx.netfaxservice

import java.nio.file.Paths
import java.time.LocalDateTime
import java.time.format.DateTimeFormatter
import java.time.format.DateTimeFormatter.BASIC_ISO_DATE

class FaxBase {
companion object {
@JvmStatic fun reveal( pSuccess : Boolean, pMsg : String?) : Boolean{
val tPath : String
val tLog : String

    if (pSuccess) {
        return pSuccess
        try {
            val currentRelativePath = Paths.get("")
            tPath = currentRelativePath.toAbsolutePath().toString()
            val localDateTime =
            val formatter: DateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")
            tLog = tPath + "\\NETFAXSVC" + localDateTime.format(BASIC_ISO_DATE) + ".LOG"

            File(tLog).appendText(localDateTime.format(formatter) + " " + pMsg + "\r\n")
            return pSuccess

        } catch (e : Exception){
            return false



me too, trying to get a swt / jface desktop application to work with a mix of java and kotlin code in eclipse. Export to runnable jar file, same error occurs when running jar via java -jar command.