How to get Free, Used and Total Memory in Java ?

How to get Free, Used and Total Memory in Java ?

As you know that Java does the automatic garbage collection which you need not worry about. However sometime you want to know how large the java heap space is and how much of it is left. Information about Free, Used and Total memory in java can be used for checking your code efficiency. To obtain …

Read More

Log4j2 Properties file examples

Log4j2 Properties file examples

Log4J2 Properties file configuration can be achieved in below 4 different file formats. Properties file format – log4j2.properties YAML file format – log4j2.yaml or log4j2.yml JSON file format – log4j2.json XML file format – log4j2.xml I don’t see many examples available for log4j 2 configuration. Here are the few examples of Log4j 2 configuration for your …

Read More

How to delete folder recursively on remote server using SFTP in java?

How to delete folder recursively on remote server using SFTP in java?

Deleting or removing a folder recursively on the remote server in java is easy using JSCH (SFTP) API. Nowadays it is a common use case in software projects where you need to delete or remove a folder from the remote server using SFTP connection. Below java code shows you how you can delete or remove …

Read More

How to delete file on remote server using SFTP in java?

How to delete file on remote server using SFTP in java?

Deleting or removing a file on remote server in java is easy using JSCH (SFTP) api. Now-a-days it is a common use case in software projects where you need to delete a file from the remote server using SFTP connection. JSch is a pure Java implementation of SSH2 (We can use SFTP Channel). JSch allows …

Read More

How to generate pseudorandom numbers in Java ?

How to generate pseudorandom numbers in Java ?

In this post we will see how to generate pseudorandom numbers in Java. Before that we will see what is Random numbers. Random numbers are the numbers that occur in sequence such that the values are uniformly distributed over a defined interval or set, which is impossible to predict future values based on present and …

Read More

Java Program For Uploading Folder Content recursively from local to SFTP Server

Java Program For Uploading Folder Content recursively from local to SFTP Server

Java program for uploading the content of a local machine directory or folder to SFTP server is not straight forward. If we use JSCH API for SFTP upload then you cannot use channelSftp.put(new FileInputStream(sourceFile), sourceFile.getName(), ChannelSftp.OVERWRITE); method. This channelSftp.put() method will work for single file upload but you cannot use it for folder upload. Below Java …

Read More

Java Program For Downloading Folder Content recursively from SFTP Server

Java Program For Downloading Folder Content recursively from SFTP Server

How to download folder from SFTP Server (Secure File Transfer Protocol) is the common use case for Java developer who wants to download folder from SFTP. To write a java program to download from SFTP, you will need to download JSCH jar file. For other SFTP operations in java, please refer below posts on Kodehelp.com – …

Read More

How to make SFTP or SSH connection using public key authentication in java?

How to make SFTP or SSH connection using public key authentication in java?

Using SFTP or SSH public key authentication to make the connection to remote system is more secure and robust method than login with account password. SSH public key authentication is an authentication method that relies on asymmetric cryptographic algorithms that generate a pair of  separate keys, one private and the other public. Private Key is the secret key …

Read More

How To Setup SSH Public Key Authentication To Connect Remote System ?

How To Setup SSH Public Key Authentication To Connect Remote System ?

Overview Nowadays passwords are not much secured. If you pick a strongest password including all upper case, lower case alphabet and numbers with special characters, the password is still susceptible to the brute-force attack. It’s a human nature to use a same password for different remote hosts which can put you at more risk of a …

Read More

How to download a file from SFTP Server using Zehon API ?

How to download a file from SFTP Server using Zehon API ?

Zehon SFTP is a file-transfer component for Java language that provides secure file system access over an SSH channel using the SFTP protocol. It makes it easy to transfer files between your application and Unix/Windows SSH servers. All popular SSH/SFTP and proxy servers are supported. Below is the feature list for Zehon SFTP Stable and …

Read More

How to upload a file to SFTP server using Zehon API ?

How to upload a file to SFTP server using Zehon API ?

Compared to the earlier SCP protocol, which allows only file transfers, the SFTP protocol allows for a range of operations on remote files – it is more like a remote file system protocol. An SFTP client’s extra capabilities compared to an SCP client include resuming interrupted transfers, directory listings, and remote file removal. SFTP attempts to be more platform-independent than …

Read More

How to back up files from Linux to Gmail?

Below steps shows you how to back up files from Linux to Gmail – # cd / && mkdir backup Now, you need to create a script, which will perform backup and mail it for you. # vim /usr/bin/backup copy and paste the following into the file : cd /backup rm -rf /backup/* cp LIST_OF_FILES …

Read More

How to Recover MySQL root Password in Linux?

To Recover MySQL root password in linux follow below steps – First Stop mysql service. # /etc/init.d/mysqld stop Start MySQL server without password: # mysqld_safe – -skip-grant-tables & Connect to mysql server using mysql client: # mysql -u root Setup new MySQL root user password mysql> use mysql; mysql> update user set password=PASSWORD(“NEW-PASSWORD”) where User=’root’; …

Read More

How to Create RAMDISK in Linux?

RAMDISK is part of system memory which user can use as a normal disk space. The advantage of RAMDISK is faster read and write access in comparison of Hard Disk. By default Ubuntu mounts RAMDISK on /dev/shm/ directory. To setup RAMDISK on other distributions like Fedora or CentOS, you can follow below method. My Laptop’s …

Read More

How to Install Amarok in Linux?

Amarok is a powerful music player for Linux and Unix, MacOS X and Windows with an intuitive interface. It makes playing the music you love and discovering new music easier than ever before. To install Amarok latest version on Ubuntu you need to add its repository # add-apt-repository ppa:kubuntu-ppa/backports # apt-get update # apt-get install …

Read More

How to install Rootkit Hunter in linux ?

Below steps shows you how to install Rootkit Hunter in linux – Rkhunter or Rootkit Hunter is a scanning tool that scans back doors, local exploits and also for root kits in your server.

Read More

How to Install Nikto Web Server Scanner in Linux?

Nikto is a web server scanner tool, which performs comprehensive checking against web servers for multiple items, including over 3500 potentially dangerous files/CGIs, versions on over 700 servers, and version specific problems more than 200 servers.   Nikto is built on LibWhisker and can run on any platform which has a Perl environment, and supports …

Read More

How to install Joomla with XAMPP Server?

Do you know What is Joomla and XAMPP and How to install Joomla with XAMPP server locally. So here is all you want : Joomla is a free and Open Source content management system used to create websites. Joomla allows web designers to construct sites by combining modules, and requires basic knowledge of programming to …

Read More