Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ecj throws exception NoClassDefFoundError (SourceVersion) #4704

Closed
tmatz opened this issue Dec 27, 2019 · 3 comments
Closed

ecj throws exception NoClassDefFoundError (SourceVersion) #4704

tmatz opened this issue Dec 27, 2019 · 3 comments
Labels
bug report Something is not working properly.

Comments

@tmatz
Copy link

tmatz commented Dec 27, 2019

Problem description

ecj throws exception when compiling java source file.

$ecj Hello.java
Exception in thread "main" java.lang.NoClassDefFoundError: Failed resolution of: Ljavax/lang/model/SourceVersion;
        at org.eclipse.jdt.internal.compiler.batch.FileSystem.<clinit>(FileSystem.java:180)
        at org.eclipse.jdt.internal.compiler.batch.FileSystem.getClasspath(Unknown Source:0)
        at org.eclipse.jdt.internal.compiler.util.Util.collectPlatformLibraries(Util.java:1248)
        at org.eclipse.jdt.internal.compiler.util.Util.collectVMBootclasspath(Util.java:1161)
        at org.eclipse.jdt.internal.compiler.batch.Main.handleBootclasspath(Main.java:3561)
        at org.eclipse.jdt.internal.compiler.batch.Main.setPaths(Main.java:5258)
        at org.eclipse.jdt.internal.compiler.batch.Main.configure(Main.java:3225)
        at org.eclipse.jdt.internal.compiler.batch.Main.compile(Main.java:1752)
        at org.eclipse.jdt.internal.compiler.batch.Main.main(Main.java:1496)
Caused by: java.lang.ClassNotFoundException: Didn't find class "javax.lang.model.SourceVersion" on path: DexPathList[[zip file "/data/data/com.termux/files/usr/share/dex/ecj.jar"],nativeLibraryDirectories=[/system/lib64, /system/lib64]]
        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
        ... 9 more

Steps to reproduce

Just compile following source.

Hello.java

public class Hello {
  public static void main(String[] args) {
    System.out.println("Hellod, on termux!");
  }
}

Expected behavior

Maybe .class file is created. (I never succeeded)

Additional information

$ecj -version
Eclipse Compiler for Java(TM) v20191203-2131, 3.20.0, Copyright IBM Corp 2000, 2015. All rights reserved.
Packages CPU architecture:
aarch64
Subscribed repositories:
# sources.list
deb https://termux.org/packages/ stable main
# science-repo (sources.list.d/science.list)
deb https://dl.bintray.com/grimler/science-packages-24 science stable
# sources.list.d/pointless.list
deb https://its-pointless.github.io/files/24 termux extras
Updatable packages:
All packages up to date
Android version:
9
Kernel build information:
Linux localhost 4.9.112-16982790 #2 SMP PREEMPT Fri Nov 1 17:45:31 KST 2019 aarch64 Android
Device manufacturer:
samsung
Device model:
SM-T720
@ghost ghost added the bug report Something is not working properly. label Dec 27, 2019
ghost pushed a commit that referenced this issue Dec 30, 2019
@ghost
Copy link

ghost commented Dec 30, 2019

ECJ version 4.13 and higher seems using Java APIs not available on Android.

Downgraded package is available as ecj version 1:4.12 and is now working fine.

@ghost ghost closed this as completed Dec 30, 2019
@Harshiv-Patel
Copy link

SourceVersion.java doesn't seem to use any external classes other than java.util.xxx , so just including it in the source file from OpenJDK sources would also work, I guess?

@ghost
Copy link

ghost commented Dec 31, 2019

@Harshiv-Patel We are not building ECJ from source.

@ghost ghost locked and limited conversation to collaborators Oct 9, 2021
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug report Something is not working properly.
Projects
None yet
Development

No branches or pull requests

2 participants