Install Weblogic Server locally on Windows desktop PC

I am going to demonstrate with Weblogic 12.1.3 and JDK 161.

In order to get Weblogic working, we have to have JDK installed, so let’s get that out of the way. JDK 9 had compatability problems, so I used JDK 8 u 161.

Remember that once JDK is installed, you need to set the JAVA_HOME parameter. This is under environment variables.

For e.g. you set JAVA_HOME to C:\Program Files\Java\jdk1.8.0_161

When you are in command prompt, you need to verify two things:

1. c:\ java -version will give you an output like

java version “1.8.0_161”
Java(TM) SE Runtime Environment (build 1.8.0_161-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode)

If this is not the case, we need to check if the “path” parameter under system variables has this entry C:\ProgramData\Oracle\Java\javapath

You might need to restart your computer if this is not showing up.

2. At command prompt you type echo %JAVA_HOME% and this gives you the folder path C:\Program Files\Java\jdk1.8.0_161

You might need to restart your computer if this is not showing up.

Now we come to the actual installation of Weblogic Server.

1. Extract the contents of the zip file into a directory (recommeded directory is c:/home/myhome/mywls/wls12130).

2. Set the MW_HOME parameter under system variables to c:/home/myhome/mywls/wls12130. You can test if this is set by checking on command prompt

>echo %MW_HOME%

You might need to restart your computer if this is not showing up.

3. Run the installation configuration script in the MW_HOME directory.

i.e. in CMD prompt, under MW_HOME directory execute

> configure.cmd -silent

4. Setup WLS environment in the current shell

> %MW_HOME%\wlserver\server\bin\setWLSEnv.cmd

5. It is recommended that we create domains outside the MW_HOME

 

>mkdir C:\home\myhome\mydomain

>cd C:\home\myhome\mydomain

Create the domain by invoking the GUI configuration
wizard (Run MW_HOME/wlserver/common/bin/config.cmd). The GUI will ask you to create an Admin User and Password.

6. Start a browser and open up url – ‘http://localhost:7001/console’ to
administer the server using the Admin User and Password. The default Admin User is “weblogic”

Please note, that in the weblogic server C:\home\myhome\mywls\wls12130\README_WIN.txt is a good readme file. I have obviously followed the steps mentioned there.

Classpath definition for command line execution of Java Programs

I was trying to execute a really simple program in my Intellij IDE:

package com.example;

public class TestCLI {

    public static void main(String args[]) {
        for (int i = 0; i < args.length; i++) {
            System.out.println("args[" + i + "]: " +
                    args[i]);
        }
    }

}

Executing this program with
java TestCLI anti dote
We will see the following output:
args[0]: anti
args[1]: dote

My problem with the command line, was that it was constantly throwing an error at me:

Fehler: Hauptklasse com.example.TestCLI konnte nicht gefunden oder geladen werden

Error: Could not find or load main class com.example.TestCLI

The problem is that Intellij stores the complied classes (.class files) in another “out” directory, whereas the .java files stay in the “src” directory.

So then I had to rewrite the java command as

java -classpath C:\Users\XXXXX\IdeaProjects\Examples\out\production\Examples com.example.TestCLI anti dote

Here it is interesting to note that the folder “Examples” is the Project folder. Which further divides itself into src and out folders. The classpath has to refer to out\production\Examples.

The actual path of the class com\example\TestCLI.class has to be rewritten as com.example.TestCLI and then the parameters “anti” and “dote” are added.