R – Error: package or namespace load failed for “rJava”

Background

Users opens up a ticket regarding issues running an R Script on a new machine.

Error Message

Image

errorloadingpackage.rjava.20190109.0251pm

Textual


Error: package or namespace load failed for "rJava":
 .onLoad failed in loadNamespace() for 'rJava', details:
  call: fun(libname, pkgname)
  error: No CurrentVersion entry in Software/JavaSoft registry!
  Try re-installing Java and make sure R and Java have matching architectures.

Explanation

Unable to load rJava module.

Troubleshooting

java

Is java Installed?

Outline

  1. OS Platform
    • OS :- Windows
      • GUI
        • Control Panel
      • Console
        • java.exe

OS Platform

MS Windows
GUI – Control Panel

Accessed Control Panel, but no Java Applet.controlpanel.20190109.0355pm

Console – java.exe

Syntax


java -version

Syntax – Check specifically for 64-bit


java -d64 -version

Output

Image

java.-d64.20190109.0407pm

Textual


>java -d64 -version
Unrecognized option: -d64
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

 

Remediation

java

Download Java Runtime Environment ( JRE)

Download 64-bit Java JRE from here :-

Java SE Runtime Environment 8 Downloads
Link

java.artifact.20190109.0412pm

Install Java

Install the download artifacts

Validate Java

Validate Java ( x64 )

Syntax

java -d64 -version

Output
Output – Before – Image

java.-d64.DoesNotSupportA64bitJVM.20190109.0419PM.PNG

Output – Before – Textual

Error : This Java instance does not support a 64-bit JVM.
Please install the desired version.

Output – After

java.-d64.Supports64bitJVM.20190109.0420PM.PNG

 

R

Access System

In R, issue call to system.

The call is to validate that the R Script can access the system and invoke the java executable.

System calls

System Call – java
Syntax

system('java -version")

Output
system.java.-version.20190109.0424pm

 

 

 

 

 

jdts – Error – “I/O Error: DB server closed connection” – Day 02

Background

In our previous post we laid the foundation of a somewhat perplexing issue that we ran into.  The error read “I/O Error: DB server closed connection”.

Troubleshoot

Let us troubleshoot more.

Errors

Network Connectivity Error

If one lacks basic network connectivity here is the error.

Image

dbeaver.2018121.0804

Textual

Login timed out.
connect timed out

Error :- Socket Closed

One can also get an error that simply states “Network error IOException : socket closed“.

Image

dbeaver.socketClosed.20181221.0811AM.PNG

Textual

Network error IOException: Socket closed
Socket closed

Dbeaver

Dbeaver Log

dbeaver-dbeaver.log

 

Text


2018-12-21 08:09:29.685 - Connect with 'sql03' (mssql_jdbc_jtds-167cd7b7762-272567fd541ba2d9)
2018-12-21 08:09:49.699 - Connection failed (mssql_jdbc_jtds-167cd7b7762-272567fd541ba2d9)
2018-12-21 08:09:49.702 - org.jkiss.dbeaver.model.exec.DBCConnectException: Network error IOException: Socket closed
org.jkiss.dbeaver.model.exec.DBCConnectException: Network error IOException: Socket closed
	at org.jkiss.dbeaver.model.impl.jdbc.JDBCDataSource.openConnection(JDBCDataSource.java:179)
	at org.jkiss.dbeaver.ext.generic.model.GenericDataSource.openConnection(GenericDataSource.java:126)
	at org.jkiss.dbeaver.model.impl.jdbc.JDBCExecutionContext.connect(JDBCExecutionContext.java:86)
	at org.jkiss.dbeaver.model.impl.jdbc.JDBCRemoteInstance.initializeMainContext(JDBCRemoteInstance.java:86)
	at org.jkiss.dbeaver.model.impl.jdbc.JDBCRemoteInstance.(JDBCRemoteInstance.java:54)
	at org.jkiss.dbeaver.model.impl.jdbc.JDBCDataSource.initializeRemoteInstance(JDBCDataSource.java:105)
	at org.jkiss.dbeaver.ext.generic.model.GenericDataSource.(GenericDataSource.java:108)
	at org.jkiss.dbeaver.ext.mssql.model.SQLServerDataSource.(SQLServerDataSource.java:46)
	at org.jkiss.dbeaver.ext.mssql.model.SQLServerDataSource.(SQLServerDataSource.java:38)
	at org.jkiss.dbeaver.ext.mssql.SQLServerDataSourceProvider.openDataSource(SQLServerDataSourceProvider.java:123)
	at org.jkiss.dbeaver.registry.DataSourceDescriptor.connect(DataSourceDescriptor.java:768)
	at org.jkiss.dbeaver.runtime.jobs.ConnectJob.run(ConnectJob.java:70)
	at org.jkiss.dbeaver.runtime.jobs.ConnectJob.runSync(ConnectJob.java:98)
	at org.jkiss.dbeaver.ui.actions.datasource.DataSourceHandler.connectToDataSource(DataSourceHandler.java:106)
	at org.jkiss.dbeaver.registry.DataSourceDescriptor.initConnection(DataSourceDescriptor.java:663)
	at org.jkiss.dbeaver.model.navigator.DBNDataSource.initializeNode(DBNDataSource.java:147)
	at org.jkiss.dbeaver.model.navigator.DBNDatabaseNode.getChildren(DBNDatabaseNode.java:195)
	at org.jkiss.dbeaver.model.navigator.DBNDatabaseNode.getChildren(DBNDatabaseNode.java:1)
	at org.jkiss.dbeaver.ui.navigator.NavigatorUtils.getNodeChildrenFiltered(NavigatorUtils.java:564)
	at org.jkiss.dbeaver.ui.navigator.database.load.TreeLoadService.evaluate(TreeLoadService.java:49)
	at org.jkiss.dbeaver.ui.navigator.database.load.TreeLoadService.evaluate(TreeLoadService.java:1)
	at org.jkiss.dbeaver.ui.LoadingJob.run(LoadingJob.java:86)
	at org.jkiss.dbeaver.ui.LoadingJob.run(LoadingJob.java:71)
	at org.jkiss.dbeaver.model.runtime.AbstractJob.run(AbstractJob.java:95)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:56)
