202 Lotus blogs updated hourly. Who will post next? Home | Blogs | Search | About 
Latest 7 Posts
Ways to avoid Information Governance pitfalls
Wed, Oct 5th 2016 5
Ways to avoid Information Governance pitfalls
Wed, Oct 5th 2016 10
Finding PCI and PII Data with Discovery Attender
Wed, Sep 21st 2016 8
Finding PCI and PII Data with Discovery Attender
Wed, Sep 21st 2016 11
Bring Your Own Device & Data Security
Tue, Aug 30th 2016 5
Bring Your Own Device & Data Security
Tue, Aug 30th 2016 9
Understanding the General Data Protection Regulation
Wed, Aug 24th 2016 5
Top 10
Important Exchange 2016 Information for Mail Attender Clients
Tue, Nov 3rd 2015 11
Off the topic: Become a tailgating all-star
Thu, Nov 5th 2015 11
Off-the-topic: 5 Winter Getaway Ideas
Tue, Feb 9th 2016 11
Deleting Data from a Device: Is it really gone?
Tue, Feb 23rd 2016 11
Finding PCI and PII Data with Discovery Attender
Wed, Sep 21st 2016 11
Off-the-topic: Top 5 iPhone apps for the “Type A” crowd
Fri, May 2nd 2014 10
Cloud Computing: Is the Risk Worth the Reward?
Fri, May 2nd 2014 10
Ways to avoid Information Governance pitfalls
Wed, Oct 5th 2016 10
Infographic: Two-Question Survey on Policy Enforcement and eDiscovery
Mon, Oct 12th 2015 9
Bring Your Own Device & Data Security
Tue, Aug 30th 2016 9

From LotusScript to Java: Part 3
Twitter Google+ Facebook LinkedIn Addthis Email Gmail Flipboard Reddit Tumblr WhatsApp StumbleUpon Yammer Evernote Delicious
Grant Lindsay    

Last time, we covered some Java basics:

  • Java is case-sensitive. This is just something you will need to get used to, even if it does seem restrictive at first.
  • Java is object-oriented. This should not be too difficult for most LotusScript developers, since we use classes and objects all the time in accessing Domino data.
  • There is a “Java Way” of doing things. There is a lot to learn here, but the reward is (hopefully) worth the journey, and you do not need to get it all at once; one step at a time.
  • You need to set up a Java development environment. That means the JDK from Oracle and your favorite text editor. The command line awaits.

Hopefully, you were able to get your Java development environment set up. If not, feel free to reach out in the comment section below and I will see if I can help. So, for those who are set to go, let’s go.

I mentioned that Java can be verbose, but it can also be powerful. I also asked you to think of a way using LotusScript to parse a string like 2014-02-15T12:08:56.235-0500 into a real date/time value. Let’s use this for the basis of our first Java program.


Here is how it will work

  1. Create a folder to hold your source code. I called mine, “Demo” and paced it under the Java folder on my machine.
    D:Program FilesJava>mkdir Demo
    D:Program FilesJava>dir
     Volume in drive D is Data
     Volume Serial Number is BCED-242A
     Directory of D:Program FilesJava
    04/15/2014  03:16 PM    <DIR>          .
    04/15/2014  03:16 PM    <DIR>          ..
    04/15/2014  03:16 PM    <DIR>          Demo
    01/17/2014  01:58 PM    <DIR>          jdk1.6.0_35
    01/17/2014  01:43 PM    <DIR>          jdk1.7.0_51
    01/17/2014  01:59 PM    <DIR>          jre6
    01/17/2014  01:43 PM    <DIR>          jre7
                   0 File(s)              0 bytes
                   8 Dir(s)  19,048,337,408 bytes free
  2. Use a text editor to create a file called DateParse.java and paste the source code into the new file. (The source code is in the next section.)
  3. Save it.
    D:Program FilesJavaDemo>dir
     Volume in drive D is Data
     Volume Serial Number is BCED-242A
     Directory of D:Program FilesJavaDemo
    04/15/2014  03:03 PM    <DIR>          .
    04/15/2014  03:03 PM    <DIR>          ..
    04/15/2014  12:05 PM               632 DateParse.java
                   1 File(s)            632 bytes
                   2 Dir(s)  19,048,292,352 bytes free
  4. Compile your program.
    D:Program FilesJavaDemo>..jdk1.6.0_35binjavac DateParse.java

    Use the path to your java compiler (javac.exe)
    No news is good news. If the program compiles successfully, there will be no message from the compiler. If there is any output, these will be either errors or warnings.

  5. Run your program.
    D:Program FilesJavaDemo>..jdk1.6.0_35binjava DateParse
    Input: 2014-02-15T12:08:56.235-0500
    Output: Sat Feb 15 12:08:56 EST 2014

javac.exe does the compiling, java.exe does the running.
Code. Compile. [Fix Compile Errors.] Run. [Fix Run Errors.] Repeat.

Source Code

Here is the source code, simplified for copying:

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class DateParse {
    public static void main(String[] args) {
        try {
            String input = "2014-02-15T12:08:56.235-0500";
            String dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZ";
            SimpleDateFormat formatter = new SimpleDateFormat(dateFormat);
            Date output = formatter.parse(input);
            System.out.println("Input: " + input);
            System.out.println("Output: " + output);
        } catch (ParseException e) {

Here is the source code, annotated for learning:

01 /* These are the classes that our program will need.
02  * Though Java comes with thousands of classes, we need to tell the compiler
03  * which ones we are actually going to use.
04  * The java "import" statement is like the LotusScript, "Use" statement.
05  */
06 import java.text.ParseException;
07 import java.text.SimpleDateFormat;
08 import java.util.Date;
10 // This is our main class. Our program's starting point.
11 // The Java Runtime Environment (JRE)--the system that will actually run our 
12 // compiled code--looks for this class. It is required that the file name 
13 // match the class name.
14 public class DateParse {
16     // Our main class needs... well, a "main" method.
17     // The declaration needs to look just like this. Here is what each
18     // keyword means:
19     //
20     // public - The method is visible (can be called) from other objects of
21     //          other types.
22     // static - The method is associated with the class, not a specific
23     //          instance (object) of that class. This means that you can
24     //          call a static method without creating an object of the class.
25     // void   - The method has no return value.
26     //
27     // The JRE needs this method to be declared just like this so that it
28     // can start our program. It will find our class, DateParse, and
29     // call the DateParse.main() method, passing in an array of Strings, if
30     // there were any provided on the command line.
31     public static void main(String[] args) {
33         // The "try... catch" construct is Java's error handling, called,
34         // "exception handling."
35         // We'll pick up the details of this later. For now, think of this 
36         // like "On Error Goto" in LotusScript.
37         try {
38             // A string that represents our date to parse.
39             // (Tip: We could have also passed this value on the command 
40             // line and extracted from the "args" array.)
41             String input = "2014-02-15T12:08:56.235-0500";
43             // A string that describes the pieces of our date string.
44             String dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZ";
46             // The set up: A built-in class that will do the hard work 
47             // for us. If this class existed in LotusScript, this line 
48             // might look like:
49             //
50             // Dim Formatter as New SimpleDateFormat(DateFormat)
51             //
52             SimpleDateFormat formatter = new SimpleDateFormat(dateFormat);
54             // The call: Now, we call the method to do the work.
55             // The parse() method takes our string that represents a date, 
56             // parses it using the pattern we provided in the previous line, 
57             // and returns the result as an actual Date object.
58             // We store the result in "output," which we have declared as a Date.
59             Date output = formatter.parse(input);
61             // Now, we print the input and out put to the console.
62             System.out.println("Input: " + input);
63             System.out.println("Output: " + output);
65         catch (ParseException e) {
66             // The parse() method can complain if the pattern doesn't match the 
67             // input. It complains by "throwing an exception," like LotusScript 
68             // calls can encounter run-time errors.
69             // The catch block will get called if that happens. Here, we just
70             // print the exception details to the console.
71             e.printStackTrace();
72         }
73     }
74 }


Here are the explanation and comparisons of our first Java program to what we know from LotusScript:

Statement Endings

New line

Dim strFoo As String
strFoo = "foo"

String strFoo = "foo";


Single Line:





Single Line:




Including Outside Libraries

Use "My Library"
import java.text.SimpleDateFormat;

Variable Declarations

Dim strInput As String
strInput = "foo"
String strInput;
strInput = "foo";

You can also combine the declaration and the assignment:

String strInput = "foo";

Method Declarations

Returns a value:

Public Function GetCount() As Integer
    GetCount = 0
End Function

Does not return a value:

Public Sub PrintCount()
End Sub
Returns a value:

public int getCount() {
    return 0;

Does not return a value:

public void printCount() {

(More help on the date parsing formats can be found on Oracle’s website.)

I hope this was helpful. It is just a start, but you should feel good about getting a development environment set up and creating your first Java program. Don’t worry if you got stuck or something didn’t work as expected – that has happened to all of us, and it is part of the learning process for anything new.

Next time, we will move over to Domino Designer and begin working with Domino data. Feel free to reach out for help in the comment section below.

May 02, 2014
6 hits

Recent Blog Posts
Ways to avoid Information Governance pitfalls
Wed, Oct 5th 2016 2:25p   Jeff Tujetsch
Ways to avoid Information Governance pitfalls Information Governance (IG) -It sounds like it is a very extensive process because unfortunately, it is.  There are many components to IG, with the two major players being software and people. In this article, I will try to expose possible issues that you can hopefully avoid. For those of you that have had school-age kids, you can attest to the kids succeeding more when a routine is established and followed. So why am I talking about routine? Beca
Finding PCI and PII Data with Discovery Attender
Wed, Sep 21st 2016 1:21p   Marta Farensbach
Various privacy laws and other data security regulations detail how private, financial, and other confidential records should be handled. These rules cover the usage and storage of data, such as credit card numbers, social security numbers, social insurance information, and health care records. As described in a previous blog article, having this Personally Identifiable information (PII) or Payment Card Industry (PCI) data loose in your system can cause all kinds trouble, ranging from fi
Bring Your Own Device & Data Security
Tue, Aug 30th 2016 4:25p   Harvey Coblin
With the proliferation of portable electronic devices, increasing numbers of professionals are preferring to carry their own smart phones, laptops, tablets, etc. to use for work-related purposes. Rather than transporting duplicate devices to distinguish between professional vs. personal data, employees can work where and when they please and with hardware and applications they are already familiar with. It is estimated worldwide that one in three employees are utilizing personal devices at the
Understanding the General Data Protection Regulation
Wed, Aug 24th 2016 1:13p   Rick Wilson
If your organization has international operations in the European Union, you should be planning for GDPR compliance now! The General Data Protection Regulation (GDPR) is set to become the overriding data protection regulation with the EU. It was adopted by the European Parliament Council and Commission in 2015, took effect in 2016 and enforcement is scheduled to begin in May of 2018. At its core, the GDPR is intended to provide citizens of the EU with greater control over their personal data
Targeting Risks in IT – 5 Things to Consider
Mon, Jul 11th 2016 6:04p   Marta Farensbach
Today’s compliance, litigation, and regulation-heavy business environments introduce a number of challenges for busy IT professionals. Ignoring any of these areas, as well as failing to implement a strong Information Governance (IG) platform, can introduce substantial risk into your organization. In the worst cases, data breaches, adverse judgements, or non-compliance penalties could thrust a company into the glare of national headlines. Poor policy can affect more than just the finances of a
FOIA reforms are on the way, are you ready?
Wed, Jun 22nd 2016 2:06p   Rick Wilson
If you are employed by a federal government agency, then you are probably well aware of FOIA, or the Freedom of Information Act. FOIA was originally signed into law during the 1960’s by then President Lyndon B. Johnson to establish a process whereby citizens can request copies of governmental records that are not published in the Federal Registry. Agencies, in turn, are required to provide this information in a timely fashion (usually 20 days). Although FOIA is a federal mandate, it has also
Breach of Security: Measuring the Cost of Cyber Crime
Wed, Jun 8th 2016 2:10p   Harvey Coblin
Cybercrime is an increasing threat. Estimates vary widely, but according to a recent Reuters article, “Cyber crime costs (the) global economy $445 billion a year.” Other estimates place the costs as high as $1 trillion. The reason estimates vary is due in part to the fact that cybercrime can come in many forms, ranging from denial of service, theft of credit card or other financial information  (PCI/PII), industrial espionage, all the way up the ladder to state-sponsored terroris
How to Survive Data Discovery in the Digital Age
Wed, May 18th 2016 12:42p   Jeff Tujetsch
eDiscovery. That one word will make IT professionals start shaking. But, as the most technologically advanced civilization in the world, why is that? Is it because of what will be found? Is it because of what they are asked to search? Or is it because of the search terms they are asked to use? Well, the answer to each question is ‘Yes’. Data Discovery has grown into a multi-billion dollar world-wide business. Though the United States might lead the way because of our litigiousness,
Information Governance and the Internet of Things
Wed, May 11th 2016 2:28p   Marta Farensbach
Machines talking to machines.  Once the province of science fiction, the Internet of Things is set to transform industries as visionaries incorporate its wide reach into everyday objects. On a very simple level, the Internet of Things (IoT) describes the freeing of communication from the domain of computers and smart phones by allowing all types of devices to share information across the internet.  ‘Things’ like cars, fridges, health monitors, water meters and so much more can be empower
WHITE PAPER: Implementing Office 365: Inherent Features and the Need for Third Party Tools
Wed, May 4th 2016 12:59p   bhat67i
In this white paper, the topic of Office 365 and complementary solutions will be discussed; insights will be offered on a business’ future migration plans and knowing the options available. One will learn:  Why Office 365 is a compelling platform, Examples of productivity integrations, About the importance of information governance integration, Supplementing with third party software Click here to download this white paper! The post WHITE PAPER: Implementing Office 365: Inherent Fea

Created and Maintained by Yancy Lent - About - Planet Lotus Blog - Advertising - Mobile Edition