如何更改Bluemix中使用的Java版本? [英] How can I change the version of Java used in Bluemix?

查看:133
本文介绍了如何更改Bluemix中使用的Java版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个旧的遗留Java应用程序,试图在Bluemix中运行。我想使用Java 1.5或Java 1.6。我该怎么做?

I have an old legacy Java app that I am trying to run in Bluemix. I would like to use either Java 1.5 or Java 1.6. How would I do this?

推荐答案

您需要使用Java buildpack,可通过 https://github.com/cloudfoundry/java-buildpack

You need to use the Java buildpack, the Java buildpack is available at https://github.com/cloudfoundry/java-buildpack.

要在部署应用程序时使用它,可以将其添加到 manifest.yml 或使用Cloud Foundry CLI指定构建包。您可以执行以下操作。

To use it when you deploy your app you can either add it to manifest.yml or use the Cloud Foundry CLI to specify the buildpack. You can do that with the following.

cf push myappname -b https://github.com/cloudfoundry/java-buildpack.git

manifest.yml

applications:
- path: .
  memory: 512MB
  instances: 1
  domain: mybluemix.net
  name: myappname
  host: myappname
  disk_quota: 1024M
  buildpack: https://github.com/cloudfoundry/java-buildpack.git

使用可以使用以下命令指定Java的版本。

Once you deploy your app with that buildpack you can specify the version of Java with the following command.

cf set-env myappname JBP_CONFIG_OPEN_JDK_JRE '{jre: { version: 1.7.0_+ }}'

然后您可以通过更改应用程序的Java版本来更改 1.7.0 更改为您想要的任何版本。

You can then change the version of Java for your app by changing 1.7.0 to whatever version you want.

在更改版本后,您需要重新启动/重新启动应用程序不过是Java版本。您可以执行以下操作。

You will need to restart/restage your app after you change the Java version though. You can do this with the following.

cf restage myappname

这篇关于如何更改Bluemix中使用的Java版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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