Caused by: java.sql.SQLException: Network error IOException: Socket closed
	at net.sourceforge.jtds.jdbc.JtdsConnection.(JtdsConnection.java:436)
	at net.sourceforge.jtds.jdbc.Driver.connect(Driver.java:184)
	at org.jkiss.dbeaver.model.impl.jdbc.JDBCDataSource.lambda$0(JDBCDataSource.java:148)
	at org.jkiss.dbeaver.model.impl.jdbc.JDBCDataSource.openConnection(JDBCDataSource.java:157)
	... 24 more
Caused by: java.net.SocketException: Socket closed
	at java.net.SocketInputStream.socketRead0(Native Method)
	at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
	at java.net.SocketInputStream.read(SocketInputStream.java:170)
	at java.net.SocketInputStream.read(SocketInputStream.java:141)
	at net.sourceforge.jtds.ssl.TdsTlsInputStream.readFully(TdsTlsInputStream.java:131)
	at net.sourceforge.jtds.ssl.TdsTlsInputStream.primeBuffer(TdsTlsInputStream.java:100)
	at net.sourceforge.jtds.ssl.TdsTlsInputStream.read(TdsTlsInputStream.java:78)
	at sun.security.ssl.InputRecord.readFully(InputRecord.java:465)
	at sun.security.ssl.InputRecord.read(InputRecord.java:503)
	at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:973)
	at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1375)
	at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1403)
	at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1387)
	at net.sourceforge.jtds.ssl.SocketFactories$TdsTlsSocketFactory.createSocket(SocketFactories.java:101)
	at net.sourceforge.jtds.jdbc.SharedSocket.enableEncryption(SharedSocket.java:330)
	at net.sourceforge.jtds.jdbc.TdsCore.negotiateSSL(TdsCore.java:577)
	at net.sourceforge.jtds.jdbc.JtdsConnection.(JtdsConnection.java:365)
	... 27 more

 

Explanation

  1. Here are the key details
    1. at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:973) at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1375) at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1403) at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1387) at net.sourceforge.jtds.ssl.SocketFactories$TdsTlsSocketFactory.createSocket(SocketFactories.java:101) at net.sourceforge.jtds.jdbc.SharedSocket.enableEncryption(SharedSocket.java:330) at net.sourceforge.jtds.jdbc.TdsCore.negotiateSSL(TdsCore.java:577) at net.sourceforge.jtds.jdbc.JtdsConnection.<init>(JtdsConnection.java:365)

Root Cause

The root cause is that we enabled “Force Encryption” on the database server; MS SQL Server in this case.

Database Platform

SQL Server Engine

SQL Server Configuration Manager ( SSCM )

Protocols

Force Encryption

Here we see that “Force Encryption” is turned on.

protocols.ForceEncryption.20181221.0823AM.PNG

 

SQL Server Engine – Error Log

Upon checking SQL Server Error Log, here are some nuggets :-

Image

errorLog.20181221.0920AM

Text

Message
Encryption is required to connect to this server but the client library does not support encryption; the connection has been closed. Please upgrade your client library. [CLIENT: 10.0.0.1]

 

jdts – Error – “I/O Error: DB server closed connection”

Background

Trying to configure a new Data Source in WebSphere.

Recreate

  1. Server
    • Database Platform :- Microsoft SQL Server
    • Version
      • v2016
        • SQL Server Version :- Microsoft SQL Server 2016 (SP2-CU4) (KB4464106) – 13.0.5233.0 (X64)
          Nov 3 2018 00:01:54
          Copyright (c) Microsoft Corporation
          Developer Edition (64-bit) on Windows Server 2016 Datacenter 10.0 <X64> (Build 14393: ) (Hypervisor)
  2. Client
    • Driver :- jdts

 

Error

Error Image

IOError-DBServerClosedConnection.ConnectionError

Error Textual

I/O Error : DB server closed connection.

Trouble Shooting

jdbc

Driver Configuration

jdbcdriver.jdts.2018121.0400PM

Version

Outline

Here are the jdbc/jdts versions we tested against :-

  1. v1.3.1

Version 1.3.1

Image

jdbcdriver.jdts.v1.3.1.20181219.0548PM.PNG

Explanation
  1. File :- net.sourceforge.jtds\jtds-1.3.1.jar

Remediation

SQL Server Native Drivers

Microsoft’s SQL Server Management Studio ( SSMS )

Tried Microsoft’s SQL Server Management Studio.

Check!

JDBC

Microsoft’s JDBC Driver (v7)

Downloaded from here

Legacy drivers available here.

Versions

v6

Image

com.microsoft.sqlServer.jdbc.20181219.0404PM.PNG

Explanation
  1. Versions
    • 6.2.2.jre8

Summary

The specific jtds version, jtds-1.3.1.jar, that we tested does not work.

But, SQL Server JDBC Driver Versions 6 & 7 works.

SQL Server – v2017 – Install – “Oracle JRE 7 Update 51 (64-bit) is required for Polybase”

Background

Installing SQL Server v2017 and ran into an error that I have seen before.

Error

Error Image

OracleJRE7Update51_x64.2018109.1111AM.PNG

Error Textual

Oracle JRE 7 Update 51 (64-bit) or higher is required for Polybase

Tackled Before

History

Already tackled before here:

SQL Server (v2016) – Installation – Blocked – “Oracle JRE 7 Update 51 (64-bit) or higher is required for Polybase”
here

History

The fix applied was to install Java JRE downloaded from here:

https://www.oracle.com/technetwork/java/javase/downloads/index.html
Link

But, unfortunately even though install applied no help this time.

Trouble Shooting

Let us dig a bit deeper.

SysInternals

Process Monitor

Image

sysInternals.processMonitor.20181009.1010AM.PNG

Explanation

  1. Identified component used by SQL Server Setup
    • Component is ScenarioEngine
  2. ScenarioEngine
    • Log
      • C:\Program Files\Microsoft SQL Server\140\Setup Bootstrap\Log\20181009_092126\Detail.txt

Tail

Tail For Win32

Download

Downloaded Tail For Win32 from here:

Tail for Win32
Link

Usage

Launched “Tail For Win32” and loaded the identified SQL Server Log file ( Detail.txt )

Results
Image
TailforWin32_Usage_20181009_1151AM
Textual

13) 2018-10-09 10:13:06 Slp: Init rule target object: Microsoft.SqlServer.Configuration.Polybase.Polybase_IsMinJavaVersionInstalledFacet
(13) 2018-10-09 10:13:06 SQLPolyBase: Could not find registry setting HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment\CurrentVersion.
(13) 2018-10-09 10:13:06 SQLPolyBase: Minimum version expected: 1.7.51. Java not found.
(13) 2018-10-09 10:13:06 SQLPolyBase: Rule 'Polybase_IsMinJavaVersionInstalled' detection result: IsMinJavaVersionInstalled= False
(13) 2018-10-09 10:13:06 Slp: Evaluating rule        : Polybase_IsMinJavaVersionInstalled
(13) 2018-10-09 10:13:06 Slp: Rule running on machine:
(13) 2018-10-09 10:13:06 Slp: Rule evaluation done   : Failed
(13) 2018-10-09 10:13:06 Slp: Rule evaluation message: This computer does not have the Oracle Java SE Runtime Environment Version 7 Update 51 (64-bit) or higher installed. The Oracle Java SE Runtime Environment is software provided by a third party. Microsoft grants you no rights for such third-party software. You are responsible for and must separately locate, read and accept applicable third-party license terms. To continue, download the Oracle SE Java Runtime Environment from https://go.microsoft.com/fwlink/?LinkId=526030.
(13) 2018-10-09 10:13:06 Slp: Send result to channel : RulesEngineNotificationChannel

Textual
  1. QLPolyBase: Could not find registry setting HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment\CurrentVersion.
    (13) 2018-10-09 10:13:06 SQLPolyBase: Minimum version expected: 1.7.51. Java not found.

Registry

regedit

Images

Regedit – Image – Before
Image

registry_20181009_1038AM.PNG

Textual
  1. Computer\HKEY_LOCAL_MACHINE\Software\JavaSoft
    • Java Plug-in
    • Java Update
    • Java Web Start
    • Java Web Start Caps
    • JRE
Explanation
  1. HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment\CurrentVersion.
    • Java Runtime Environment
      • Missing

Remediation

Outline

Please download Java JRE 8 and install it.

Download

Please download artifacts from here :-

Java SE Runtime Environment 8 Downloads
https://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html
Link

Artifacts

Image

Java SE Runtime Environment 8u181

download_JavaSERuntimeEnvironment_20181009.1221PM.PNG

download_20181009.1026AM.PNG
Explanation
  1. Chose to download Windows X64

 

Install

Images

Destination Folder

download_DestinationFolder_20181009.1031AM.PNG

Installing
Installing -01

install_20181009.1032AM.PNG

java Setup – Complete

install_JavaSetupComplete_20181009.1033AM.PNG

Change in License Terms

download_JavaSERuntimeEnvironment_Roadmap_20181009.1030AM.PNG

Registry

Using regedit, please review the Java’s registry structure.

regedit

Images
Regedit – Image – After
Image

registry_java_jre_1Dot8_20181009_1243PM.PNG

Explanation
  1. HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment\CurrentVersion is now present

 

Summary

It appears that Oracle has changed the folder structure for Java in the Windows Registry.

Specifically what used to be

HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment\CurrentVersion.

is now

HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\JRE\CurrentVersion.

Please be sure to have Java JRE v1.8 ( Java 8) installed for SQL Server v2016\v2017 Polybase.

DBeaver – Database Connection Configuration – IBM – DB2 / UDB JDBC Driver

Background

As always coming back to DBeaver.

This time to connect to a UDB Instance running on Linux.

BTW, UDB means Universal Database.

UDB JDBC Driver

Artifacts

DB2 JDBC Driver Versions and Downloads

The URL for DB2 JDBC Drivers is Link.

Here is a current snapshot.

artifacts_db2drivers_20180816_1236PM

v11.1 FP0 ( GA )

We chose the v11 FP0 ( GA ) which is a baseline install; specifically 4.21.29.

Others might choose v11 M3 FP3; which includes the latest patches.

The URL is Link.

Here is a screen shot:

artifacts_db2drivers_v11_20180816_0110PM

IBM Data Server Driver for JDBC and SQLJ ( JCC Driver )

As all we need is the JDBC Driver, we chose “IBM Data Server Driver for JDBC and SQLJ (JCC Driver)“.

One needs membership account to actually download, so please login in with one if you have already registered.  Else, please create one, as it is free.

Download

In short, we downloaded “IBM Data Server Driver for JDBC and SQLJ (JCC Driver)“.

Extracted

Image

zip_extracted_20180816_0216PM.PNG

Textual

  1. db2jcc.jar
    • JDBC v3.0
  2. db2jcc4.jar
    • JDBC 4.0

Preparation

Network

Port Number

Let us determine the Network Port Number that our DB/2 Instance is listening on.

db2 get dbm cfg

Syntax


db2 get dbm cfg

Sample


db2 get dbm cfg | grep SVCE

Output

db2getdbmcfg_20180816_0230PM.PNG

Databases

Outline

Let us determine the list of databases that are available on our UDB Instance.

db2 list database directory

Syntax


 db2 list database directory

Sample


 db2 list database directory | grep "Database name"

Output

listDatabases_20180816_0242PM.PNG

 

DBeaver

Database

Connections

Steps

Select new connection type
Image

SelectNewConnectionType_20180816_0644AM.PNG

Textual
  1. DB2
    • DB2 LUW
Driver settings – Download driver files
Image

downloadDriverFiles_20180816_0647AM.PNG

Textual
  1. Click on the “Add JARs” button
Driver settings – Edit Driver – Add File – Post
Image

EditDriver_AddFile_After_20180816_0647AM.PNG

Textual
  1. JAR file “db2jcc4.jar” added
Create new connection – DB2 Connection Settings – Tab – General
Image

EditDriver_Tab_Database_20180816_0709AM ( Edited ).PNG

Textual
  1. Host
  2. Port
  3. Database
  4. username
  5. Password
Create new connection – DB2 Connection Settings – finish connection creation
Image

finishConnection_20180816_0719AM ( Edited ).PNG

 

References

  1. IBM
    • Home > DB2 for Linux UNIX and Windows 9.5.0 > Database administration > Administrative interfaces > Administrative SQL routines and views > Supported routines and views > Snapshot routines and views
      • APPLICATIONS administrative view – Retrieve connected database application information
        Link

 

jruby – Get Version Information

Background

As part of a troubleshooting session that I will be undertaken I wanted to start getting familiar with what jruby has in terms of API for discovering the Java Version that it is running under.

Code

Ruby

Version.rb


require 'date'

require 'java'

require 'rbconfig'
include RbConfig

require 'io/console'

java_import java.lang.System

class Version

    # ruby class variables are prefixed with '@@' .
    @@javaRTVersion = "";
    @@rubyPlatform = "";
    @@hostOS = "";
    @@acquired = false;

    #Constructor
    def initialize()

    end

    def self.acquire

        @@javaRTVersion = System.getProperties["java.runtime.version"]

        @@rubyPlatform = RUBY_PLATFORM

        @@hostOS = CONFIG['host_os']

    end 

    # hostOS
    def self.hostOS

        if (@@acquired == false)

            self.acquire()

            @@acquired = true

        end

        return @@hostOS

    end 

    # java runtime version
    def self.javaRTVersion

        if (@@acquired == false)

            self.acquire()

            @@acquired = true

        end

        return @@javaRTVersion

    end     

    # the getter is defined to return the class variable when called
    def self.rubyPlatform

        if (@@acquired == false)

            self.acquire()

            @@acquired = true

        end

        return @@rubyPlatform

    end 

end

def waitForKeyPress

    puts
    puts

    puts "Press enter to continue"

    STDIN.getch()

end 

objV = Version.new()

# Access it's attributes.
puts
puts "hostOS is " + Version.hostOS
puts "javaRTVersion is " + Version.javaRTVersion
puts "rubyPlatform is " + Version.rubyPlatform

waitForKeyPress()

Command File

Objective

Ran again JDK 1.8, 1.9 ( v9 ) and 1.10 ( v10 ).

initiate.cmd


setlocal

