Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where do we need to pass the value for System.getProperty in Eclipse

Tags:

java

eclipse

I have imported an existing Java EE application into my Eclipse IDE.

I found this piece of code under it

public static String decideEnv() {
        String env = null;
        env = (String) System.getProperties().get("TB_ENVIRONEMNT");
            return env;
    }

could anybody please let me know from where exactly it gets the value with this line

System.getProperties().get("TB_ENVIRONEMNT")

Do we need to set this value anywhere ??

like image 351
Pawan Avatar asked Dec 12 '22 22:12

Pawan


2 Answers

Go to Run/Run Configurations, locate your run configuration (I guess you are using applicaiton server), choose it and add -DTB_ENVIRONEMNT=your value here to Arguments tab, text area "VM arguments"

like image 196
AlexR Avatar answered Jan 16 '23 07:01

AlexR


There can be multiple ways to set the system properties, following ways are common

  1. search in your code if it sets programatically (do file search )
  2. When it loads the app to server, we can pass the system properties there too
  3. Also see in your native OS's system properties
like image 20
jmj Avatar answered Jan 16 '23 05:01

jmj