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

The Latest Java Topics

article thumbnail
Auth0 (Okta) vs. Cognito
This article compares two authentication service providers: Auth0 and Amazon Cognito. Both of them are cloud-based identity management services.
August 8, 2022
by Anastasiia Komendantova
· 4,414 Views · 3 Likes
article thumbnail
Build a Java Microservice With AuraDB Free
For today’s adventure, we want to build a Java microservice that connects to, and interacts with, graph data in a Neo4j AuraDB Free database.
Updated August 8, 2022
by Jennifer Reif DZone Core CORE
· 9,867 Views · 5 Likes
article thumbnail
Externalize Microservice Configuration With Spring Cloud Config
How to set up a service that hosts the Spring Cloud Config server and to wire an existing microservice as the config client service.
Updated August 8, 2022
by Jennifer Reif DZone Core CORE
· 14,409 Views · 5 Likes
article thumbnail
ExpectedConditions in Selenium
In this Selenium tutorial, you will learn how to use Expected Conditions in Selenium to fix timing-related issues due to the dynamic loading of WebElements.
August 6, 2022
by Himanshu Sheth DZone Core CORE
· 12,215 Views · 3 Likes
article thumbnail
IntelliJ Integration for Mockito
This article will show you the major features of the plugin (and some of the minor ones) and how they can be useful when working with Mockito test code.
August 3, 2022
by Tamás Balog
· 8,149 Views · 3 Likes
article thumbnail
Java Class Loading: Performance Impact
Learn more about class loading in Java and its performance impact.
August 1, 2022
by Ram Lakshmanan DZone Core CORE
· 7,723 Views · 4 Likes
article thumbnail
Data Software Design Pitfalls on Java: Should We Have a Constructor on JPA?
In this article, explore details on code, especially inside the Jakarta EE world, mainly to answer the questions: should we have a constructor on JPA, and why?
July 31, 2022
by Otavio Santana DZone Core CORE
· 12,402 Views · 56 Likes
article thumbnail
Optional in Java: When Better Code Is Not an Alternative
Learn how to take advantage of this API and combine it to create a better, maintainable code design for your Java projects.
July 31, 2022
by Otavio Santana DZone Core CORE
· 15,895 Views · 5 Likes
article thumbnail
JSP vs Servlet: Difference and Comparison
The main differences between JSP and servlet, as well as describe the definitions of servlet and JSP, along with their advantages.
July 27, 2022
by Ankit Dixit
· 6,903 Views · 1 Like
article thumbnail
The Differences You Should Know About Java and Python
The two languages compete with one another as each provides excellent opportunities for developers — all you need to know about Java and Python.
July 26, 2022
by Mohit Rana
· 7,507 Views · 2 Likes
article thumbnail
Happens-Before In Java Or How To Write a Thread-Safe Application
This article explains the notion of happens-before in Java, including ways to install it, what guarantee it gives, advantages it brings, and how to use it.
July 26, 2022
by Dmitry Egorov DZone Core CORE
· 11,430 Views · 10 Likes
article thumbnail
Using Multiple Azure Storage Accounts From a Single Spring Boot App
For those occasions when one storage account just won't do
July 25, 2022
by Mark Heckler
· 6,039 Views · 2 Likes
article thumbnail
A Brief History of JavaScript
JavaScript is one of the most important languages today. Let's take a look at how JavaScript has evolved in its short history and where it is headed next.
Updated July 25, 2022
by Sebastián Peyrott
· 12,823 Views · 13 Likes
article thumbnail
50 Common Java Errors and How to Avoid Them
Bogged down with Java errors? This series presents the 50 most common compiler errors and runtime exceptions that Java devs face, and how to conquer them.
Updated July 25, 2022
by Angela Stringfellow
· 148,563 Views · 30 Likes
article thumbnail
Update on Closures Coming to Java 7
Java is changing the world around us in major ways. Here is how.
Updated July 24, 2022
by Mitch Pronschinske
· 34,519 Views · 2 Likes
article thumbnail
Automated Deployment with Mule Management Console and Maven
Automated deployment doesn't have to be difficult. Learn how to use the Mule management console and Maven to achieve automated deployment.
Updated July 24, 2022
by $$anonymous$$
· 19,301 Views · 4 Likes
article thumbnail
Java - Example Very Simple Player (JMF)
If you wonder what a JMF player is, you are in the right spot. We've noticed that many aspiring developers want to try it out but are unsure how it works. Hence, we decided to put together this guide to make things a tad easier for you. package org.jmf.example; import javax.swing.JDialog; import javax.swing.JFrame; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; import javax.swing.plaf.metal.MetalLookAndFeel; public class ExampleJMF { public static void main(String[] args) { JFrame.setDefaultLookAndFeelDecorated(true); JDialog.setDefaultLookAndFeelDecorated(true); try { UIManager.setLookAndFeel(new MetalLookAndFeel()); } catch(UnsupportedLookAndFeelException e) { e.printStackTrace(); } new exampleFrame(); } } But before we dive into it, let's answer this crucial question: What is Java? Java is a high-level language that programmers use to develop projects with few implementation dependencies. Java has transformed the web in many ways. A vast majority of online tools that we use today were built on Java. That includes websites mobile apps and multimedia playback platforms. This programming language has come a long way. This year it will be 27 years since James Gosling developed it. What is a Java Media Framework JMF is an API that enables you to play, process, and capture media audio and video. Whether you want to transmit or receive live media broadcasts and conduct videoconferences, you can easily do it thanks to this API. All thanks to RTP ”Real-time Transport Protocol of the JMF. A JMF is a straightforward player that encapsulates your multimedia component and allows you to control your player. It also offers methods that enable you to acquire necessary resources and query the current state. These are tools you will use to build page objects. For instance, if you want to scan the page and create a class. Here is what Java Media Framework can do: A multifunctional tool A JMF comes in handy, especially if you're looking for a tool that can scan a page and build a class. You can also use it to create prototype code and later build a robust application. Instrumentalization A lot of what you read about the topic of Observability mentions the benefits and potential of analyzing data, but little about how you collect it. This process is called “instrumentation” and broadly involves collecting events in infrastructure and code that include metrics, logs, and traces. There are of course dozens of methods, frameworks, and tools to help you collect the events that are important to you, and this post begins a series looking at some of those. This post focuses on introductory concepts, setting up the dependencies needed, and generating some basic metrics. Later posts will take these concepts further. An Introduction to Metrics Data Different vendors and open source projects created their own ways to represent the event data they collect. While this remains true, there are increased efforts to create portable standards that everyone can use and add their features on top of but retain interoperability. The key project is OpenTelemetry from the Cloud Native Computing Foundation (CNCF). This blog series will use the OpenTelemetry specification and SDKs, but collect and export a variety of the formats it handles. The Application Example The example for this post is an ExpressJS application that serves API endpoints and exports Prometheus-compatible metrics. The tutorial starts by adding basic instrumentation and sending metrics to a Prometheus backend, then adds more, and adds the Chronosphere collector. You can find the full and final code on GitHub. Install and Setup ExpressJS ExpressJS provides a lot of boilerplate for creating a JavaScript application that serves HTTP endpoints, so it is a great starting point. Add it to a new project by following the install steps. Capture media streams Not only does the JMF allows you to play music, but you can use it to capture media content as well. And all this will happen while you process and capture it from a source to a destination. You'll then identify each media stream by its content format. From there, the JMF will present the content of that specific video stream. Each media stream will have at least one or more tracks that you can play. Identify each media stream by location You can either identify your media stream by using uniform resource locators (URLs) or media locators. It doesn't matter how you locate them. What matters most is that you wouldn't struggle to identify each media stream. Process Time Bases and Clocks You can also play time-based media, or capture them at an accurate time. To achieve this, JMF requires time-bases and clocks. So, without a thorough understanding of time bases and clocks, you won't be able to work with JMF. While at it, use the below 1. Eliminate Unused Tables Usually, when you remove or deactivate a plugin, all the database tables remain. This can be a good thing, as you retain all the user information, preferences, and other data. However, in most cases, you’re left with a cumbersome dataset that may bring your server’s performance down. If you’re using WordPress, you can get rid of leftover tables by installing a plugin called Plugins Garbage Collector. It scans your database for any unused tables, and you can delete the ones that you know aren’t needed. A more hands-on approach is finding inactive tables using the UPDATE_TIME string. 2. Create an Execution Plan The execution plan’s main goal is to display the various methods of retrieving data by containing the operation's type and order when creating a query. If you’re not familiar with execution plans, here’s a video going through the basics. The typical execution plan includes the following: Types of operations Order of operations Indexes to use Row count estimates from stats Row count actual from results 3. Use Proper Indexing Indexing allows for faster access to the database and speeds up the queries. If you don’t use indexes at all, then processing the queries becomes painfully slow. Yet, over-indexing your database is also ineffective. Unfortunately, there isn’t a golden rule for optimizing your database the right way. However, with some trial and error, your database benefits from an index system. 4. Avoid Coding Loops A SQL query that runs more than once is inefficient and can cause unnecessary performance issues, which pile up quickly, especially with large datasets. In essence, moving a query outside a loop with the goal of it executing only once is the way to go. There are a couple of nifty solutions to achieve this. Use JOIN and GROUP BY to select data from multiple tables and have the database perform the counting with a single query. This is especially effective for multiple queries, including COUNT and MAX clauses. 5. Get Rid of Correlated Subqueries Correlated subqueries are essentially coding loops. The subquery runs row-by-row until it satisfies the parent statement. This method of processing is useful when the outcome relies on multi-part answer validation. You can avoid the correlated subqueries by using JOIN clauses, which makes the query run more efficiently. Essentially, this method replaces WHERE and removes the necessity to execute the subquery for each row separa 6. Avoid * Queries The ultimate goal of every query is to retrieve relevant data for maximum efficiency. However, it’s relatively common to use SELECT * clauses when creating a query resulting in unnecessary data. While it doesn’t play a massive role in the performance of small datasets, it can leave a significant dent in larger ones. Selecting the data sparingly helps with optimizing the query speed and reduces resource usage. A quick way to turn this issue around is using the LIMIT clause instead of SELECT *. This way, you limit the output of the query results unless you do need the entire dataset retrieved by the query.
Updated July 24, 2022
by Snippets Manager
· 10,158 Views · 1 Like
article thumbnail
My Experiences with Maven in IntelliJ IDEA and NetBeans IDE
With IntelliJ IDEA supporting a fully-functional integration with Maven, you can automate your entire building process. The result is that you can create a new Maven project as well as easily handle multi-module projects. Netbeans IDE on the other hand, simplifies the development of mobile applications as well as web and desktop applications using Java and HTML5. So imagine my surprise when some weeks ago, I saw a colleague fighting IntelliJ's Maven support. A dependency was not detected by IntelliJ's Maven support and to fix it, he had to remove the dependency from the POM, save it, add it back to the POM and save it again. Hmmm... somehow not quite optimal. This was the reason for me to take a look at IntelliJ's Maven support and compare some points with the support provided by NetBeans. Let’s look first at how IntelliJ IDEA can support an integration with Maven that is fully functional. This will assist you in automating the whole build. It doesn’t matter whether you wish to create a totally new Maven project, synchronize with an existing open project or add Maven support to existing IntelliJ IDEA projects. You can also manage projects that are multi-module. Creating New Maven Projects These are the steps I’d follow to create a new Maven Project. If you’re starting from scratch and there’s no project open currently in IntelliJ IDEA, go to the Welcome screen and click on New Project. Alternatively, you can select File and then create a new project for the main menu. Once you’ve created your new project, you must name it and if you require it, change its location. You’ll want to create the Git repository, so select the new project for placement under version control. Just be aware that you can do this at any time later in the build. Don’t forget to tick the box. Your project requires a language selection, so do that as well as add any other languages you may want via plugins. You do this by clicking “App>general add”. Under "build system", select Maven followed by specifying the project’s SDK. Or, you can go with the default or JDK. While it is not necessary, it’s a good idea to have a file with a basic sample code, so tick the “add sample code” box. Don’t neglect to specify Maven’s coordinates, which are included in the pom.xml file. You’ll find these in the advanced settings where a new project package is identified in the Groupid box and the project name is specified via the Artifactid box contents. Maven naming conventions follow Jav’s package name rules. This is in the format of a reversed domain name that you control e.g. org.apache.maven. While the naming conventions are not enforced, you’ll have a hard time getting names that don’t follow the rules in the Maven central repository, especially if it is a single word used for group IDs. When you’ve finished your selections, then click “create”. Handling Maven Projects If you open a Maven project in IntelliJ, IntelliJ still generates a default project folder (".idea") and file (".iml"). This means IntelliJ must always ensure that data in the POM is kept in sync with its proprietary structures. However, IntelliJ only handles one direction. Changes in the POM are recognized and the project settings are in sync most times. But if you change something in the project settings, these changes are not reflected in the POM. So, as my colleague experienced, you have to do it twice. Also, IntelliJ lists the "target" folder and ".idea" project settings folder in the logical project view, which is not useful most of the time. In IntelliJIDEA, the Maven project pom.xml file has a compiler included as well as the target Java version. There’s also a Maven tool window and any dependencies that are required to start work. Just bear in mind that the version of Java that is specified in the pom.xml file will, in all likelihood, override the "JDK for importer" option’s specification version. You can find this in the Maven settings. Configure Maven Settings To make things easier, configure your Maven settings before opening new projects. Configuring IntelliJ IDEA to display the Maven settings prior to opening an existing project that is being opened for the first time in IntelliJ IDEA is done at the application level. Once set, they’ll appear for any new project that you open. On the Welcome screen, “All settings” under the customize option. You can also access it from the main menu by selecting “file”, then “new project setup” followed by “preferences for new projects.” In the “preferences” dialog under settings, choose “build”, then “execution”. Under deployment, select Maven as your option under “build tools.” Now go to the Maven settings dialog and make the selection “Show settings dialog for new Maven projects”. You can then click OK and your changes will be saved for all future projects. What this does is, each time you open new projects, the Maven settings dialog is displayed by IntelliJ IDEA and you can then specify the local Maven repository’s location as well as a user settings file. In contrast, NetBeans uses the POM for pretty much everything. The Maven POM file defines the project, as shown below. If you change something in the project settings, it is directly stored in the POM. Only in rare cases, e.g., if you redefine actions, does NetBeans need to create a specific file. NetBeans only shows important information in the Projects window, as shown above. However, if you do want to see the Maven "target" folder, you can easily switch to the Files tab: Building Maven Projects When you build a Maven project in IntelliJ, with the default IDE commands, Maven is not used for the build process. The same goes for tests. If you are using different profiles for local development and your continuous integration server, you have to use Intellij's Maven integration tab to build and test your project with Maven. This is really ugly because you cannot use all the shortcuts that make life easier. NetBeans uses Maven for all that. You can simply press F11 or use the default toolbar button or menu item to build your applications with Maven. This same action works whether you are using Maven, a plain NetBeans Ant build script, or Gradle. It’s always the same consistent procedure. You can even change the Maven command that is used to build the project via F11. You are completely free to configure what you need: Executing Maven Goals Running Maven goals in IntelliJ displays a dialog with just two text fields and you have to type all the Maven parameters by hand. Hey man, it could be so much easier. Running a custom goal in NetBeans gives you a fantastic dialog with lots of possibilities. You can choose the profile, add properties, and even save everything to run it again later. This saves a lot of work. Conclusion There are many smaller issues that show that NetBeans has a smoother Maven integration than offered by IntelliJ. My impression is that IntelliJ's Maven support is just an extension to its default project management system since It still needs the default IntelliJ project folders and files. Meanwhile, NetBeans provides a much deeper and more complete integration. One more thing. I’m not an IntelliJ user so please forgive me if there is a mistake in my observations. I'm also not trying to start a new IDE war. What I want to do by means of this article is to get readers to think out of the box. If you are familiar with your IDE, that is great. If you are productive with your IDE, that is great. But if you think an IDE needs to be expensive in order to be a good product, you are totally wrong and should definitely give NetBeans a try. Thorsten Marx is a product manager and developer at e-Spirit AG in Germany.
July 24, 2022
by Thorsten Marx
· 17,320 Views · 2 Likes
article thumbnail
Kotlin Was Predicted to Overtake Java by December 2018. What Happened?
In 2018, the Realm Report predicted that Kotlin, a cross-platform programming language, would overtake Java by the end of the year. Was the forecast accurate?
Updated July 24, 2022
by Tom Smith DZone Core CORE
· 8,317 Views · 2 Likes
article thumbnail
Java 6 On Mac—Worst Release Ever (And What’s New!)
When Apple finally released Java 6 for Mac OS 10.5.2, the Java community was more than a little upset. Java 6 only supports 64 Bit on Mac No Cocoa Support What to Do About Java 6 on Mac Using Java on Mac in 2022 What’s Changed Since Java 6 Where is Java on Mac Headed? The history of Java releases on Mac has been more than a little problematic. New updates for Java always find their way to Mac a few years too late and they are often more limited than their Linux and Windows counterparts. Let’s see how Java 6 on Mac stacked up and take a look at the latest Java release for mac and see how it compares. Java 6 on Mac Only Supports 64 Bit This means that Java 6 doesn't run on 1-year-old MacBooks or all early adopters of the Intel switch. A huge amount of people can't run 64-bit. Java 6 on Mac requires much more specific technology than Java 6 did on any of its counterparts. We tend to have a lot of opinions about how to code differently with Java, but we can all agree that Java 6 didn’t really work for Mac. Another problem is that it only supports 64-bit applications, Bye-bye applets in Safari. These are huge setbacks for people who were looking forward to Java on Mac, but the problems didn’t stop here. No Cocoa Support Because of the lack of 64-bit libraries for cocoa, it is not possible to use cocoa with Java 6. Nearly every Java application on Macs uses cocoa to make it look better on Mac OS. Some even are 100% cocoa, like Cyberduck. Because of that, only a small percentage of Java applications can run on Java 6. Java 6 really needed more Mac-specific support in order to function like it did on Windows or Linux. In fact, you have a better chance of performance tuning Java on Linux than you did on a Mac. Apple Knows This Apple is well aware of these problems. The update doesn't make Java 6 the default VM. Apple's preferences dialog even warns you if you want to make it the default VM. Having Apple and Java clash like this only made things more difficult for people working with Java on a Mac. So, What To Do Now? Options were limited for working with Java 6 on Mac. What made Java 6 on Mac even worse was the lack of any good workarounds or alternatives. You either had to commit to a limited system or try something a little involved. These are your options. We only have three choices from here: Switch back to Windows / Linux for Java development Use SoyLatte and help them to create the native GUI pipeline Ask Apple to fix these issues In the long term, no. 2 would be the best. A Java implementation by a large community would have faster release times. We can't wait for Apple to fix these issues—we have to do it ourselves. Getting Java 6 to turn on Mac requires some pretty advanced Java tutorials. Now, let’s take a look at what’s changed since Java 6. Using Java on Mac in 2022 In terms of running Java on Mac, so much has changed since Java 6. In fact, it would be just a few years until the release of Java 7 things completely changed for working with Java and working on an Apple computer. We're going to take a look at some of these specific changes and just see how the landscape of using Java on a Mac has changed from Java 6 all the way to Java 17. Using Java has only gotten more developed as the years have gone by. After all, becoming a Java developer starts with getting Java running on your Mac! What’s Changed Since Java 6 on Mac If you were trying to use Java on Mac since Java 6, you were up against a lot of trouble. You'd have to either settle for a Java that didn't perform nearly as well as it did online up to your PC or go through a bunch of complicated workarounds and still be stuck without all the features. What's important to keep in mind is that Java is more important today than it's ever been. While you might hear some people saying that Java is on the way out, Java still has plenty of use and pops up everything from popular applications, to websites, and it is a highly preferred language for programmers the world over. Java Becomes Mac Native All the DIY fixes in the world couldn't get us ahead for making Java work on Mac. However, things would have quickly changed with the release of Java 7. Starting with Java 7, Java releases work with Apple technology as long as the systems are compatible. You can run compatible editions of Java with your Mac laptop or computer. It all depends on whether or not the specs of your Mac match up with the edition of Java you want to run. Here’s where to start to find some familiar limitations for using Java on a Mac. There are Still Limitations (Java, Intel, and Mac) Even though Java runs on Mac after Java 7, there are still some problems with trying to get Java to run on Apple's technology. If you’re looking for the best toolkits, tips, and tricks for Java, you’re going to need to get it running first! Despite all the advances that are made, you're still going to encounter a few problems with trying to get Java to run on a Mac. The first thing that we have to talk about is that Java is designed to work with the Intel processor versions of Mac. Now that Mac is coming out with their own processor chips, we're seeing compatibility issues with Java and plenty of other technology that people rely on. Apple's desire to keep everything proprietary and stay in a closed sandbox is definitely costing them when it comes to reliably working with some of today's most popular technology. There are also issues when it comes to which Mac operating system you're using. There's a good chance that your Java version might not be compatible with the Mac computer that you're working with depending on the operating system that that Mac runs. Where Things Are Headed for Java on Mac There is good news for the future though. As Apple’s processor technology becomes more popular, more software is going to become compatible. Java is likely to follow suit with Adobe and plenty of others working to find ways to work with Mac’s M1 processors.
July 24, 2022
by Bodo Tasche
· 33,812 Views · 1 Like
  • Previous
  • ...
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • ...
  • 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
×