Tuesday, April 5, 2016

WebLogic Scripting Tool (WLST) Variable Values

When using WebLogic Scripting Tool (WLST) there are two common mechanisms that can be employed to obtain variable values outside of a Jython (.py) script. You can obtain a value from:
  1. An environment variable, or
  2. A properties file.

Using Environment Variables

When you need to obtain the value of an environment variable, import the os package into your script. Then, use the getenv() method to get the value of a specific environment variable.

import os

javaHome = os.getenv("JAVA_HOME")
print("JAVA_HOME is " + str(javaHome))

Using a Properties File

When you need to obtain the value of a property, use the loadProperties() method. Using this method, there is no need to declare the variable and assign a value. Instead, the property.name becomes the name of the variable. The property.value is the assigned value. You will need to define a properties file, e.g. wlstExample.properties.

myProperty=myValue

In the WLST script, reference the loadProperties() method and provide a path to the properties file. If the properties file is in the same directory, and likely it is, do not use a relative path like ../wlstExample.properties. Instead, just use the file name.

loadProperties("wlstExample.properties")
print("The value of myProperty is " + str(myProperty))

When executed, this script produces the following output.

[oracle@myHost ~]$ java weblogic.WLST wlstExample.py

Initializing WebLogic Scripting Tool (WLST) ...

Welcome to WebLogic Server Administration Scripting Shell

Type help() for help on available commands

JAVA_HOME is /usr/java/jdk1.7.0_75
The value of myProperty is myValue

19 comments:


  1. I have been reading for the past two days about your blogs and topics, still on fetching! Wondering about your words on each line was massively effective. Techno-based information has been fetched in each of your topics. Sure it will enhance and fill the queries of the public needs. Feeling so glad about your article. Thanks…!
    magento training course in chennai
    magento training institute in chennai
    magento 2 training in chennai
    magento development training
    magento 2 course
    magento developer training

    ReplyDelete
  2. In other words, an Office 365 migration that is stress-free! These objectives can be achieved by following these 7 steps: office 365

    ReplyDelete
  3. Thank you for sharing this informative article on WLST variables and scripting practices. Understanding how variables work in WLST scripts is very helpful for developers and administrators working with WebLogic automation and configuration management. Technical knowledge like this plays an important role in building strong programming and problem-solving skills. For those interested in building a career in modern software development and data technologies, structured training programs like Login360 provide hands-on learning and real-world project exposure. You can explore their industry-focused Data Science Course and Full Stack Developer Course designed to develop practical skills and job-ready expertise.

    ReplyDelete
  4. Great explanation of WLST variables and how they work within WebLogic scripting. Understanding how variables behave in WLST scripts can really help administrators automate repetitive configuration tasks and manage domains more efficiently. Since WLST is based on Jython, using variables and scripting logic makes automation much easier for developers and admins. ([Middleware DevOps][1]) Learning both technical and marketing skills is valuable today—exploring a digital marketing course in Chennai can also help professionals build strong online growth strategies.

    ReplyDelete
  5. Great insights on using WLST variables in WebLogic. Automating administrative tasks and scripting in WebLogic can save a lot of time and reduce errors for Java developers and system admins. For anyone looking to strengthen their programming and tech skills, courses like **Java course Chennai**, **Python course**, **Data Science course**, **Data Analytics course**, **Full Stack Development course**, and **UI/UX course** from Login360 can provide hands-on experience to build real-world projects efficiently.

    ReplyDelete
  6. Very helpful explanation of WLST variables and scripting concepts! It’s great to see how WLST leverages Python, allowing flexible variable handling and dynamic typing, which makes automation much easier for WebLogic administrators. Posts like this are really useful for both beginners and experienced professionals working with middleware automation. For those also looking to expand their skills in cloud technologies, you can check out this AWS Cloud Course to enhance your knowledge.

    ReplyDelete
  7. This blog explains how variables work in the WebLogic Scripting Tool (WLST) and how they can be used effectively in scripts. It highlights that WLST, based on Jython, supports dynamic variables that can store different data types and be reused across functions, making scripts more flexible and reusable. Understanding variable scope—global vs local—is important for writing clean and efficient automation scripts in WebLogic environments.

    UI/UX design course syllabus

    ReplyDelete
  8. This blog cleared many of my doubts. I found data science or data analytics equally helpful.data science or data analytics

    ReplyDelete
  9. Nice blog with thoughtful insights and engaging writing—really enjoyed the perspective shared here! Check out this UI UX design course online for enhancing your design skills.

    ReplyDelete
  10. Thanks for sharing this knowledge. I found similar useful info on best digital marketing training institute

    ReplyDelete
  11. This comment has been removed by the author.

    ReplyDelete
  12. Really helpful explanation of WLST variable assignment—clear and practical for WebLogic automation. This kind of breakdown makes complex configurations much easier to understand.

    Also, for building modern digital skills, check out Learn Digital Marketing from Experts.

    ReplyDelete
  13. Great explanation of handling variables in WLST—this is something that often trips people up when working with scripts, especially since WLST is based on Jython and behaves differently from typical shell scripting. The flexibility of using variables properly really makes automation and reuse much easier when managing WebLogic domains.

    For anyone new to it, the WebLogic Scripting Tool (WLST) is a Jython-based command-line environment used to create, manage, and monitor WebLogic domains, making scripting knowledge especially valuable for automation tasks.

    Also, if you’re exploring data-driven or scripting-heavy career paths, this resource might be helpful: Data Science vs Data Analytics.

    ReplyDelete