DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Last call! Secure your stack and shape the future! Help dev teams across the globe navigate their software supply chain security challenges.

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workloads.

Releasing software shouldn't be stressful or risky. Learn how to leverage progressive delivery techniques to ensure safer deployments.

Avoid machine learning mistakes and boost model performance! Discover key ML patterns, anti-patterns, data strategies, and more.

Related

  • Building a Simple Todo App With Model Context Protocol (MCP)
  • Mastering React App Configuration With Webpack
  • How to Build a React Native Chat App for Android
  • How to Build Slack App for Audit Requests

Trending

  • MySQL to PostgreSQL Database Migration: A Practical Case Study
  • Beyond ChatGPT, AI Reasoning 2.0: Engineering AI Models With Human-Like Reasoning
  • Why High-Performance AI/ML Is Essential in Modern Cybersecurity
  • A Deep Dive Into Firmware Over the Air for IoT Devices

How to Set Environment Variables for a CloudFoundry App

By 
Hubert Klein Ikkink user avatar
Hubert Klein Ikkink
·
Jul. 02, 12 · Interview
Likes (0)
Comment
Save
Tweet
Share
11.6K Views

Join the DZone community and get the full member experience.

Join For Free

We can set environment variables for an application that is deployed in CloudFoundry. For example if we want to pass a JAVA_OPTS environment variable with a value of -XX:MaxPermSize=256m. We have to use the env-add command of the vmc command-line tool. We specify the application name we want to set the environment variable for followed by a key=value pair.

In the following command we set a JAVA_OPTS environment variable for the website application:

$ vmc env-add website JAVA_OPTS="-XX:MaxPermSize=256m -XX:+CMSClassUnloadingEnabled"
Adding Environment Variable [JAVA_OPTS="-XX:MaxPermSize=256m -XX:+CMSClassUnloadingEnabled"]: OK
Stopping Application: OK
Staging Application: OK
Starting Application: OK
$

To see which environment variables are set we can use the env command. To delete a variable we use env-del and the name of the environment variable.

$ vmc env website
 
+-----------+----------------------------------------------------+
| Variable  | Value                                              |
+-----------+----------------------------------------------------+
| JAVA_OPTS | -XX:MaxPermSize=256m -XX:+CMSClassUnloadingEnabled |
+-----------+----------------------------------------------------+
 
$ vmc env-del website JAVA_OPTS
Deleting Environment Variable [BLOG_OPTS]: OK
Stopping Application: OK
Staging Application: OK
Starting Application: OK
$

 

 

app

Published at DZone with permission of Hubert Klein Ikkink, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Building a Simple Todo App With Model Context Protocol (MCP)
  • Mastering React App Configuration With Webpack
  • How to Build a React Native Chat App for Android
  • How to Build Slack App for Audit Requests

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends: