简体   繁体   中英

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

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM