But, it insisted on opening the rviz configuration file at /opt/ros/melodic/share/rviz. So, i had to use the command sudo nano /opt/ros/melodic/share/rviz/default.rviz and copy the contents of the rviz file i have saved into catkin workspace. After doing that i got my rviz configured...