debian打包中的强制java版本

debian打包中的强制java版本,java,debian,packaging,jhbuild,Java,Debian,Packaging,Jhbuild,我尝试构建一个java应用程序的debian包。 我已经创建了所有需要的文件。我认为,我唯一的问题是在debian/rules中使用jh_build时强制使用java版本 事实上,这里是我当前的文件: #!/usr/bin/make -f %: dh $@ --with javahelper --sourcedirectory=sources override_jh_build: jh_build test.jar sources 我有以下输出: jh_build test

我尝试构建一个java应用程序的debian包。 我已经创建了所有需要的文件。我认为,我唯一的问题是在debian/rules中使用jh_build时强制使用java版本

事实上,这里是我当前的文件:

#!/usr/bin/make -f

%:
    dh $@ --with javahelper --sourcedirectory=sources

override_jh_build:
    jh_build test.jar sources
我有以下输出:

jh_build test.jar sources
warning: [options] bootstrap class path not set in conjunction with -source 7
sources/org/test/preferences/WindowHandler.java:29: error: lambda expressions are not supported in -source 7
        CoalescedEventUpdater updater = new CoalescedEventUpdater(400, () -> updatePref(frame, prefs));
                                                                          ^
  (use -source 8 or higher to enable lambda expressions)
sources/org/test/preferences/CoalescedEventUpdater.java:10: error: lambda expressions are not supported in -source 7
        timer = new Timer(delay, e -> {
                                   ^
  (use -source 8 or higher to enable lambda expressions)
2 errors
1 warning
jh_build: find sources -name '*.java' -and -type f -print0 | xargs -s 512000 -0 /usr/lib/jvm/default-java/bin/javac -g -cp :debian/_jh_build.test -d debian/_jh_build.test -encoding ISO8859-1 -source 1.7 -target 1.7  returned exit code 123
所以我的问题很简单,我需要在哪里写这个选项-源代码8? 我尝试作为jh_构建选项,但没有成功

编辑我已经按照评论中的建议尝试了这一行:

jh_build --javacopts="-source 1.8 -target 1.8" test.jar sources
输出几乎相同,除了第一句话

warning: [options] bootstrap class path not set in conjunction with -source 8
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
1 warning
sources/org/test/preferences/WindowHandler.java:29: error: lambda expressions are not supported in -source 7
        CoalescedEventUpdater updater = new CoalescedEventUpdater(400, () -> updatePref(frame, prefs));
                                                                          ^
  (use -source 8 or higher to enable lambda expressions)
sources/org/test/preferences/CoalescedEventUpdater.java:10: error: lambda expressions are not supported in -source 7
        timer = new Timer(delay, e -> {
                                   ^
  (use -source 8 or higher to enable lambda expressions)
2 errors

默认版本是Java 7,正如您在日志的最后一行所看到的
-source 1.7

您需要将所需版本传递到jh_版本,如下所示:

override_jh_build:
jh_build --javacopts="-source 1.8 -target 1.8" test.jar sources

注意:这听起来很明显,但您需要JDK 8或更高版本。

解决方案是定义javac和javadoc的版本

jh_build --javacopts="-source 1.8 -target 1.8" --javadoc-opts="-source 1.8" spview.jar sources

很抱歉,使用您的规则,我有相同的输出。这次我有:未知选项:java_opts jh_build:Unknown选项或选项解析期间出错;中止事实上,这个选项有一点不同,我已经编辑了我的问题。我发现了问题;)。请添加您的Java版本
javac-version
@AndiCover:javac-version javac 1.8.0\u 212,当然,代码在eclipse中编译良好,我可以运行该应用程序