DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones Build AI Agents That Are Ready for Production
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
Build AI Agents That Are Ready for Production

LIVE: “Cognitive Databases, Intelligent Data: Unified Infrastructure for Vector Search, AI-Optimized Queries, & Hybrid Workloads" Report

Join this live webinar to learn safer rollout techniques for schema changes, index testing, and database migrations.

Live Webinar: Exclusive practitioner summit on AI-powered CDN operations and real-world automation strategies

The Latest Java Topics

article thumbnail
Hack OpenJDK with NetBeans IDE
You've come to the right spot if you are trying to hack OpenJDK with NetBeans IDE. This article explains what OpenJDK with NetBeans is and how you can use NetBeans to create OpenJDK. But before we dive in, first things first: What are Hack OpenJDK and NetBeans IDE? Open Java Development Kit (JDK) is an open-source implementation of the Java Platform or Standard Edition. That means anyone can access the source code and GNU General Public license of the OpenJDK. You may also ask, "then what is Netbeans?" NetBeans is also an open-source integrated development environment for developing with Java, PHP, C++, and other programming languages. All THE applications are developed modules in Java. The OpenJDK repository contains a NetBeans project for all C/C++ parts of the OpenJDK, including Hotspot. So, since NetBeans is an Apache project, it is pretty easy to download and hack the code. You can run it on operating systems like Windows, Linux, and macOS. Remember, to use NetBeans for Java programming; you first need to install Java Development Kit (JDK). Can I use NetBeans with OpenJDK? Yes, you can. The latest NetBeans version of NetBeans is at NetBeans IDE 6.0 Beta 1. But keep this in mind, to hack OpenJDK, you'll need only the Java SE version. Which JDK is compatible with NetBeans? The JDK is compatible with JDK 8 features. That includes annotations, compact profiles, lambda expressions, and repeatable. When you use any of those constructs in your code, they will automatically highlight errors and allow you to fix syntax. Review, Hacking, and Develop OpenJDK. You follow these simple: Get OpenJDK, as follows: #hg clone http://hg.openjdk.java.net/jdk8/build jdk_trunk #cd jdk_trunk #sh get_source.sh #mkdir build #cd build #sh ../configure. After you’ve "configured", the step is complete, remember the value assigned to "Boot JDK" and then:#export IDE_ALT_BOOTDIR=jdk_path_found_by_configure #netbeansStart NetBeans IDE (with C++ support) and open projects from "common/nb_native". Just make sure that the project already contains configurations for Solaris, Linux, and macOS. You can do this by switching to the appropriate configuration and enjoying hacking OpenJDK. Next up, navigate inside your NetBeans project directory. Once there, you will find a directory called incubator-Netbeans. This directory contains sufficient NetBeans modules. Is OpenJDK with NetBeans IDE secure? As the emphasis increases, so does the need for security. Hence, you can easily create the Secure Directories. You can do this by choosing File > New Project (Ctrl-Shift-N), selecting Web Application from the Java Web category, and clicking Next. Regression testing verifies that system changes do not interfere with existing features or code structure. They are part of almost every test suite in software development lifecycles. It is common for developers to change or add a code section and unintentionally disrupt something that is working just fine. Visual regression testing functions on the same logic but confines it to the visual aspects of the software. It works by comparing two images and automating complicated scenarios, like when we cannot identify the elements in the DOM tree. However, visual regression can be used on any website. How Does Visual Regression Testing Work? During the first run, the visual comparison tool captures the snapshot called the base image. The subsequent run compares the base image if there is no difference test is passed, and if there is a difference, the test is considered as failed. Visual regression is also called visual comparison testing. In this tutorial, we will discuss automated visual regression using Playwright. Prerequisites for Visual Regression with Playwright Download and install NodeJS Download and install Visual Studio Code (Recommended) Install Playwright NPM module Install @playwright/test module Note Throughout this tutorial, we are using Playwright with JavaScript. Playwright comes with the default visual comparison tool, so there is no need to install additional packages. Create Simple Visual Comparison Tests Using Playwright In your tests folder, create a new JavaScript file example demo.spec.jspage.screenshot() function takes the screenshot, and expect in the @playwright/test module provides the assertion for matching the images that are .toMatchSnapshot(). Inside the newly created JavaScript file, create a new test that performs the visual comparison like below. Visual Comparison in Playwright to Ignore Minor Differences The above comparison technique matches the screenshot pixel by pixel, which means each pixel should match exactly. This behavior can be modified by passing the argument maxDiffPixels = . Example JavaScript const { test, expect } = require('@playwright/test'); test('Visual Comparison Test Demo', async ({ page }) => { await page.goto('https://playwright.dev'); expect(await page.screenshot()).toMatchSnapshot({ maxDiffPixels: 200 }); }); In the above example, we have specified the maxDiffPixels value as 200, which means the maximum pixel difference can be 200. Image Comparison in Playwright With Threshold Option Playwright toMatchSnapshot() accepts threshold, threshold ranges from 0 to 1, default value is 0.2. The threshold is tolerance of image differences. Example Code JavaScript const { test, expect } = require('@playwright/test'); test('Visual Comparison Test Demo', async ({ page }) => { await page.goto('https://playwright.dev'); expect(await page.screenshot()).toMatchSnapshot({threshold:0.5}); }); In the above code, the threshold is mentioned as 0.5. Playwright Visual Comparison Tips and Tricks In Playwright, we can pass the image file name; instead of default comparison, Playwright compares with the specified filename. Example expect(await page.screenshot()).toMatchSnapshot('home.png'); Playwright also allows us to compare element snapshots; we can take a snapshot of DOM elements and compare. Example expect(await page.locator('xpath=//*[@id="__docusaurus']).screenshot()).toMatchSnapshot(); Visual Regression With Playwright Using Percy Percy is a web-based tool for visual testing with a free tier, and it provides both manual and automation capability for visual comparison. Percy supports Playwright integration. Percy is now a part of Browserstack. If you already have a BrowserStack account, you can sign in with BrowserStack or sign up and create one. Using Percy With Playwright Step 1 – Install Percy modules using the following command. npm install --save-dev @percy/cli @percy/playwright Step 2 – Create a new JavaScript Playwright test file like below. JavaScript //demo.spec.ts const { chromium } = require('playwright'); const percySnapshot = require('@percy/playwright'); (async () => { const browser = await chromium.launch(); const page = await browser.newPage(); await page.goto('https://www.browserstack.com/', { waitUntil: 'networkidle' }); await percySnapshot(page, 'Example Site'); await browser.close(); })(); In the above example, we are navigating to https://www.browserstack.com/, and we are taking a snapshot using the percySnapshot() function. Setting Up Percy Step 1 – Login to Percy. If you don’t have an account, create one. Step 2 – Create a new project. Step 3 – Copy Percy token. Step 4 – In your Visual Studio Code Terminal, set the PERCY_TOKEN environment variable using the below commands: Powershell / Visual Studio Code Terminal $env:PERCY_TOKEN = "your_token"
July 24, 2022
by Vladimir Voskresensky
· 16,834 Views · 2 Likes
article thumbnail
CI/CD Pipelines and Caching of Dependencies on Azure DevOps
Follow a brief explanation of CI/CD and how to implement caching of Maven dependencies in the pipelines while deploying your Mule application to CloudHub.
July 22, 2022
by Rahul kumar
· 12,427 Views · 6 Likes
article thumbnail
Writing Indexes in Java by Using Right Collection
The author explains the main idea of indexes and how to create them in Java. Creating fast search using the right data structures.
July 19, 2022
by Dmitry Egorov DZone Core CORE
· 7,721 Views · 5 Likes
article thumbnail
Introduction to Spring Boot and JDBCTemplate: JDBC Template
This tutorial will cover a way to simplify the code with JDBC using the Spring JDBC Template.
Updated July 15, 2022
by Otavio Santana DZone Core CORE
· 59,925 Views · 3 Likes
article thumbnail
Getting Started With Vaadin in Spring and Java EE
If you're thinking of using Vaadin for your UI components, here are some resources, including two videos, to see how you can incorporate it into both Spring and Java EE.
Updated July 14, 2022
by Alejandro Duarte DZone Core CORE
· 13,571 Views · 9 Likes
article thumbnail
Groovy 4.0: These 10 New Features Make It AWESOME!
Sealed types, switch expressions, and record types. Here are just a few new features introduced in the latest Groovy 4.0 release. In this article, I want to show you ten things that make Groovy 4.0 amazing.
July 14, 2022
by Szymon Stepniak
· 7,600 Views · 6 Likes
article thumbnail
How To Perform OCR on a Photograph of a Receipt Using Java
Learn of challenges associated with processing physical receipts for digital expensing operations and discover an OCR API solution to alleviate the problem.
July 14, 2022
by Brian O'Neill DZone Core CORE
· 6,673 Views · 4 Likes
article thumbnail
Building a REST Service That Collects HTML Form Data Using Netbeans, Jersey, Apache Tomcat, and Java
The Jersey project is very well documented so it makes it easy to learn REST with Java. In this article I’m going to build two projects. The first project will be a very simple HTML page that presents a form to the user and then submits it to a REST project residing on the same server. The second project will be the REST part. For this article I used the following tools: 1. Netbeans 7 2. Apache Tomcat 7 3. Jersey 4. Java I built this on OS X Lion. Go ahead and create a new Maven Web Application with Netbeans 7 called: MyForm Once the project has been generated take the resulting (default) index.jsp file and delete it. In its place add a file called: index.html and add the following content to it: Name: Message: Item 1: Item 2: Basically, I created a simple (ugly) form that takes a few parameters the user enters. They submit the form and the data is sent to the REST project we will soon be building. The idea here is we are using an HTTP POST to create a new message. That’s it for the first project! With Netbean’s Maven integration do a Clean and Build and then deploy the resulting WAR file to Apache Tomcat. Create another new Maven Web Application with Netbeans 7 called: RESTwithForms Add two new Java classes to the new project: 1. MyApplication 2. MessageResource The code for MyApplication.java is as follows: package com.giantflyingsaucer; import com.sun.jersey.api.core.PackagesResourceConfig; import javax.ws.rs.ApplicationPath; @ApplicationPath("/") public class MyApplication extends PackagesResourceConfig { public MyApplication() { super("com.giantflyingsaucer"); } } In a brief nutshell this code allows us to make use of some Servlet 3.0 goodies (we don’t need to create a web.xml file for this project as an example). For more details see the sections titled: Example 2.8. Reusing Jersey implementation in your custom application model and Example 2.9. Deployment of a JAX-RS application using @ApplicationPath with Servlet 3.0 at this link. The real guts of the REST project are in the MessageResource.java file as seen below: package com.giantflyingsaucer; import java.net.URI; import java.util.List; import java.util.UUID; import javax.ws.rs.FormParam; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.core.Response; import javax.ws.rs.Consumes; import javax.ws.rs.core.MediaType; @Path("/messages") public class MessageResource { @POST @Consumes(MediaType.APPLICATION_FORM_URLENCODED) public Response createMessage(@FormParam("name") String name, @FormParam("message") String message, @FormParam("thelist") List list) { if(name.trim().length() > 0 && message.trim().length() > 0 && !list.isEmpty()) { // Note 1: Normally you would persist the new message to a datastore // of some sort. I'm going to pretend I've done that and // use a unique id for it that obviously points to nothing in // this case. // Note 2: The way I'm returning the data should be more like the commented // out piece, I am being verbose for the sake of showing you how to // get the values and show that it was read. return Response.created(URI.create("/messages/" + String.valueOf(UUID.randomUUID()))).entity( name+ ": " + message + " --> the items: " + list.get(0) + " - " + list.get(1)).build(); // This is a more real world "return" //return Response.created(URI.create("/messages/" + String.valueOf(UUID.randomUUID()))).build(); } return Response.status(Response.Status.PRECONDITION_FAILED).build(); } } Note: Pay special attention to the comments. Please don’t email me stating I shouldn’t be returning text back with the values, also please don’t tell me I should be iterating the list, etc. this is just a demo. You will obviously do this differently in a production environment. The key here is simplicity and minimal code. At this point you need to add jersey-server as a dependency in your POM file. com.sun.jersey jersey-server-linking 1.9.1 With Netbean’s Maven integration do a Clean and Build and then deploy the resulting WAR file to Apache Tomcat. You are now ready to test it out. Load up the HTML file from the first project and enter some data and then submit it. If you have a tool like FireBug for Firefox, you can also see that an HTTP 201 was returned (if successful). If you don’t enter any data in the form then you should get an HTTP 412 back. With not much more work you could just as easily use something like jQuery and submit the form via AJAX.
July 13, 2022
by Chad Lung
· 66,766 Views · 4 Likes
article thumbnail
Java Thread Programming (Part 2)
After discussing the history of threading and how to initiate/begin a thread, now let's look at an illustration of how to leverage threads to our advantage.
July 12, 2022
by A N M Bazlur Rahman DZone Core CORE
· 6,839 Views · 8 Likes
article thumbnail
Going Beyond Java 8: Pattern Matching for instanceof
A developer and Java expert gives an overview of the instanceof operator in the recent versions of Java and how it can be used to improve your code.
Updated July 10, 2022
by Claudio De Sio Cesari
· 4,827 Views · 6 Likes
article thumbnail
How to Store Text in PostgreSQL: Tips, Tricks, and Traps
In this article, we will review various options to store long text in the PostgreSQL database: @Lob attributes, TEXT, and long VARCHAR table columns. Also, we'll have a look at the difference between Hibernate 5 and 6 in storing long text data.
July 7, 2022
by Andrey Belyaev
· 24,201 Views · 9 Likes
article thumbnail
Now It's Time to Uncomplicate With the Not-So-New API in Java
This article will give you a better understanding of the complexity of working with dates and how useful Java's date API is.
July 6, 2022
by Otavio Santana DZone Core CORE
· 7,920 Views · 5 Likes
article thumbnail
Building Reactive Java Applications with Spring Framework
Learn more about building reactive Java applications using the Spring framework.
July 5, 2022
by Cedrick Lunven
· 5,896 Views · 2 Likes
article thumbnail
Saving Memory In Java: Making The Smallest Memory Footprint
This article explains how to reduce memory usage in Java by demonstrating four ways to achieve the best footprint size and a way to calculate it.
July 5, 2022
by Dmitry Egorov DZone Core CORE
· 19,168 Views · 17 Likes
article thumbnail
Screen Sharing in Java
Learn how to build a screen-sharing application using Java, Node.js, and JxBrowser.
July 3, 2022
by Danylo Didkovskyi
· 11,267 Views · 10 Likes
article thumbnail
How to Classify NSFW (Not Safe for Work) Imagery with AI Content Moderation using Java
Moderate your website's content uploads with an artificial intelligence service and tackle the problem effectively while conserving precious time and resources.
July 1, 2022
by Brian O'Neill DZone Core CORE
· 7,295 Views · 3 Likes
article thumbnail
Top 7 Features in Jakarta EE 10 Release
Learn in detail about the top 7 features added in Jakarta EE 10 release.
June 29, 2022
by A N M Bazlur Rahman DZone Core CORE
· 14,018 Views · 4 Likes
article thumbnail
Data Integrity in NoSQL and Java Applications Using Bean Validation
Learn more about integrating bean validation in a NoSQL database while maintaining data integrity.
Updated June 28, 2022
by Otavio Santana DZone Core CORE
· 13,721 Views · 7 Likes
article thumbnail
Data Statistics and Analysis With Java and Python
How to analyze tabular data using Java Streams and Python Pandas. As well as compare how they perform and scale for large amounts of data.
Updated June 27, 2022
by Manu Barriola
· 11,738 Views · 6 Likes
article thumbnail
5 Things You Probably Didn't Know About Java Concurrency
While threads are helpful, they may be dreadful to many developers. Discover 5 interesting threading concepts beginner and intermediate developers may not know.
Updated June 23, 2022
by A N M Bazlur Rahman DZone Core CORE
· 6,893 Views · 11 Likes
  • Previous
  • ...
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • ...
  • Next
  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook
×