如何更改Bluemix中使用的Java版本?

时间:2022-08-24 07:26:25

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应用程序,我试图在Bluemix中运行。我想使用Java 1.5或Java 1.6。我该怎么办?

1 个解决方案

#1


5  

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

您需要使用Java buildpack,可以在https://github.com/cloudfoundry/java-buildpack上找到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.

要在部署应用程序时使用它,您可以将其添加到manifest.yml或使用Cloud Foundry CLI指定buildpack。你可以用以下方法做到这一点。

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

manifest.yml

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.

使用该buildpack部署应用程序后,可以使用以下命令指定Java的版本。

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.

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

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

您需要在更改Java版本后重新启动/重新启动应用程序。您可以使用以下方法执行此操作。

cf restage myappname

#1


5  

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

您需要使用Java buildpack,可以在https://github.com/cloudfoundry/java-buildpack上找到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.

要在部署应用程序时使用它,您可以将其添加到manifest.yml或使用Cloud Foundry CLI指定buildpack。你可以用以下方法做到这一点。

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

manifest.yml

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.

使用该buildpack部署应用程序后,可以使用以下命令指定Java的版本。

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.

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

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

您需要在更改Java版本后重新启动/重新启动应用程序。您可以使用以下方法执行此操作。

cf restage myappname