REM SET JAVA_HOME to Version 1.8
rem set "JAVA_HOME=C:\Program Files\Java\jdk1.8.0_181"
rem set "JAVA_HOME=C:\Program Files\Java\jdk-9.0.4"
set "JAVA_HOME=C:\Program Files\Java\jdk-10.0.2"

set "JRUBY_BIN=C:\Downloads\jruby\v9.2\zip\jruby-dist-9.2.0.0-bin\jruby-9.2.0.0\bin"

set "_app=Version.rb"

%JRUBY_BIN%\jruby.bat "%_app%"

endlocal

Output

JDK 1.8

javaVersion_run_1DOT8_20180816_0435AM

JDK 1.9

Image

javaVersion_run_1DOT9_20180816_0439AM

Textual


WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.jruby.runtime.encoding.EncodingService to field java.io.Console.cs
WARNING: Please consider reporting this to the maintainers of org.jruby.runtime.encoding.EncodingService
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

hostOS is mswin32
javaRTVersion is 9.0.4+11
rubyPlatform is java

JDK 1.10

Image

javaVersion_run_1DOT10_20180816_0445AM

Textual


WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.jruby.runtime.encoding.EncodingService to field java.io.Console.cs
WARNING: Please consider reporting this to the maintainers of org.jruby.runtime.encoding.EncodingService
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

hostOS is mswin32
javaRTVersion is 10.0.2+13<span id="mce_SELREST_start" style="overflow:hidden;line-height:0;">&#65279;</span>
rubyPlatform is java

jruby – Sample App – Classes – blackBook

Background

Now that we have jruby installation out of the way let us create a simple app that creates a class.

BTW, our jruby Installation post is here.

 

Code

blackbook.rb


###############################################
#Foundational Sample Script
#https://gist.github.com/dougal/24876
###############################################
require 'date'

class Blackbook

    #Declare Accessor Methods   
    attr_accessor :name, :relationship, :dateAdded

    
    # ruby class variables are prefixed with '@@' .
    # set number of entries
    @@iNumberofEntries = 0;
    
    #Constructor
    def initialize(name, relationship, dateAdded)
    
        @name = name
        @relationship = relationship
        @dateAdded = dateAdded
        
        #Increment number of entries
        @@iNumberofEntries = @@iNumberofEntries + 1
        
    end
  
    # Class Method numberofEntries
    # Returns Class Variable @@iNumberofEntries
    def self.numberofEntries
    
        return @@iNumberofEntries
        
    end  
    
end

# Get Current Date
dtNow = Time.now

# Date Formats
dateFormat="%b %d %Y"
dateFormatYYYYMMDD="YYYYMMDD"

# Create the new instance ( Prince Charles)
dob = "19481114"
dobCharles = Date.parse(dob);
entryCharles = Blackbook.new('Charles', 'Prince', dobCharles)

# Access it's attributes.
puts "Entry Name is " + entryCharles.name
puts "Relationship is " + entryCharles.relationship
puts "Date Added is " + entryCharles.dateAdded.strftime(dateFormat);
puts ""

# Create the new instance ( Lady Diana )
dob = "19610701"
dobDiana = Date.parse(dob);
entryDiana = Blackbook.new('Diana', 'Princess', dobDiana)

# Access it's attributes.
puts "Entry Name is " + entryDiana.name
puts "Relationship is " + entryDiana.relationship
puts "Date Added is " + entryDiana.dateAdded.strftime(dateFormat);
puts ""

#Get Number of entries
strNumberofEntries = Blackbook.numberofEntries.to_s
puts "Number of entries in black book " + strNumberofEntries

invoke.cmd


setlocal

REM SET JAVA_HOME to Version 1.8
set "JAVA_HOME=C:\Program Files\Java\jdk1.8.0_181"
rem set "JAVA_HOME=C:\Program Files\Java\jdk-9.0.4"
REM set "JAVA_HOME=C:\Program Files\Java\jdk-10.0.2"

set "JRUBY_BIN=C:\Downloads\jruby\v9.2\zip\jruby-dist-9.2.0.0-bin\jruby-9.2.0.0\bin"

set "_app=blackbook.rb"

%JRUBY_BIN%\jruby.bat "%_app%"

endlocal

output