Java – Search YouTube using YouTube Data API on Ubuntu No.82

In this blog, how to search YouTube videos using YouTube Data API on Ubuntu is shown. Java application is executed in Visual Studio Code on Ubuntu. Contents ▼1. How to get API Key for YouTube Data API▼2. Prerequisites2-1. Install JDK2-2. Install Visual Studio Code2-3. Install Maven▼3. Java code to search videos using YouTube Data API3-1. Create an Apache Maven project3-2. Remove the existed both App.java and AppTest.java3-3. Start Visual Studio Code3-4. Create youtube.properties3-5. Update pom.xml as below and save it (Ctrl+S)3-6. Develop youtubesearch.java3-7. Run youtubesearch.java3-8. Check the link of YouTube using Video id▼4. Reference▼1. How to get API Key for YouTube Data API After creating a project and enabling YouTube … Continue reading “Java – Search YouTube using YouTube Data API on Ubuntu No.82”

Java – Put CPU % into a local file by Cron job No.81

How to save the current CPU % on Ubuntu into a local file by Cron job with an execution of Jar is shown in this blog. Contents ▼1. How to export the current CPU % on Ubuntu▼2. Prerequisites▼3. Java code to export the current CPU % on Ubuntu3-1. Develop perfch2.java3-2. Export Jar file3-3. Set execution time in Crontab3-4. Check the saved file after running a cron Job▼4. 参考情報▼1. How to export the current CPU % on Ubuntu The command “top -b -n 1” is executed by Java and save only CPU % into a file. ▼2. Prerequisites This blog is based on Java – Capture CPU,Memory,Network info on Ubuntu No.79. … Continue reading “Java – Put CPU % into a local file by Cron job No.81”

Java – Capture CPU,Memory,Network info on Ubuntu No.79

In this blog, how to capture CPU, Memory, Disk, Network information by Java is shown.it would be helpful if you need narrow down the issue about connection failure to Database to find a root cause. Contents ▼1. How to know CPU, Memory, Network status on Ubuntu▼2. Prerequisite2-1. Install JDK2-2. Install Visual Studio Code2-3. Install Maven▼3. Deploy Java application to capture CPU, Memory, Network, Disk status on ubuntu and save a file locally.3-1. Create an Apache Maven project3-2. Remove the default created App.java and AppTest.java files3-3. Start Visual Studio Code3-4. Add below into pom.xml file3-5. Develop perfch.java3-6. Check the output file “perf.log”▼4. Reference▼1. How to know CPU, Memory, Network status on … Continue reading “Java – Capture CPU,Memory,Network info on Ubuntu No.79”

Apache Kafka – Develop Producer Java application No.66

How to develop Producer application by Java on Visual Studio Code is shown in this blog. Contents ▼1. Apache Kafka ▼2. Prerequisites▼3. Develop Producer Java application3-1. Make a directoryMake a directory to develop an application.3-2. Create a project using Apache Maven3-3. Remove the App.java and AppTest.java files3-4. Update pom.xml file3-5. Develop Producer application3-6. Execute Producer application3-7. Retrieve the generated data▼4. Reference▼1. Apache Kafka Ref: Apache Kafka ▼2. Prerequisites Install Apache Kafka 4 nodes No.42 Apache Kafka Word Count – Java No.44“2-3. Installing Apache Maven” ▼3. Develop Producer Java application This producer Java application write events from 1 to 100 into a topic. 3-1. Make a directoryMake a directory to develop … Continue reading “Apache Kafka – Develop Producer Java application No.66”

Java – Visual Studio Code on Ubuntu No.24

In this blog, How to run Java on Visual Studio Code on Ubuntu is shown. Contents ▼1. Run Java using Visual Studio Code on Ubuntu▼2. Prerequisites2-1.Install Ubuntu Ubuntu 20.04.5 LTS2-2. Setup Visual Studio Code2-3. Install Java Extension Pack2-4. Install JDK (OpenJDK 15)2-5. Set Environment variables for java.configuration.runtimes and java.home▼3. Show Hello World by Java3-1. Create Folder “JavaTest” and Hello.java file3-2. Press F5 key on VS Code or Click Run Java3-3. Create Jar file and run this jar3-4. Run the generated jar file in the terminal▼1. Run Java using Visual Studio Code on Ubuntu Visual Studio Code is the developer tool provided by Microsoft. Visual Studio Code works on both Windows … Continue reading “Java – Visual Studio Code on Ubuntu No.24”

Install IntelliJ IDEA on Ubuntu No.43

