将 Heroku 应用程序更新到 Java 8 [英] Updating Heroku App to Java 8

查看:25
本文介绍了将 Heroku 应用程序更新到 Java 8的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 Play 2.2 应用程序,我在 Java 8 中使用,但无法正常工作.代码使用 OpenJDK 1.8 在本地为我编译,但是当我尝试将代码推送到 Heroku 时,我收到以下错误,这是我在使用 lambda 的 OpenJDK 1.7 上运行时在本地更早出现的错误.

I have a Play 2.2 app I'm using with Java 8 that I'm having trouble getting to work. The code compiles locally for me using OpenJDK 1.8, but when I try and push the code to Heroku, I get the following error, which was the error I was getting earlier locally when I was running on OpenJDK 1.7 with lambdas by accident.

java.lang.RuntimeException: Unknown constant: 18

我将 system.properties 设置为使用 Java 1.8 并且我知道这很有效,因为它以以下文本开头:

I set system.properties to use Java 1.8 and I know that's working because it's starting up with the following text:

Play 2.x - Java app detected
-----> Installing OpenJDK 1.8...done

是否有什么我忘记了更新到 Java 8 的事情?
我尝试更新路径以及指定 here 但这没有做任何事情.

Is there something I'm forgetting to do to update to Java 8?
I tried updating the PATH as well as specified here but that didn't do anything.

推荐答案

Unknown constant: 18 最有可能指的是 CONSTANT_InvokeDynamic 标记在类文件的常量池中,其值为 18.这不可能是 JDK 问题,因为即使是 Java 7 也能理解该标签.

Unknown constant: 18 most probably refers to CONSTANT_InvokeDynamic tag in the class file’s constant pool which has the value 18. This can’t be a JDK issue as even Java 7 understands that tag.

因此,它表明在您的运行时中运行的字节码操作工具无法理解较新的类文件(但尽管版本号未知,但仍会尝试处理它们).由于 invokedynamic 功能存在,所以它适用于 Java 7,但不适用于普通的 Java 7 类文件(即由 javac 生成).

So it is an indicator for a byte code manipulation tool running in your runtime not understanding newer class files (but trying to process them despite the unknown version number). That worked with Java 7 as the invokedynamic feature exists but is not used with ordinary Java 7 class files (i.e. produced by javac).

既然你知道如果你自己使用字节码操作,它必须是框架的一部分,即你命名为heroku和playframework.因此,您的问题不在于更新 JDK,而在于将框架更新为支持 Java 8 的版本(如果此类版本已经存在).

Since you knew if you used bytecode manipulation by yourself, it must be part of a framework, i.e. you named heroku and the playframework. So you problem is not about updating the JDK but updating the frameworks to Java-8-aware versions, if such versions already exist.

这篇关于将 Heroku 应用程序更新到 Java 8的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