将Heroku App更新到Java 8 [英] Updating Heroku App to Java 8

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

问题描述

我有一个 Play 2.2 应用程序,我在使用Java 8时遇到了麻烦。该代码使用OpenJDK 1.8在本地编译,但是当我尝试将代码推送到Heroku时,出现以下错误,这是我在本地早些时候在OpenJDK 1.7上运行时遇到的错误, p>

  java.lang.RuntimeException:未知常量:18 

我将 system.properties 设置为使用Java 1.8,我知道这很有效,因为它是用以下文本启动的:

 播放2.x  - 检测到Java应用程序
----->安装OpenJDK 1.8 ...完成

有没有什么我忘记要更新到Java 8


我尝试更新PATH以及指定这里但那没有做任何事情。 http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.4> CONSTANT_InvokeDynamic 标记在类文件的常量池中,其值 18 。这不可能是JDK问题,因为即使是Java 7也理解该标签。



因此,它是运行在您的运行时中的字节代码操作工具不能理解新类的指标文件(但尽管未知版本号仍试图处理它们)。这与Java 7一起工作,因为存在 invokedynamic 功能,但不能用于普通Java 7类文件(即由 javac )。

既然你知道自己是否使用了字节码操作,它必须是框架的一部分,也就是你命名为heroku和playframework。所以你的问题不是关于更新JDK,而是将框架更新为支持Java-8的版本,如果这些版本已经存在。


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

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

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 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.

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).

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 App更新到Java 8的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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