How can I change the version of Java used in Bluemix?

大兔子大兔子 提交于 2019-12-10 21:09:52

问题


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?


回答1:


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

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

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_+ }}'

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

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


来源:https://stackoverflow.com/questions/33187071/how-can-i-change-the-version-of-java-used-in-bluemix

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!