How to install IntelliJ IDEA on Ubuntu is shown in this blog. Contents ▼1. What is IntelliJ IDEA?▼2. Installing IntelliJ IDEA2-1. Download IntelliJ IDEA Community Edition2-2. Unzip downloaded IntelliJ IDEA Community Edition2-3. Run idea.sh to start IntelliJ IDEA2-4. Install Java 8 JDK▼3. Create Java code to show “Hello World”3-1. Click New Project to create a new project3-2. Confirm JDK version 1.8 version 1.8.0_312 after choosing Java3-3. Click Next and set Project Name (e.g) JavaHelloWorld and Finish it3-4. Under src folder, click New -> Java Class3-5. Set file name (e.g) Helloworld and double click Class3-6. Write a code in Helloworld.java as below3-7. Click “Build Project” in the pull-down menu “Build” to … Continue reading “Install IntelliJ IDEA on Ubuntu No.43”

Apache Kafka Word Count – Java No.44

How to count the words in topic by Java is shown. Contents ▼1. Steps of counting words in a topic by Java▼2. Prerequisites2-1. Installing an Apache Kafka cluster2-2. Installing IntelliJ IDEA2-3. Installing Apache Maven2-4. Setting parameters of $KAFKABROKERS and $KAFKAZOOKEEPER2-5. Creating the topic for both input and output▼3. Counting words in a topic by Java3-1. Creating a project of IntelliJ IDEA3-2. Confirming the version 1.8 of JDK is used3-3. Putting the following information while creating a project3-5. Creating log4j.properties file in src folder under main -> resources and then adding below.3-6. Creating WordCountStream.java in src folder under main -> java3-7. Writing below in WordCountStream .java3-8. Adding parameters3-9. Building Project3-10. Starting … Continue reading “Apache Kafka Word Count – Java No.44”

Install Apache Kafka 4 nodes No.42

How to install Apache Kafka 4 nodes is shown here. 4 ubuntu nodes are used for Apache Kafka. Contents ▼1. What is Apache Kafka?▼2. Installing Apache Kafka with 4 nodes2-1. Preparing for 4 Ubuntu 20.04.01 LTS x64 nodes2-2. Updating hosts file on 4 nodes2-3. Installing Java 8 JDK on 4 nodes2-4. Installing Apache Kafka on 4 nodes2-5. Updating environment variables on 4 nodes2-6. Only on Zookeeper node, zookeeper.properties is set.2-7. Starting Zookeeper2-8. Updating rc.local due to start of Zookeeper automatically when OS is started2-9. Configuring Kafka Brokers2-10. Updating rc.local each Brokers. the steps are the same as ones above 2-8.▼3. Creating Topic, writing and read data▼4. Reference▼1. What is Apache … Continue reading “Install Apache Kafka 4 nodes No.42”

Apache Kafka – Consumer Java – Duplicate Messages No.78

In this blog, Duplicate messages in Consumer are shown using Java with false of enable.auto.commit property. Contents ▼1. What is enable.auto.commit property?▼2. Prerequisites▼3. Reproducing duplicate messages in Consumer3-1. Deploying Consumer Java application3-2. Runing Producer and write 5 messages in a topic3-3. Commenting out consumer.commitSync(map) in Consumer of 3.13-4. Running the consumer which was updated in 3.3 to get messages.3-5. Finding duplicate messagesRe-running the consumer which was updated in 3.3 caused the duplicate messages.3-6. Removing the commented-out line in 3-3 and re-running this consumerWe could not find the duplicate messages.5 messages were committed.▼4. Reference▼1. What is enable.auto.commit property? Setting enable.auto.commit means that offsets are committed automatically. if it is false, committing … Continue reading “Apache Kafka – Consumer Java – Duplicate Messages No.78”

Java – Connect to SQL Server on Ubuntu No.5

In this blog, how to connect to SQL Server on Ubuntu using Java is shown. Contents ▼1. What is SQL Server on Ubuntu▼2. How to connect to SQL Server on Ubuntu2-1. Installing SQL Server on Ubuntu2-2. Installing Microsoft JDBC Driver 8.2 for SQL Server2-3. Connection String of JDBC Driver for SQL Server2-4. Output of this code▼3. Reference▼1. What is SQL Server on Ubuntu SQL Server is Relational Database (RDB) provided by Microsoft. SQL Server works on both Windows and Linux. we can use free trial version which is called as “Express Edition” within 180 days. ▼2. How to connect to SQL Server on Ubuntu 2-1. Installing SQL Server on Ubuntu … Continue reading “Java – Connect to SQL Server on Ubuntu No.5”