skip to Main Content

I have a JavaServer Pages (JSP) application and I’m trying to run it in VSCode using the Community Server Connector extension with Tomcat server. I have some environment variables that are used in the project. They are currently defined in the .bashrc file, but this causes the variables to be defined throughout the machine’s environment. I would like to define them only for the specific project. Is there a way to do this? If so, how?

I have very little experience in the Java universe, but I need to run this project.

When they are configured in .bashrc it works.

2

Answers


  1. Chosen as BEST ANSWER

    The solution that worked best for me was to add "mapProperty.launch.env" to the server settings

    To do this, just right-click on the server and then click on Edit Server, a JSON file will open and then I added "mapProperty.launch.env" which receives an object with a set of key-value pairs

    https://github.com/redhat-developer/vscode-server-connector/issues/613


  2. you can try creating a .env file or script file to set the environment variables. Add <%= %> to the jsp page to access environment variables directly. Or you can creating a container and develop in a container. This requires the Dev Containers extension to be installed in vscode. Then download Docker to create and manage containers. Click the status bar item in vscode and select New Dev Container to create a new container.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search