pquiring / javaforce

JavaForce library for building powerful Apps and Services (Native Bindings for Camera, OpenGL, ffmpeg). Includes VoIP stack, PLC I/O and many apps.
http://pquiring.github.io/javaforce
GNU Lesser General Public License v3.0
55 stars 24 forks source link

Doesn't build on openjdk version 1.8.0 #5

Closed NNTin closed 3 years ago

NNTin commented 3 years ago
nntin@ubuntu:~/git/javaforce-30.0$ ant compile
Buildfile: /home/nntin/git/javaforce-30.0/build.xml

depnatives:

glfw:
     [exec] The command attribute is deprecated.
     [exec] Please use the executable attribute and nested arg elements.
     [exec] Cloning into 'native/glfw'...

depjars:

compile:
    [mkdir] Created dir: /home/nntin/git/javaforce-30.0/classes
    [javac] Compiling 395 source files to /home/nntin/git/javaforce-30.0/classes
    [javac] /home/nntin/git/javaforce-30.0/src/javaforce/JFCompiler.java:19: error: package com.sun.source.tree does not exist
    [javac] import com.sun.source.tree.CompilationUnitTree;
    [javac]                           ^
    [javac] /home/nntin/git/javaforce-30.0/src/javaforce/JFCompiler.java:20: error: package com.sun.source.util does not exist
    [javac] import com.sun.source.util.*;
    [javac] ^
    [javac] /home/nntin/git/javaforce-30.0/src/javaforce/JFCompiler.java:21: error: package com.sun.source.tree does not exist
    [javac] import com.sun.source.tree.*;
    [javac] ^
    [javac] /home/nntin/git/javaforce-30.0/src/javaforce/JFCompiler.java:22: error: cannot find symbol
    [javac] import javax.lang.model.element.ModuleElement;
    [javac]                                ^
    [javac]   symbol:   class ModuleElement
    [javac]   location: package javax.lang.model.element
    [javac] /home/nntin/git/javaforce-30.0/src/javaforce/JFCompiler.java:77: error: cannot find symbol
    [javac]   public static boolean parse(String inFolder, TreeScanner scanner) {
    [javac]                                                ^
    [javac]   symbol:   class TreeScanner
    [javac]   location: class JFCompiler
    [javac] /home/nntin/git/javaforce-30.0/src/javaforce/JFCompiler.java:100: error: cannot find symbol
    [javac]   public static boolean analyze(String inFolder, ElementScanner9 scanner) {
    [javac]                                                  ^
    [javac]   symbol:   class ElementScanner9
    [javac]   location: class JFCompiler
    [javac] /home/nntin/git/javaforce-30.0/src/javaforce/JFCompiler.java:122: error: cannot find symbol
    [javac]   public static class TScanner<R, P> extends TreeScanner<R, P> {
    [javac]                                              ^
    [javac]   symbol:   class TreeScanner
    [javac]   location: class JFCompiler
    [javac] /home/nntin/git/javaforce-30.0/src/javaforce/JFCompiler.java:123: error: cannot find symbol
    [javac]     public R visitCompilationUnit(CompilationUnitTree node, P p) {
    [javac]                                   ^
    [javac]   symbol:   class CompilationUnitTree
    [javac]   location: class TScanner<R,P>
    [javac]   where R,P are type-variables:
    [javac]     R extends Object declared in class TScanner
    [javac]     P extends Object declared in class TScanner
    [javac] /home/nntin/git/javaforce-30.0/src/javaforce/JFCompiler.java:127: error: cannot find symbol
    [javac]     public R visitPackage(PackageTree node, P p) {
    [javac]                           ^
    [javac]   symbol:   class PackageTree
    [javac]   location: class TScanner<R,P>
    [javac]   where R,P are type-variables:
    [javac]     R extends Object declared in class TScanner
    [javac]     P extends Object declared in class TScanner
    [javac] /home/nntin/git/javaforce-30.0/src/javaforce/JFCompiler.java:131: error: cannot find symbol
    [javac]     public R visitImport(ImportTree node, P p) {
    [javac]                          ^
    [javac]   symbol:   class ImportTree
    [javac]   location: class TScanner<R,P>
    [javac]   where R,P are type-variables:
    [javac]     R extends Object declared in class TScanner
    [javac]     P extends Object declared in class TScanner
    [javac] /home/nntin/git/javaforce-30.0/src/javaforce/JFCompiler.java:135: error: cannot find symbol
    [javac]     public R visitClass(ClassTree node, P p) {
    [javac]                         ^
    [javac]   symbol:   class ClassTree
    [javac]   location: class TScanner<R,P>
    [javac]   where R,P are type-variables:
    [javac]     R extends Object declared in class TScanner
    [javac]     P extends Object declared in class TScanner
    [javac] /home/nntin/git/javaforce-30.0/src/javaforce/JFCompiler.java:139: error: cannot find symbol
    [javac]     public R visitMethod(MethodTree node, P p) {
    [javac]                          ^
    [javac]   symbol:   class MethodTree
    [javac]   location: class TScanner<R,P>
    [javac]   where R,P are type-variables:
    [javac]     R extends Object declared in class TScanner
    [javac]     P extends Object declared in class TScanner
    [javac] /home/nntin/git/javaforce-30.0/src/javaforce/JFCompiler.java:145: error: cannot find symbol
    [javac]   public static class EScanner<R, P> extends ElementScanner9<R, P> {
    [javac]                                              ^
    [javac]   symbol:   class ElementScanner9
    [javac]   location: class JFCompiler
    [javac] /home/nntin/git/javaforce-30.0/src/javaforce/JFCompiler.java:146: error: cannot find symbol
    [javac]     public R visitModule(ModuleElement e, P p) {
    [javac]                          ^
    [javac]   symbol:   class ModuleElement
    [javac]   location: class EScanner<R,P>
    [javac]   where R,P are type-variables:
    [javac]     R extends Object declared in class EScanner
    [javac]     P extends Object declared in class EScanner
    [javac] /home/nntin/git/javaforce-30.0/src/javaforce/JF.java:876: error: cannot find symbol
    [javac]     return (int)ProcessHandle.current().pid();
    [javac]                 ^
    [javac]   symbol:   variable ProcessHandle
    [javac]   location: class JF
    [javac] /home/nntin/git/javaforce-30.0/src/javaforce/KeyMgmt.java:44: error: cannot find symbol
    [javac]       String output = new String(is.readAllBytes());
    [javac]                                    ^
    [javac]   symbol:   method readAllBytes()
    [javac]   location: variable is of type InputStream
    [javac] /home/nntin/git/javaforce-30.0/src/javaforce/JFCompiler.java:87: error: cannot find symbol
    [javac]       JavacTask task = (JavacTask)compiler.getTask(null, fileManager, null, options, null, compilationUnits);
    [javac]       ^
    [javac]   symbol:   class JavacTask
    [javac]   location: class JFCompiler
    [javac] /home/nntin/git/javaforce-30.0/src/javaforce/JFCompiler.java:87: error: cannot find symbol
    [javac]       JavacTask task = (JavacTask)compiler.getTask(null, fileManager, null, options, null, compilationUnits);
    [javac]                         ^
    [javac]   symbol:   class JavacTask
    [javac]   location: class JFCompiler
    [javac] /home/nntin/git/javaforce-30.0/src/javaforce/JFCompiler.java:88: error: cannot find symbol
    [javac]       Iterable<? extends CompilationUnitTree> tree = task.parse();
    [javac]                          ^
    [javac]   symbol:   class CompilationUnitTree
    [javac]   location: class JFCompiler
    [javac] /home/nntin/git/javaforce-30.0/src/javaforce/JFCompiler.java:110: error: cannot find symbol
    [javac]       JavacTask task = (JavacTask)compiler.getTask(null, fileManager, null, options, null, compilationUnits);
    [javac]       ^
    [javac]   symbol:   class JavacTask
    [javac]   location: class JFCompiler
    [javac] /home/nntin/git/javaforce-30.0/src/javaforce/JFCompiler.java:110: error: cannot find symbol
    [javac]       JavacTask task = (JavacTask)compiler.getTask(null, fileManager, null, options, null, compilationUnits);
    [javac]                         ^
    [javac]   symbol:   class JavacTask
    [javac]   location: class JFCompiler
    [javac] /home/nntin/git/javaforce-30.0/src/javaforce/JFCompiler.java:125: error: non-static variable super cannot be referenced from a static context
    [javac]       return super.visitCompilationUnit(node, p);
    [javac]              ^
    [javac] /home/nntin/git/javaforce-30.0/src/javaforce/JFCompiler.java:129: error: non-static variable super cannot be referenced from a static context
    [javac]       return super.visitPackage(node, p);
    [javac]              ^
    [javac] /home/nntin/git/javaforce-30.0/src/javaforce/JFCompiler.java:133: error: non-static variable super cannot be referenced from a static context
    [javac]       return super.visitImport(node, p);
    [javac]              ^
    [javac] /home/nntin/git/javaforce-30.0/src/javaforce/JFCompiler.java:137: error: non-static variable super cannot be referenced from a static context
    [javac]       return super.visitClass(node, p);
    [javac]              ^
    [javac] /home/nntin/git/javaforce-30.0/src/javaforce/JFCompiler.java:141: error: non-static variable super cannot be referenced from a static context
    [javac]       return super.visitMethod(node, p);
    [javac]              ^
    [javac] /home/nntin/git/javaforce-30.0/src/javaforce/JFCompiler.java:148: error: non-static variable super cannot be referenced from a static context
    [javac]       return super.visitModule(e, p);
    [javac]              ^
    [javac] /home/nntin/git/javaforce-30.0/src/javaforce/pi/GPIO.java:24: error: cannot find symbol
    [javac]       byte[] data = fis.readAllBytes();
    [javac]                        ^
    [javac]   symbol:   method readAllBytes()
    [javac]   location: variable fis of type FileInputStream
    [javac] /home/nntin/git/javaforce-30.0/src/javaforce/utils/FormatSource.java:152: error: cannot find symbol
    [javac]       byte[] data = fis.readAllBytes();
    [javac]                        ^
    [javac]   symbol:   method readAllBytes()
    [javac]   location: variable fis of type FileInputStream
    [javac] /home/nntin/git/javaforce-30.0/src/javaforce/utils/TestSOCKS.java:31: error: cannot find symbol
    [javac]         System.out.print(new String(is.readAllBytes()));
    [javac]                                       ^
    [javac]   symbol:   method readAllBytes()
    [javac]   location: variable is of type InputStream
    [javac] /home/nntin/git/javaforce-30.0/src/javaforce/utils/TestSSL.java:345: error: an enum switch case label must be the unqualified name of an enumeration constant
    [javac]             case NEED_UNWRAP_AGAIN:
    [javac]                  ^
    [javac] /home/nntin/git/javaforce-30.0/src/javaforce/voip/SRTPChannelJ9.java:183: error: an enum switch case label must be the unqualified name of an enumeration constant
    [javac]             case NEED_UNWRAP_AGAIN:
    [javac]                  ^
    [javac] Note: Some input files use or override a deprecated API.
    [javac] Note: Recompile with -Xlint:deprecation for details.
    [javac] 32 errors

BUILD FAILED
/home/nntin/git/javaforce-30.0/build.xml:45: Compile failed; see the compiler error output for details.

error: package com.sun.source.tree does not exist could be fixed with cp /usr/lib/jvm/java-8-openjdk-amd64/lib/tools.jar javaforce/jars/. ElementScanner9 is from the Oracle JDK. Please also support OpenJDK due to licensing.

pquiring commented 3 years ago

JavaForce usually requires the latest JDK - Current JDK15 is required for many features. Can you upgrade your JDK?

NNTin commented 3 years ago

That worked. Thank you! Is my understanding correct that even if I build it with OpenJDK 15 I can still use OpenJDK 8 to use the built javaforce.jar? My main project is using OpenJDK 8 and won't upgrade.

pquiring commented 3 years ago

Possibly, it depends on what methods are called. Most JARs are built with source level 8 (1.8 actually) so they should run under JDK8 unless they use methods that are not available in JDK8.

pquiring commented 3 years ago

If you using Linux such as Debian, they are finally releasing newer versions of Java in Debian 11 which is due out next year. I would just download and manually install newer versions of Java if possible.

NNTin commented 3 years ago

Thank you!