How to set up smartphones and PCs. Informational portal
  • home
  • Interesting
  • Eclipse, NetBeans or IntelliJ IDEA? Choosing an IDE for Java Development. Java programming environment

Eclipse, NetBeans or IntelliJ IDEA? Choosing an IDE for Java Development. Java programming environment

We present to your attention an adaptation of an article by Martin Heller, programmer and editor of the JavaWorld resource. You've probably already heard of the top three IDEs for Java development. About 90 percent of industrial programmers use either Eclipse, NetBeans, or IntelliJ IDEA, and each IDE has its own advantages and disadvantages. In this article we will try to describe them so that you understand which one is right for you. Although, of course, it's best to try all three at work and find out which works best for you. This cannot be replaced by any review. I have worked with these IDEs before, but for this research I installed IntelliJ IDEA Ultimate 2016.2, Eclipse Neon Java EE, and NetBeans 8.1 Java EE on a MacBook Pro laptop. I have tested the IDE on several open source Java projects.

What to expect from an IDE

A modern "healthy Java developer" IDE should support Java 8, Scala, Groovy, and other Java virtual machine languages ​​that it regularly uses. Support for major application servers and the most popular web frameworks, including Spring MVC, JSF, Struts, GWT, Play, Wicket, Grails, and Vaadin, would not be superfluous. The IDE must be compatible with any builds of version control systems such as Ant, Maven, or Gradle, along with Git, SVN, CVS, Mercurial, or Bazaar. In addition, for the development environment, it is important to be able to work with databases and the client layer of your stack, have support for embedded JavaScript, TypeScript, HTML, SQL, JavaServer Pages, Hibernate, as well as the Java Persistence API. Finally, it is logical to hope that the IDE will allow you to edit, build, debug and test systems without unnecessary stress. It is ideal if the development environment supports not only smart code completion, but also smart refactoring and code metrics. In many cases, support for testing frameworks and stubs will be useful. If your team uses a ticket system and CI / CD, you need the IDE to be able to connect to them. Also, decide if you need deployment and debugging in containers and clouds. We have listed only the main expectations (perhaps you have something to add), and now let's take a closer look at our rivals.

IntelliJ IDEA


IntelliJ IDEA comes in two variants in terms of features and price: the free Community edition, and the paid Ultimate edition with extended functionality. Community edition is for JVM and Android development. The free version supports Java, Kotlin, Groovy, and Scala; Android; Maven, Gradle and SBT; works with version control systems Git, SVN, Mercurial and CVS. The Ultimate edition is tailored for web and enterprise development. This version of the IDE not only works with Git, SVN, Mercurial, and CVS, but also Perforce, ClearCase, and TFS; in it you can write in JavaScript and TypeScript; naturally, there is support for Java EE, Spring, GWT, Vaadin, Play, Grails and a number of other frameworks. And, of course, not without SQL and database tools. The idea, which is guided by the developers of this IDE, when forming a pricing policy, is that its commercial version (Ultimate) will take its place on the computers of professionals, due to which their productivity will increase. If a Java programmer makes $ 50 thousand (or even more) annually, the return on investment spent on the paid IntelliJ IDEA IDE ($ 500 per annual subscription) will happen very quickly due to even a slight acceleration of his work. In subsequent years, the price for business falls, for startups, freelancers it is significantly lower, and for students, teachers, Java champions and open source developers, it is completely free. IntelliJ IDEA impresses with its deep understanding of the code, smart ergonomics, built-in development functions and support for many languages.
Figure 1. IntelliJ IDEA shows the number of warnings and assumptions based on statistical analysis of Java code. You can explore the assumptions in more detail by clicking on them, as shown in the picture; in many cases, you will receive a list with choices and options for corrections.

Deep understanding of the code

Syntax highlighting and simple code completion are common in any modern Java editor. IDEA has taken it a step further by offering "smart completion". This term means that the development environment shows a list of the most relevant symbols that are applicable in a given context. The list of symbols depends not only on the context as such, "generally accepted", but on the programming style of the developer, on how often he uses certain operators. "End of a chain" actually shows a list of applicable characters that are allowed through methods or getters in the current context. In addition, in the case of static members or constants, IDEA automatically adds any required import statements. In all cases of autocompletion, IDEA tries to guess the type of a symbol at runtime, refine its choice, and even apply a cast if necessary. Java code often includes snippets from other languages ​​as strings. IDEA can inject SQL, XPath, HTML, CSS, or JavaScript code into Java string literals. In this sense, the IDE can refactor code in multiple languages. For example, if you rename a class in JPA mapping, IDEA will update the corresponding JPA entity and expression class. When refactoring a piece of code, the developer has one (quite natural) desire: that all duplicates of this code are also refactored. IDEA Ultimate finds duplicates and similar fragments and refactor them as well. IntelliJ IDEA parses the code on load and directly on input. It indicates suspected problems (as in our picture above) and optionally offers a list of likely quick fixes to detected problems.

Ergonomics


IntelliJ IDEA is designed so as not to knock the developer out of the state of streaming productivity if he is already in it. The Project window, shown in the first figure on the left, disappears with a simple mouse click so that the programmer can focus on the code editor window. For all the actions that are needed while writing the code, there are keyboard shortcuts for their shortcut, including the definition of symbols in pop-up windows. At first, all these combinations are difficult to remember, but gradually you get used to them, and only use them. Nevertheless, even if the programmer does not use key combinations, as practice shows, he gets used to working in IDEA quickly and easily. I would like to especially note the IDEA debugger: the values ​​of the variables are displayed directly in the editor window, next to the corresponding source code. When the state of the variable changes, the highlight color also changes.

Built-in tools

IntelliJ IDEA provides a consistent interface to interact with most version control systems, including Git, SVN, Mercurial, CVS, Perforce, and TFS. You can manage changes directly in the IDE, which is very convenient. When I tested IDEA, I had a desire for the last change in the source code to be shown in the editor window as an annotation (as happens, for example, in Visual Studio). As it turned out, IDEA has a special plugin for this. IDEA also has build tools, a test runtime, coverage tools, and a built-in terminal window. IntelliJ does not have its own profiler, but third-party plugins can be connected to it. For example, YourKit by a former JetBrains or VisualVM lead developer (this is a repackaged version of the NetBeans Profiler). Debugging in Java can be excruciating when weird things happen to classes you don't have the source for. IDEA comes with a decompiler for such cases. Server-side Java programming involves frequent database interactions, so IDEA Ultimate programmers will appreciate the convenience of SQL and database tools. But if their capabilities are not enough for someone, you can purchase the IDEA Ultimate version with the built-in SQL IDE (DataGrip). True, it will be somewhat more expensive than a regular IDEA Ultimate subscription. IntelliJ IDEA supports all major JVM application servers, and allows you to deploy and debug on these servers, eliminating the familiar difficulties that Java Enterprise programmers are familiar with. IDEA also supports Docker (using a plugin that adds a special Docker tools window to the development environment. By the way, IDEA has a sea of ​​plugins).

True polyglot

IDEA has extended code support for Spring, Java EE, Grails, Play, Android, GWT, Vaadin, Thymeleaf, Android, React, AngularJS and other frameworks. You've probably noticed that not all of them are Java specific. IDEA directly out of the box "understands" other languages ​​- Groovy, Kotlin, Scala, JavaScript, TypeScript and SQL. If you don't find the language you want in this list, there are currently 19 IntelliJ language plugins, specifically to support R, Elm and D.


For many years, Eclipse has confidently held the palm in popularity among Java IDEs. This environment is completely free, open source, written primarily in Java. However, its modular architecture allows Eclipse to be used with other languages ​​as well. The Eclipse project, initiated by IBM, appeared in 2001. They wanted to replace the family of IBM Visual Age development environments based on Smalltalk. Well, the main goal, as even the name says, was to outshine Microsoft Visual Studio (eclipse in English means eclipse). Java portability helps Eclipse to be cross-platform: This IDE runs on Linux, Mac OS X, Solaris, and Windows. For better or worse, the Java Standard Widget Toolkit (SWT) is at least partially responsible for the look and feel of Eclipse. Eclipse owes its performance (or, as some well-wishers say, its lack) to the JVM. Eclipse is quite slow because it has its roots in rather old hardware and ancient versions of the JVM. Even today it seems sluggish, especially with a lot of plugins attached to it. Some of the overhead of Eclipse can be attributed to its built-in incremental compiler, which runs whenever a file is loaded or code is updated. A useful thing, it is she who catches errors when entering text. Regardless of assembly, an Eclipse project maintains a content model that contains information about the type hierarchy, references, and declarations of Java elements. The current version of Eclipse is named Neon (4.6.0). I have installed the Eclipse Java EE IDE for Web Developers (this is far from the only option, you can choose something else). It contains a minimal Eclipse SDK and plugins are added on demand. By the way, working with plugins in this IDE is not for the faint of heart. Third-party plugins often conflict with each other, although their official specification does not say anything about this.
Figure 2. From left to right, there are four toolbars in Eclipse: Package Explorer, Java Editor, Java Class Structure, and Task List. The project loaded into Eclipse in this figure is the JUnit test framework. The panels can be easily swapped.

Plugin support

The Eclipse plugin ecosystem is both a strong point of this IDE and one of its main problems. It is because of the incompatibility of plugins that sometimes entire assemblies crash, and programmers have to start over. There are currently over 1,700 plugins written for Eclipse, official and unofficial, which may or may not work very well. Eclipse plugins support over 100 programming languages ​​and nearly 200 application development frameworks. Most Java servers are also supported: if you designate a new server connection from Eclipse, you will be taken to the vendor folder list, where you will find about 30 application servers. There will be nine variants of Apache Tomcat alone. Commercial vendors tend to bundle their solutions together: for example, there is only one Red Hat JBoss Middleware, and inside you will find WildFly and EAP server tools, as well as JBoss AS.

Editing, refactoring and debugging

The first experience with Eclipse can be confusing and even confusing. First, you need to set up Eclipse and get used to its conceptual architecture for workspaces, views, and views. This is all determined by the plugins you have installed. For server-side Java development, you will probably use the Java, Java EE, and Java browsing views, the Package Explorer view, the debug view, the Web tools command sync view, the database development view, and the database debug view. ... In practice, it all makes sense when you open the windows you want. Eclipse almost always offers several ways to accomplish a given task. For example, you can view the code using the Java browsing perspective. What to choose is a matter of taste and choice. Java Custom Search allows you to find declarations, references, and occurrences of Java packages, types, methods, fields. You can also use quick access to search and preview. Common code patterns can be generated from code patterns. Java refactoring in Eclipse supports 23 operations, ranging from common renaming operations to less obvious conversions (like in Martin Fowler's book). Eclipse supports both local and remote debugging, provided you are using a JVM that supports remote debugging. Debugging is pretty standard: you define breakpoints and then view the variables in the debug tab. Of course, you can step through your code and evaluate expressions. Eclipse has a vast database of documentation of all ages, values, and usefulness. Alas, to find a picture in the manual that does not correspond to the current version, for example, with an outdated interface and button layout, is a common thing for this IDE. Unfortunately, the problem of late documentation updates is very common for any projects with source code.


NetBeans started as a student university project in Prague in 1996. In 1997, the IDE became a commercial product, and in 1999 it was bought by Sun Microsystems (the parents of Java) and presented an open source release the next year. The current version 8.1 runs on machines running Windows, Mac OS X, Linux, and Solaris. Well, the portable package can be run on any systems for which a Java machine exists. For myself, I downloaded the Java EE bundle, which is one of six possible download packages. This bundle supports JavaScript and HTML, GlassFish and Tomcat, but does not support PHP, C / C ++ / Fortran, Groovy and Grails: you can get them in the All Inclusive package (or just All). Nevertheless, if I wish, I can at any time download support for the above languages ​​by selecting the appropriate plugin (and any other). NetBeans has fewer of them than Eclipse, but they usually do not conflict with each other. This fall, Oracle (it inherited NetBeans after the takeover of Sun Microsystems) decided to move this development environment under the wing of the Apache Software Foundation, along with all rights, source code, trademark, netbeans.org domain and a number of other infrastructure elements. Therefore, the future of the project is still vague, although earlier the system had certain kindred privileges. So, it was NetBeans who first received support for Java 8 almost immediately after the release of the updated platform, and was named "the official IDE for Java 8". However, a month after the release, this advantage was lost: it was then that other IDEs also received support for the eighth Java. However, I want to point out that NetBeans' Java 8 support is really good, and this IDE is great for weaving version 8 tricks into "legacy" code. Its editors, code analyzers and converters will help the programmer to upgrade the code using constructs typical of Java 8 - lambda expressions, function operators and method references. JavaScript plugins in NetBeans 8 do an excellent job of supporting Node.js and the latest JavaScript tools like Gulp and Mocha, as well as supporting the Nashorn JavaScript interpreter.
Figure 3. Here NetBeans is working with the same Maven-based project as IntelliJ IDEA was opened in Figure 1. Notice the expanded functionality in the context menu and refactoring submenus

Editing and refactoring

NetBeans Editor supports languages, detects errors as you type, and helps you with tooltips and smart code completion. Subjectively, the IDE copes with this task faster than Eclipse, but somewhat slower than IntelliJ IDEA. In addition, NetBeans has a full range of refactoring tools (as shown in Figure 3) that enable the programmer to restructure code without breaking it, perform source analysis, and offers a wide range of tips for quick fixes or code extensions. NetBeans includes a design tool for the Swing GUI, formerly known as "Project Matisse". Developers appreciate the Inspect & Transform automated refactoring tool introduced in NetBeans 7.1. It allows you to analyze the project code and make suggested improvements. Personally, though, I prefer to first test all my own code with unit tests, and only then run tools that can make radical changes. I have repeatedly suffered from all sorts of automatic fixes, which led to irreparable consequences.

Build, Debug, and Profiling

NetBeans has great built-in support for Maven and Ant, as well as a plugin for Gradle. I was overjoyed when I discovered that Maven projects are perceived as native by the system. This means that they can be simply opened and not imported. NetBeans also contains an attractive (and useful) graphical display for Maven dependencies. The NetBeans Java Debugger is not bad, but with caveats. A separate visual debugger allows the programmer to take screenshots of the GUI and examine the interfaces of applications made with JavaFX and Swing. The NetBeans Profiler makes it more obvious how CPU and memory are being used and has excellent tools for finding memory leaks.

Comparison of the three giants

I've used all three IDEs, Eclipse, NetBeans, and IntelliJ IDEA, over the years, in chronological order. Whenever I switched to another IDE, I felt that my productivity increased. But even when I was firmly convinced that my final choice was IDEA, I sometimes had to go back to one of the two remaining IDEs. This was the case, for example, at a time when Eclipse was the only tool that supported development for Android (today there is Android Studio, the current official IDE for Android, it is based on IntelliJ IDEA). Of course, all three IDEs have their fans and opponents. I know many Java developers who love IntelliJ IDEA, as well as loyal fans of Visual Studio C ++ and C #. More often than not, these people are happy with the fact that their productivity has increased, and the cost of the annual subscription is returned in just a few weeks of using the paid version of IDEA. However, NetBeans and Eclipse users are also often tied to their tools and wonder why other programmers would pay money for IDEA. For aspiring Java developers, I would advise you to stay away from Eclipse. Despite the fact that this is still the most popular IDE for Java, it is difficult for beginners with it: it is easy to get lost in the wilds of Eclipse, both during system deployment and during daily work. Eclipse has the most extensive plugin ecosystem among all IDEs, and also the most likely to "crash" due to the installation of an incompatible set of these same plugins. Unfortunately, while using Eclipse, I had to repeatedly remove another broken assembly of this IDE and install a "clean" bundle. NetBeans is good for most developers, it has a great profiler and I use it occasionally. However, I prefer to pay for IntelliJ IDEA Ultimate. And the future of NetBeans is still unclear. For Java beginners who do not yet have the tools to buy tools, I recommend using NetBeans or IntelliJ IDEA Community Edition depending on their needs. The first one should be chosen by those who are engaged in coding of Java servers, but only if you do not fall into the category of those who can get IntelliJ IDEA Ultimate for free or at a huge discount (students or those programmers who develop an open source project).

Lightweight Java IDEs

Most Java developers today use IDEA, NetBeans, or Eclipse, but sometimes the need arises for lighter IDEs or even code editors like Sublime Text, emacs, or vim that support Java plugins. Below I have listed reasonable options for those looking for something easier:
  • DrJava is a small free development environment. It was created for students at Rice University, and it has become quite popular: DrJava has already been downloaded over 2 million times. DrJava is committed to test-driven development. The environment contains a smart code editor, an interaction panel for evaluating application code, a source-level debugger, and unit testing tools.
  • BlueJ is a free Java development environment created by the University of Kent for aspiring programmers. This environment is supported by Oracle. BlueJ has a much more concise and simple interface than professional IDEs like NetBeans or Eclipse, and even contains a dedicated tutorial on the basics of OOP.
  • JCreator is another small Java IDE for Windows written in C ++ (for performance reasons). The paid Pro version has a debugger, Ant support and code wizards, but the free version (LE) does not.
  • Eclipse Che is a browser-based cloud IDE that supports Java, C ++, JavaScript, Python, PHP, Ruby, and SQL.

Choosing Java IDE depending on the project

I have tried to describe the important advantages of each of the three most significant Java IDEs and mentioned in passing their useful little rivals. To choose the right IDE you need to weigh the pros and cons and match them to your needs and the needs of your projects. If you are joining a team, it will be wise to use the same IDE as other developers, although this is not required. If your team is hosting the source on GitHub, it will naturally be more convenient if your IDE supports GitHub. Yes, you can handle code transfers without an IDE using the GitHub client or the git command line. But how effective will such jumps between different systems be? It is also important that the IDE maintains a build system. For example, if it's Maven, you probably won't want to rebuild the system in Ant for local testing. Fortunately, all three big Java IDEs support Ant, Maven, and Gradle, either out of the box or with a plugin. But for "small" IDEs, this may not be true. It is a natural desire that the development environment support the version of the JRE that is used in the project. If the versions do not match, it is likely that you will get a lot of unnecessary bugs, which, for example, will appear for you, while other team members will not. It is unlikely that such a situation will have a good effect on your karma. Quite frankly, JRE inconsistencies are more likely to occur with configuration errors than with no IDE support, unless the IDE has yet to update to a new version of Java. Just trust me: if your IDE fully supports the frameworks and technologies that are used in the project, it really helps to speed up your work. You can probably do it anyway. But if the IDE understands how JPA statements relate to JPA entity and expression classes (like IntelliJ), you will spend much less time on JPA-related code than in the case of a total misunderstanding. Well, if the IDE supports the testing framework and the code runner used for the project, you can run tests without changing the working environment. Which will also speed up the development process. Finally, things get faster if the IDE is compatible with the project's bug tracking and ticket systems. Again, you can use a standalone or web client, say, JIRA, but it's hard to disagree that checking tickets is much faster without changing the window, and staying directly in the IDE.

Free or Paid?

After testing it from IntelliJ IDEA Ultimate, I got the feeling of the right development environment. A sort of Cadillac of the IDE world. Again, while it's not free, I think the performance gains from using it are well worth the annual subscription. For beginners who can't afford the IntelliJ IDEA Ultimate 1-year subscription, I recommend using NetBeans over Eclipse. Of course, the Eclipse plugin ecosystem today is much more developed than any other IDE, but it is very overgrown and unkempt: a novice developer risks getting bogged down in the IDE jungle instead of immersion in work. I also touched on "lightweight" alternatives, two of which were designed specifically for educational purposes. Well, if you're just starting out with languages ​​and you prefer a minimalistic environment, why not?

Almost every owner of the most primitive mobile phone is familiar with the concept of the Java platform. The Java development environment assumes the creation of universal applications that can be used to run, regardless of the operating system installed. Let's consider the main aspects of its functioning and application.

Java development?

In fact, the development environment is purely a programming language based on generic commands recognized by the Java Runtime.

Roughly speaking, the development environment of the Java language will not work without an initially installed platform on the same Windows. But such support is provided initially, which saves any user from the need to install additional components.

Application in computer technology

This project was originally developed by Sun Microsystems, which was later supported by Oracle.

Ultimately, however, the Java development environment is completely independent from computer or mobile systems.

Built-in modules of mobile systems

When talking about smartphones and tablets, the same version of Java) refers only to the use of a graphical application that allows you to create a Java application in a few minutes.

In fact, in the application itself, some kind of addressing or request is made, the functions of which are provided in the operating system.

And this applies to mobile devices. Have you noticed that sometimes over time, either Windows Phone or Android starts to "spit" in terms of offering an immediate update? These are nothing more than two components:

  • Java Runtime;
  • Microsoft .NET Framework.

The saddest thing is that the first component is not associated with system errors. This platform is completely independent and command executable by default.

JAVA IDE: Simplest Application

No one doubts that this system is used in mobile versions. The Java Android development environment is supported, not to mention the "apple" products.

However, in terms of executable applications, things are not so simple. And that's why.

Executable applets

First, you should immediately pay attention to the system in which the corresponding archiver must be installed (WinRAR - at least better - 7-Zip).

The development environment for Java programs refers to the fact that data is saved in the form of an archive that cannot be opened by standard Windows tools.

Archived data

At best, you can use extractors like the above. But if during the formation of the archive the technologies of the additional (maximum) compression method were used, there is nothing to help.

Even updating the archiver will not be able to make the necessary changes. Here you will have to apply the update of the entire platform, although initially the message about the available update "hangs" in the system tray.

Platform update

The update is simple enough. It is enough just to click on the blinking icon in the tray, offering to install the available update. The recognition time can take up to several minutes. This is fine.

If you don't want to wait, no problem - go to the official Microsoft resource and download the program from there. Don't like this method? Install JDK or J2SE, which is a Java extension, and then install the required module from the selected ones, after which activation occurs automatically. At the end of the process, a complete system reboot may be required.

Why is Java OS independent?

As already mentioned, this programming language is object-oriented (akin to C + / C ++, on which Windows is programmed).

But its essence is that the Java virtual machine is able to translate the commands of executable applications into special bytecodes that can be recognized by any computer system, regardless of its developer. The development environment for Java programs is equally well used on PCs, Intel platforms, and mobile systems Android, Blackberry, iOS and others.

In the software environment of the "operating system" itself, there is already a built-in module responsible for executing language commands. And it in no way touches on specific frameworks like the Microsoft .NET Framework or any other that operating system manufacturers develop to run their own applets.

Mobile devices

As for even ordinary mobile phones without an operating system on board, they also have native support for this platform. As a rule, installers have JAR or JAD extensions and can be installed quite simply even on primitive phones.

In operating systems, archivers like WinRAR can be used, which recognize such self-extracting archives like SFX files without problems. When you double-click on such a file, its contents will be automatically extracted, and the archiver, together with the Java platform, in this case, runs in the background.

Needless to say, even old games on the simplest phones can be installed quite simply. Although it is believed that they do not use "advanced" operating systems, this is not the case.

Even the oldest models of the type have a platform. How else would the phone function? In the same system, as it is already clear, there is also built-in support, which is responsible for the Java development environment.

As for the commands themselves used to create applications, their description can take too long. But if the idea of ​​creating an application based on this language did arise, it is better to install a specialized program like the platform offered by the Delphi environment is very similar).

Conclusion

As you can see, the Java development environment is universal and compatible with any systems. But it works much faster than the translation of commands based on C + / C ++. According to some studies, the speed can be 20-30 times faster, although the memory consumption is at a rank higher.

But to summarize, it's worth noting the real versatility that the Java IDE offers. In fact, it is compatible with all systems, which makes it the most popular when creating the same multimedia applications or games.

Separately, it should be said that the latest versions of Java are based on support for generic programming tools, which are based on Eiffel and C # technologies, which are fundamentally different from C ++ tools. Here you can use automatic conversion of scalar data types and import of so-called static fields, not to mention the possibility of creating accompanying documentation with source code.

Java SE 6 brings many new features, including even Japanese and Buddhist calendar recognition, the ability to create a full HTTP server, faster class streams and compressed data transfers with up to 70% performance improvement, not to mention the JConsole dashboard. that supports OpenGL and DirectX.

This applies mainly to graphics adapters, although it may even apply to the use of audio devices (most often virtual ones based on ASIO4ALL drivers). The same goes for some software synthesizers or MIDI keyboards. However, the use of executable Java applets is not always foreseen.

From the author: Of all the languages ​​used in web development, Java is the most sensitive. This PL is characterized by complex syntax, highly typed data, and immunity to errors. That is why this tool for Java - IDE is so in demand. The development environment helps to bypass the pitfalls that await a programmer who writes in a text editor. If you don't want to go the long and thorny road of a text writer, welcome to the review of the top development environments most suitable for the coffee language.

Development requires an IDE

Java is one of those languages ​​for which the development environment is not a whim of individual specialists, but a real means of survival. A complex language cannot be read and executed until all the elements of the system are properly configured. Sometimes, it is difficult for a web developer to understand why he needs such cumbersome and productive software. All web languages ​​like HTML / CSS, JavaScript and PHP can be implemented without additional software (although there is even a top paid IDE for the latter - PHPStorm). But, once it comes to Java, everything falls into place. Long and complex code documents do not lend themselves to manual systematization.

But, as always, there are opponents of ideology. Some developers call IDEs "crutches", which are needed only for less trained programmers. For them, downloading a development environment is like cheating on the fundamentals. Unfortunately, this approach can leave the developer behind the evolution of programming: large enterprise projects, like highly functional web applications, require close interaction between team members, quick launch and debugging of code. Moreover, the skill of working with basic IDEs is a criterion for employment in the best positions.

Of course, there are those who know how to fine-tune their developer tools so well that a full-fledged IDE becomes unnecessary. Be that as it may, the development environment consumes device resources that are needed to power the rest of the developer tools. This is especially evident in outdated versions of Windows / Linux - as soon as the development environment starts, the rest of the resources experience stagnation.

Developers on the web almost always have a preference for text editors. They are lighter and allow you to create solutions on the knee. No additional tools, no deep customization required, and the range of software is much wider. This is the view held by web programmers until they get started with Java.

I want to choose a program

The programming industry offers many solutions for generating complete code. This is especially true for various development environments. Big companies like Oracle aren't the only ones building IDEs. Work on such software is, as a rule, the prerogative of professionals who want to optimize their activities. This is exactly what happened with Visual Studio: one of the best IDEs of all time. Microsoft, which has been gearing up to introduce a version of Windows into the new century, has simply presented its tools in one application. Now VS is the choice of millions.

Unfortunately, it cannot be called "for Java developers". No, this does not mean at all that in this development environment it will not be possible to write something in Java: there are even special extensions. It's just more focused on C, C # and some other Microsoft products. Java has its own top IDE, which we will present today. But, first, you need to understand what we want to see the ideal IDE (consonant).

First, you can immediately decide that those who work online are not suitable for a Java developer. They will create problems with interpretation, and constant dependencies will only discourage the desire for programming. A more reasonable solution would be to download one of the software presented today. It is better to click download once than constantly put up with bugs. The era of cloud-based IDEs is yet to come.

Also, a Java IDE must support a number of technologies that are required for efficient coding. These include the Java virtual machine languages: primarily Java 10, as well as Groovy and Scala. Version control is also one of the key points. Git alone won't be enough: you need Mercurial, SVN, and more. It is impossible to guess which one will be popular in a few years (Git, of course ☺). A web developer will benefit from supporting a wide range of languages, including PL databases, web languages, both front (TS, JS, HTML) and backend (one of the popular general-purpose languages). Since the JVM is special about converting the words of the programming language to byte code, powerful interpreters are also needed. They can make Java fast in theory, fast in practice.

Well, and of course, like the Java language itself, the development environment for it must be cross-platform. All other decisions hinder the development of the programmer. Since he chose Java, then he chose versatility.

The Three Elephants of Java Development

As always, there are three best and all the rest. The web development industry is already used to this, and we will not change the tradition. The advantage of our review is that there will be no paid software (almost). Each development environment you can freely download from the official site. Also, it will be one of those top charts where we will subjectively choose the winner. Well, and you can add your own decision, based on your experience and our conclusions.

Idea for web development

IntelliJ IDEA is an IDE released by JetBrains based on the Java Virtual Machine. The environment itself is also written in Java and partly in Python, and is intended for them. They immediately identified themselves as an environment for Java, back in 2001. Then the development environment presented a whole library of refactoring tools, which immediately brought IDEA to the top. The developers made a choice not so much in favor of convenience as in favor of productivity. Some routine operations are completely performed by the development environment.

We promised that there would be no paid software today. But the truth is that the ultimate version of IDEA has its own cost, albeit insignificant (up to $ 500), as for an IDE. If you are a professional javist who earns from $ 20 per hour, this is a trifle. By the way, only in the Ultimate package will the developer be able to work with the Java EE platform.

But there is also a free version of IDEA, which cannot be called a stripped-down version. Yes, some features are missing, but the language support is similar to the commercial version. It is convenient to write your first lines of code on it and extend it with plugins.

Modern trends and approaches in web development

Learn the fast growth algorithm from scratch in site building

IDEA is one of those development environments that can be called truly smart. Instead of fixes and highlighting that even the simplest text editor has, IDEA offers autocomplete: fragments of the finished program are generated at the hands of the developer. Needless to say, all brackets and other syntactic goodies will be closed automatically. And if something goes wrong and IDEA does not cope with the problem, it will immediately signal the Java developer on the other side of the screen.

Refactoring, which takes place in several languages ​​at once, also captivates. Javists know that code is never in pure Java, especially when it comes to web development. This includes database languages, hypertext, and so on. At this point, IDEA does what many are not yet capable of: analyzing the written program, the IDE separates the languages ​​from each other and analyzes them separately.

The program has well-implemented hotkeys, to which, of course, you will need to get used to. But once all this happens, productivity is off the charts. They can also cause debugging of the code, which occurs in the adjacent window.

The development environment is also notable for the fact that it is constantly expanding the number of supported technologies. However, the developers are not very dependent on these updates. They can download the appropriate plugin at any time.

IDE Eclipse

This development environment is popular not only among javists, but also among web developers in general. The price will definitely become a significant advantage over IDEA - Eclipse is completely free, as well as add-ons to it. By the way, in the plans of the creators of the development environment there was no rivalry with IDEA: they wanted to outshine the success that Visual Studio received. To some extent, they succeeded: average web programmers almost always prefer Eclipse.

What's even better than IDEA? Free access to Java EE. It is available immediately, without additional payments and installation of plugins. By the way, about the latter. Installing them in Eclipse is a significant task. They can "quarrel" among themselves, causing inconvenience to the developer. But the positive thing is their number. We advise you to choose the official ones, because in this way it is less likely that they will begin to conflict with the development environment.

Eclipse is designed for you to personalize it for yourself. Therefore, the first experience with the IDE can push you away from further use. This is the rare case when one of the best development environments needs a manual. Fortunately, there are a lot of them on YouTube.

NetBeans

It is a development environment that was born from the pen of the creators of Java - Sun Microsystem. They wanted to create the best solution for their language, so they designed an IDE that is not only Windows friendly.

It is the most cross-platform on our list. NetBeans can be run not only on the top axes, but also on any other device that is equipped with a JVM. Sun's approach is immediately apparent: they wanted their language to work on all devices (from computers to washing machines). Naturally, "beans" have been called the official Java development environment, even though it's not that great. Today, NetBeans is being developed by Oracle, which acquired Sun.

NetBeans is as smart as IDEA, capable of smart refactoring. The system copes with this task much better than Eclipse, but worse than IDEA.

As you can understand from the volume of what has been said, the best will be named IDEA. Here is a list of reasons:

understanding of programming. No one fills in code or fixes bugs as quickly as IDEA;

refactoring efficiency;

price. Yes, Eclipse is completely free. But you wouldn't buy bad food just because it's cheaper?

This is our vision! By the way, Oracle has another IDE in its arsenal, called JDeveloper, which is completely sharpened for Java. Try it too, and draw your own conclusions. And we have everything!

Modern trends and approaches in web development

Learn the fast growth algorithm from scratch in site building

Over the more than ten-year history of the Java language, not a single generation of Integrated Development Environment (IDE) has changed. The evolution of IDE tools is due to many factors, the totality of which is called information technologies, which include software and hardware components, as well as the development of the language itself, which occurs not only in depth, optimization of some features, which clearly demonstrates the arrival of new Swing libraries instead of outdated AWT, but also "in breadth", is the emergence of JSP technologies, greater integration with DBMS and application servers, support for Spring technologies, Hibernate, etc.

And if the first IDE tools, in today's understanding, represented a primitive text editor that served only for a set of source codes, and all the rest of the work, from compilation to the final assembly of the project, had to be done manually, then today's modern ones are actually multifunctional devices that take on not only familiar functions, but also a number of additional ones, starting from automatic Javadoc creation, refactoring, profiling, UML-design, a client for connecting to any DBMS, and ending with such exotic, not related to the development process, such as spellchecking.

It goes without saying that the payment for all these "conveniences" is the increased demands on computer resources. There is an opinion that 80% of users use the capabilities of existing software only 20%, this can also be projected on the IDE - tools. Since all their advantages can only be assessed by a programmer who has been developing on the appropriate technology for more than one year. And it is difficult for novice programmers to adequately evaluate this or that tool, therefore, as a rule, its independent choice is based on two criteria - the intuitive clarity of the interface and various temporal resource characteristics, such as loading, compiling, launching, the occupied amount of RAM. After all, at first you only need a compiler, a debugger, and the Java machine itself.

Therefore, the purpose of this article is to review the existing market for IDE tools for developing programs using the Java language, identifying the strengths and weaknesses of each according to various criteria, based on the analysis of the project results: "Testing and analysis of software development environments for Java" ("Testing and analyzes IDE for Java "(TAIDEJ)), which was organized by us, the coordination group of the site and took place from 01.01.2006 to 1.09.2006 on the site www.site.

The project was split into several stages. At the first stage, we developed a questionnaire, table 2, and compiled a list of Java-IDEs, table 3, which were developed from the moment the Java2 language appeared to the present, including links to both IDE tools that everyone has heard, and rather exotic. Thanks to our members, this list has been updated periodically. Here we want to express our deep gratitude to all the participants in the project, as well as to all those who discussed and constructively criticized us on the forums, table 1

Table 1. Java - forums
Java - Forum on Sources.Ru
RSDNhttp://www.rsdn.ru/?forum
Forums - Juga.Ruhttp://forum.juga.ru/
IT archiv forumshttp://www.javable.com/forum
Java Forums - Java Programminghttp://forum.java.sun.com/
java.net Forumshttp://forums.java.net
Javalobby.orghttp://www.javalobby.org/java/forums
JavaWorldhttp://www.javaworld.com/javaforums
Computer forum Ru.Boardhttp://forum.ru-board.com
Programming - iXBT Hardware BBShttp://forum.ixbt.com
JUG KPI Forumhttp://jug.in.ntu-kpi.kiev.ua/forum
CITForumhttp://forum.citforum.ru
Realcoding.NEThttp://forums.realcoding.net

When developing the questionnaire, we tried to find out the following:

  1. a tendency to change the preferences of programmers, since the once successful tools either completely stopped developing or for some reason the firms developing them left the distance, and therefore many had to switch from one IDE tool to another;
  2. how the programmer chose this or that tool;
  3. how the programmer evaluates the tools with which he worked on a five-point scale;
Table 2. Questionnaire

Further tasks were to process and analyze the obtained statistical information, assess the "resource intensity" of popular tools. In addition, reviews of some of the funds were prepared and posted on the project website.

Table 3. List of IDEs for Java.
NameManufacturerProducts webpage
1 Applet Designer ProfessionalTVObjectshttp://www.tvobjects.com/
2 ApptivityProgress Softwarehttp://apptivity.progress.com/
3 Awesume Jawa 1.0Awesume Interactive Designhttp://www.awesume.se/en/index.htm
4 Bluettefree RAD Java toolhttp://blue.donga.ac.kr/bluette/
5 BongoMarimbahttp://www.marimba.com/
6 Clarion Internet EditionTopSpeed ​​Corporationhttp://www.topspeed.com/
7 CodeWarrior ProMetroWerkshttp://www.metrowerks.com/desktop/pro/
8 Cosmo CodeSGIhttp://www.sgi.com/Products/cosmo/code/index.html
9 ED for WindowsSoft as it getshttp://www.getsoft.com/ed_java.html
10 ElixirElixir Technology Pte Ltdhttp://www.elixir.com.sg/
11 Free builderFreeBuilder collectivehttp://www.freebuilder.com/
12 GRASPGRASP Projecthttp://www.eng.auburn.edu/grasp/
13 GrinderParadigm Exchangehttp://www.tpex.com/features.htm
14 HyperwireKinetixhttp://www.ktx.com/
15 Jamba animatorInterleafhttp://www.jamba.com/
16 JambaInterleafhttp://www.jamba.com/
17 JavaManHartWarehttp://homepage.dave-world.net/~hartware/
18 Java StudioSun Microsystemshttp://www.sun.com/
19 JavelinStep aheadhttp://www.ozemail.com.au/~stepsoft/
20 JaWizInfinityEdge Systemshttp://www.infinityedge.com/
21 JBuilderInprisehttp://www.inprise.com/jbuilder/
22 JDesignerProBulletProofhttp://www.bulletproof.com/
23 JDE for EmacsPaul kinnucanhttp://sunsite.auc.dk/jde/
24 JADI SujalShahhttp://dan.hcf.jhu.edu/sujal/winjadi/
25 JIGS Cubedhttp://www.scubed.cc/
26 JipeEnvision Internet Serviceshttp://www.users.globalnet.co.uk/~eis/jipe.htm
27 JPadModelWorkshttp://www.modelworks.com/
28 KalimantanReal-Time Enterprises, Inc.http://www.real-time.com/java/kalimantan/index.html
29 KAWATEK-TOOLS, Inc.http://www.tek-tools.com/kawa/
30 LavaDan Pagehttp://www.hnet.demon.co.uk/products/lava/index.html
31 LemurIsland designhttp://www.island-design.co.uk/
32 NetBeansNetBeans, Inc.http://www.netbeans.com/
33 OEW 1.0Innovative Softwarehttp://www.isg.de/OEW/Java/
34 PARTS for JavaObjectSharehttp://www.objectshare.com/p4j/p4j2info.htm
35 PowerJSybasehttp://www.sybase.com/products/powerj/
36 RoasterNatural intelligencehttp://www.roaster.com/roaster/
37 SNiFF +TakeFive Softwarehttp://www.takefive.com/sniff/
38 SpiriteVisNet Limitedhttp://www.evis.net/
39 SuperCedeSuperCede, Inc.http://www.supercede.com/
40 VisajImperial Software Technologyhttp://www.ist.co.uk/
41 Vision jadeVision Softwarehttp://www.vision-soft.com/
42 VisualAge for JavaIBMhttp://www.software.ibm.com/ad/vajava/
43 Visual cafeSymantechttp://cafe.symantec.com/
44 Visual J ++Microsofthttp://www.microsoft.com/visualj/
45 Web Application PlatformSilverStreamhttp://www.silverstream.com/products/main/main_f.htm
46 Java WebIDEChami.comhttp://www.chami.com/webide/
47 WipeOutsoftwarebuero m & ampbhttp://www.softwarebuero.de/wipeout-eng.html
48 IntelliJ IDEAIntelliJ IDEAhttp://www.jetbrains.com/idea/
49 Eclipseeclipse.orghttp://www.eclipse.org
50 JDeveloperOraclehttp://www.oracle.com/technology/products/jdev/index.html
51 JCreatorXinox Softwarehttp://www.jcreator.com/
52 jEditjEdithttp://www.jedit.org/
53 X-DevelopOmnicore Softwarehttp://www.omnicore.com/
54 Gel IDEGExperts Inchttp://www.gexperts.com/
55 IBM Web Sphere Studio Application DeveloperIBM Softwarehttp://www-306.ibm.com/software/awdtools/studioappdev/
56 eXtendNOVELLhttp://www.novell.com/products/extend/

First, the distribution method, respectively, the IDE can be divided into paid (JBuilder, Visual Cafe ...) and free (NetBeans, Eclipse, Gel), which anyone can download from the manufacturer's website.

We decided to highlight the second classification feature not based on any specific capabilities, since, according to this feature, it would probably be possible to split the IDE indefinitely, but from the aggregates of the capabilities of the tool itself, and its resource requirements. Of course, in this case, the presence of a visual interface builder comes first, which in turn puts forward certain requirements for resources.

By this criterion, it is possible to single out tools that do not have a visual tool for GUI development (simple), for example Gel, JCreator and which have (complex) ones - JBuilder, Idea.

Accordingly, the former in RAM during operation occupy less than 30 MB, and the latter more than 100 MB. As for the visual development tools themselves, in their own experience and in the opinion of many fellow programmers with many years of experience, their use is not always justified for novice programmers, although they seem to facilitate development on the one hand, but, on the other hand, make it difficult to conceptualize such basic things Swing libraries such as layout managers, event handling, and more.

A group of DSTU students was also involved in the project (I would especially like to mention V. Egorenkov and D. Lagutin), who had just started studying OOP, whose tasks were to familiarize themselves with the IDE for Java, install them, fix parameters when loading, issue their comments and, ultimately, an independent choice of a means for the initial work. The test results are summarized in Table 4.

Table 4. Results of testing IDE - tools
ParametersGeIJСreator 3.5JBuilder XIdea 5NetBeans 4.1
Installation time1 sec1-1.5 sec58 sec22 sec50sec
installed package size10.3 MB6.49 Mb332 MB157 Mb118 MB
Distribution size4.21 Mb3.6 Mb178 Mb51.6 MB46.4MB
Running5s1-1.5 sec9 sec6 sec6 sec
The occupied space in RAM17828 Kb12960 Kb74128 Kb65604 Kb61409 Kb
The occupied amount of virtual memory9020 Kb14960 Kb78588 Kb76416 Kb70406 Kb

* For the basic configuration, a machine based on: CPU Athlon64 3000+ was taken; RAM - 1024MB DDR-SDRAM (pc3200)

After that, a seminar was held at which the results of the work were summed up, as a result of which it was found that at the initial stage of work, when the process of studying the syntactic features of the language is in progress, there is no need to use the capabilities that complex IDEs represent, although, of course, many were interested in ways to quickly develop the interface, since this feature is the most intuitive and allows you to get results right away. But, as you know, the development of the interface is an integral, but not the most important part of the application. And the increased resource requirements on the part of complex IDEs, especially given the fact that not all students' home computers even have 512 MB of RAM, give undeniable advantages to a simple IDE, therefore Gel was recognized as the leader among students among all available IDEs.

Name% of votesGrade
1 JBuilder21.47 3.0
2 Eclipse16.64 3.3
3 NetBeans14.22 2.9
4 IntelliJ IDEA11.66 3.5
5 JDeveloper7.11 2.8
6 Visual J ++5.26 1.8
7 JCreator4.26 2.3
8 VisualAge for Java3.69 2.8
9 Java Studio3.41 2.0

Based on this, let us analyze from what positions the programmer approaches the independent choice of the tool.

  1. Interface. This is the first component that the user encounters after installation and which forms the first impression of the program, and on the basis of which the final choice can be made. Here, not only the general design is evaluated, although, of course, it also affects in a certain way, but also the convenience of the location and configuration of such components as the source code window, the project window, etc.
  2. Customization. Accordingly, after the installation and the first launch of the development environment, it is configured, i.e. the paths where the installed SDK, DOCS, J2EE are located. In this component, as a rule, no significant differences are observed. Moreover, modern tools, as a rule, independently determine the installed components.
  3. Code editor. Setting the display of source codes, as a rule, also does not differ in variety, in any tool you can easily customize the point size and its size, as well as color. An important advantage is the presence of a helper when, when the mouse "hovers" on any variable or method, a rather detailed ToolTip (context window) pops up in which it is expanded, all parameters of the object are described. There are also a lot of nice little things, line numbering output, class structure display, paragraph characters display, spell check.

Having analyzed, on these grounds, all the IDE tools that exist today, you can see that there are no significant differences besides the interface design between them, and obviously the concept of convenience is subjective.

Analysis of the survey results, tables 5.6. As described above, in our survey, tools were divided into two groups, those that were previously used and which are currently used. And if among the means that were used in the past, there is a variety, we selected funds that gained more than 3% of the votes from the total number of those who participated in the survey, then among those that are currently used there is no such diversity, and we were forced to reduce the percentage of votes, and even in spite of this, they did not receive much variety.

As you can see, the "simple" IDE tool JCreator is a constant participant in the selections; this is apparently explained by the fact that it is quite easy to learn and not resource-intensive, therefore it is popular among novice programmers. JBuilder has lost ground, obviously because free tools such as Eclipse and NetBeans have begun to outperform it. Eclipse should be recognized as the undisputed leader, since it did not lose its rather high positions, but even added. The popularity of JDeveloper should be attributed to its focus on Oracle DBMS. The popularity of IntelliJ IDEA is due to the fact that at a certain point in time, the developers were able to present a product with powerful capabilities, and for several years it has been quite successfully maintaining its brand at a high level, which is also confirmed by high user ratings.

In general, it should be noted that the results of the rating were predictable, the question concerned only the distribution of seats, and a surprise, for the authors, was that NetBeans received a relatively small percentage of votes, especially given the capabilities of the latest version.

An analysis of the reasons for choosing an IDE tool showed that the choice of the first generation tools, as a rule, was carried out by chance or according to the results of an independent analysis, which is natural, since at that time the process of formation of both the language itself and the development tools was taking place. The second generation funds were chosen mainly as a result of independent analysis or advice from a friend. This is most likely due to the fact that by this time both the circle of professional Java programmers and the market for the main developers of IDE tools had formed.

Table 7. Reasons for choosing an IDE

Thus, IntelliJ IDEA, Eclipse, and NetBeans are the current leaders among Java IDE development tools. In general, they all have approximately the same functionality, and it is rather difficult to judge which one is the best. Therefore, when choosing a tool, obviously, you need to focus on the IDE on which the project is being developed, if the programmer joins the development team, or choose the most accessible one if you plan to develop an independent project.

List of sources used

  1. Zhmailov B.B. Advantages and disadvantages of developing Java programs without using IDE tools. The journal "Bulletin of computer and information technologies" No. 6, 2006.
  2. , Sergey Berdachuk, "Oracle JDeveloper 10g - Java Application Development Environment"
  3. , Alexey Litvinyuk, "Introduction to the Eclipse Integrated Development Environment"
  4. , Alexander Demyanenko, "A Brief Overview of IDE - Jbuilder"
  5. , Alexander Demyanenko, "IDE Overview - Idea"
  6. , Boris Zhmailov, "A Brief Overview of IDE - Gel"
  7. .An Overview of Automated Refactoring Tools in the Java IDE.

Almost all books and tutorials on Java for beginners start with a description of OOP: how wonderful it is and how great it is. It is clear, since in Java any other programming is simply impossible except object-oriented, then at first it is proposed to master 40..80 pages of crazy analogies with the cat / dog / duck / car hierochey, and only after that it is suggested to write "Hello, World!" ... :-)

It should be noted that absolutely all Java training is based on the most primitive output of the result to the console. That is not console application in the usual understanding, namely the output of some data line by line. Well, for example Turbo Pascal 3.0 was released in 1985 and it already had support for graphics modes. In 1990 Turbo Vision appeared - a very cool thing - ala Windows only for DOS. And in Java in 2018, only output to the console is possible. And now all this enthusiasm and coolness somehow shatters to smithereens already at the stage "Hello, World!" there is the same line-by-line output.

But, the funny thing is that in Java you can actually create programs using visual programming! I found out about this only when I read (or rather familiarized myself) with a 500-page book, where in one of the last chapters, it suddenly turned out that there are normal GUIs (graphical user interfaces) for Java and you can design programs with buttons, input fields and normal menus ... The question arises: why did you “fiddle” with this lousy console for so long, when you could do everything beautifully and neatly at once?

After spending several days studying this issue, I found out a few funny nuances.

First- There are three types of GUI for Java (libraries): AWT, Swing(who comes up with such names?) and JavaFX.

Today (Java 8 and 9) they are all included in the JDK package: that is, everything works out of the box and you do not need to bother installing them. This is a big plus.

But, AWT is the first and very old implementation, so you don't need to use it. In general, it is not kosher. Swing is also non-kosher, because something is wrong there and the programs are terribly slow because of it. More precisely, I will not say, I did not understand it, but it seems like it is no longer officially developing several versions. But JavaFX is good and our bright future.

There is also such an abomination - java applets, those that work in the browser and at the same time "hang" it tightly, roughly like Flash, only worse. Fortunately, this / these piece / pieces are practically not used anymore, so it is pointless to waste time studying them.

So the only thing worth spending your time on is JavaFX.

Second moment... It is not that simple. Consider Delphi (or Visual Studio, Lazarus, it doesn't matter). Even for a "green" beginner, creating a simple program (one button and a text field for output) will work like this:

  • start Delphi;
  • a new project with the main form is automatically created;
  • select the button on the palette of components and place it on the form; everything is visual
  • similarly, we throw a text field on the form;
  • if necessary, in the property bar, you can specify the button text, dimensions, etc .;
  • run - Delphi will offer to save, save.

That is, we did not write a single line of code, the IDE did everything by itself. If you look at the generated code, you cannot call it simple - some knowledge is already required here, but Delphi is smart enough to understand how to work with it.

If we want to add some action, for example, when clicking on a button, fill the text field with the phrase "Hello!", Then we do this:

  • double click on the button (or select the onClick event);
  • Delphi creates the handler code for this event and puts us in the editor;
  • we type the name of the text field and Delphi gives hints by which you can navigate what and how to do.

That is, again, the IDE did all the rough work.

But this is in other languages, Java goes its own way. To create a button in JavaFX, you need to manually create a Stage - "theatrical stage" (the name is in all seriousness!) And on them place a scene (Scene). To it is some kind of container in which other elements are already nested.

It is assumed that each element and each of its properties must be programmed individually. Here's an example for two buttons and one label from my tutorial.

Response = new Label ("Push a Button"); Button btnUp = new Button ("Up"); Button btnDown = new Button ("Down"); btnUp.setOnAction (new EventHandler () (public void handle (ActionEvent ae) (response.setText ("You pressed Up.");))); btnDown.setOnAction (new EventHandler () (public void handle (ActionEvent ae) (response.setText ("You pressed Down.");))); rootNode.getChildren (). addAll (btnUp, btnDown, response); ...

When there are about a dozen buttons, plus 20 menu items, plus 30 other components, the code will not seem small. And this is without the code that is responsible for additional properties, such as alignment, sizes, font ... And this is second indicates that the JavaFX tutorials show you how to write "fx-code" with pens. Longing, in a word ...

But, here there is a salutary third nuance... It turns out that smart people (apparently familiar with full-fledged IDEs) have developed another kind of applications, where a descriptive xml file is used to generate the "fx-code", which is called fxml, and such programs change as “ FXML JavaFX Applications»

It’s totally surprising to me that learning Java doesn’t start with these kinds of applications. It may not be Delphi, but it is still a million million times better than working with the console and bothering yourself with other rubbish about why you need to use hundreds of OOP lines where in other languages ​​it takes one simple procedure. ;-)

Seriously now. If you have never programmed in Java, you can try it now. Actually - it's pretty cool, although it will take a little time to get comfortable with the programs. If you have experience with "visual IDEs", then even better - you will meet a lot of friends.

JDK

Java must be installed on your computer. I will not provide links on how to do this - google to help, because everything is too simple.

IDE

Java does not have a single program - a development environment, so there are examples from different programs on the Web. The most primitive ones, like Notepad ++, are suitable only for console output, but if we consider something more serious, then only three candidates stand out: NetBeans, Eclipse and IntelliJ IDEA.

NetBeans- the simplest program that quickly (relative to the rest) starts up and works pretty well.

Eclipse is also a good option, more powerful than NetBeans, but weaker than IntelliJ IDEA.

IntelliJ IDEA- looks the coolest, but you have to pay for it with the speed of work. It is worth noting that Android Studio is based on IntelliJ IDEA, but for some reason the studio works much slower.

An important point is related to programming for Android. Of these three IDEs, only IntelliJ IDEA is more or less suitable for this. There are a lot of materials on the Web about programming for Android in Eclipse, but they are all already outdated - don't waste time launching an old ADT plug-in and trying to do at least something with it. Maybe the old Android SDK will work, but all the new ones won't.

I'll show you how to make a JavaFX FXML application in all three programs, but before proceeding, you need to install one more program: SceneBuilder (use the Java 8 version). This is the key program where, in fact, all visual construction is performed. SceneBuilder can work independently without an IDE, so you can run it and see how it works. The output will be an fxml file that contains all the required markup. This file is used in the IDE instead of writing a megaton of code. :-)

TK

The program you create will be very simple - a button and a text box. When you click on the button, add the text "Hello!" To the text field.

In each program, you need to pre-register the setting - used by the JDK. If you can't figure out how to do this, google it.

NetBeans

Before starting work, you need to connect SceneBuilder: Tools - Options - Java - JavaFX - Scene Builder Home Page... Select the program directory. It is enough to make the setting once. This applies to all IDEs.

Create a new project where you need to select "FXML JavaFX Application".

Click "Finish" and, after some NetBeans work, we see the finished files:

  • Myfx.java is the main file that actually launches the entire program.
  • FXMLDocumentController.java- this is the "controller", where the programming will be mainly.
  • FXMLDocument.fxml- this file stores the visual part.

Now run the program. First, the assembly and compilation will go (pretty fast), after which the window of our program will pop up.

This is cool because we haven't written a single line of code, but we've already got a program with a working button. :-)

If you have correctly specified the path to SceneBuilder, then you can select the menu item "Open" on file FXMLDocument.fxml... The same will happen if you double-click. SceneBuilder will open. If there is no item, then the path is incorrect, check the setting.

The principle of operation in SceneBuilder is the same for all IDEs, so while I describe only general points, then you yourself will figure it out.

It is worth noting that after editing the file, you do not need to close SceneBuilder. You just need to save (Ctrl + S) and switch to the IDE - it will pick up the changes by itself.

The SceneBuilder window is divided into three parts:

  • on the left - sets of components, hierarchy and Controller, where the main class is indicated (this is important!)
  • in the center is the form itself, where the visual construction takes place.
  • on the right - the properties of the components, divided into three tabs (this is a conditional division). The Code tab is responsible for what will be used in the java file.

Building FX programs must start with a container. In this example NetBeans used Anchorpane... It is quite handy, allowing you to adjust the "correct" indentation for nested elements. Tab Containers contains other containers with which you can practice on your own (I haven't mastered half myself yet :-)).

The hierarchy of components is a very handy thing that allows you to quickly select the desired item.

According to the terms of the TK, we must have a text field. NetBeans uses Label, but we will not delete anything, but just add a new item TextField on the shape (arbitrarily to your taste).

In SceneBuilder, preview is possible (Ctrl + P). In this mode, only the form and all "no java programming" elements are displayed.

Now an important point: in order to be able to use the component in a java program (in our code), two things must be done.

The first is to check that the correct controller is specified. In our case, NetBeans has already done everything and specified myfx.FXMLDocumentController.

As you can see, this is the controller from the file FXMLDocumentController.java(package.controller). IDEs do not always specify it, but this is important, since the fxml file (more precisely java code) uses it for binding.

The second point - the component used must have its own ID - this is the fx: id parameter. Here I indicated textField1.

A yellow triangle will appear at the top of the message that there is supposedly no link between this id and the controller. Do not pay attention to it for now, this will be discussed further.

The button that will fill the text field must also have its own id, as well as an onAction event method (this is the main event of the component, not onClick, as in Delphi). NetBeans has already taken care of this, so we don't have to write anything.

This is where the visual construction can be completed. Save and switch to NetBeans. We see that the file FXMLDocument.fxml changed: added textField1:

Now we need to use the textbox somehow in java code. Unlike Delphi, NetBeans doesn't generate any code for this, so we'll have to add it semi-manually. To do this, different IDEs use different methods, but the general principle is that you need to set the cursor to the desired field in the editor and execute some "action"... NetBeans calls it Install controller on the menu A source... (Yes, Java has big problems with naming ...)

After executing this command, there will be a transition to the file FXMLDocumentController.java where the variable declaration will be added to the code textField1:

Note the "@FXML" - this annotation indicates that the code is somehow used in the FXML. After these changes, SceneBuilder will no longer issue a warning like the yellow triangle did earlier. If you run SceneBuilder again, you can check this.

We launch the program for execution for the test. Now our task is to fill the text field by clicking on the button. As you already understood the method handleButtonAction just does the job. We add in it:

TextField1.setText ("Hello!");

Notice how it works code completion after the point is clicked.

As you type, NetBeans will narrow down the suggestions where you can select the option you want. This feature makes life very much easier for programmers, since there are too many options and this allows you to avoid various kinds of syntax errors when typing.

This feature is present in all IDEs, although there are differences in implementation and use.

We launch the program and see that everything works as it should.

We had to write just one line of code, well, and perform a few additional actions in the editor.

Eclipse

Eclipse takes slightly longer to launch than NetBeans. First, you need to specify the path to the SceneBuilder. This is done in Window - Preferences - JavaFX.

Please also note that Eclipse is a non-Russified program (I don't even know if there is a Russifier for it).

Create a new project and select JavaFX.

We press Next and we get to the settings page. Here I indicated the name of the project, as before myfx(I have different project directories for different IDEs, so they do not overlap with each other).

Here you need to select the type of application, the type of container and the name of the controller. We press Finish and Eclipse quickly generates the skeleton of our future program.

Everything is very similar here, only one more file has been added application.css- yes, yes, in JavaFX you can use CSS to customize the look! Eclipse immediately generated a connection code for this file.

Let's run the program and make sure there are no errors.

Unlike NetBeans, this is a completely empty form. Let's open it in SceneBuilder using the context menu.

And here we see that there is no form. But, in fact, it is - it just defaults to the calculated size (height and width), which in this case is zero. There are no components! In our case, this is not quite what we need, so we will select BorderPane in the hierarchical list and in the properties Pref Width and Pref Height we will indicate some values. These properties set the "desired" width and height. After that, the form immediately "manifests".

The BorderPane container has 4 parts: top, right, bottom, left, and center. Components should be placed in different parts - this will determine their position when the window is resized.

It is rather difficult to explain in words here, just try to place a few buttons, and then resize the window in the preview.

I did not become too smart and placed a text field at the top, and a button in the center.

Now let's check that the controller is specified: in this case application.SampleController“Eclipse did the job for us.

Now we need to specify the id for our elements. For the button, I set btn1, and the text field textField1... We again got the message "yellow triangle".

For the button, we will point the method to the event - btn1Click.

Let's save and return to Eclipse. We will see that the file Sample.fxml updated, but warning icons appeared next to some lines.

The situation here is exactly the same as in NetBeans - you need to make changes in the "semi-manual" mode. In Eclipse, the context menu for the second mouse button is used for this: Quick Fix or hotkey Ctrl + 1(which is more convenient).

At the same time, a hint about the intended action pops up. For example for textField1 it is proposed to add an identifier to the controller:

and for the button there is also an event handler method:

At the same time, Eclipse slows down a little and changes are not immediately displayed on the screen. Here you need to either switch to the controller file, or wait a little. As a result, the necessary changes will be added to the code and the warning icons will disappear.

Let's add our code as we did before in NetBeans.

Pay attention to the more intelligent work of autocompletion. In automatic mode, it slows down a little, but if you press Ctrl + Space(the same combination is used in many IDEs), it also allows you to get a good help.

We launch our program.

And we add one more IDE to our account. :-)

IntelliJ IDEA

IntelliJ IDEA starts up rather slowly, you can have time to check your mail. :-)

Again, specify the path to the SceneBuilder: File - Settings:

And we indicate its name (as usual - myfx):

IntelliJ IDEA will initialize and we will see the already familiar three files. Let's run the program to check that there are no errors.

There is also an empty form, but the title of the program is indicated. If you look at the code Main.java, then we will see the line:

PrimaryStage.setTitle ("Hello World");

This is the title of the application. In other IDEs this line is absent, but now we know what the "theater stage" is for. ;-)

Switch to SceneBuilder (similar to Eclipse): with the second mouse button you need to select Open in SceneBuilder.

There is also an empty form, but with a container GridPane... Install Pref Width and Pref Height to display the form.

The GridPane itself is an ala grid of cells for the elements. I think there is no point in repeating here - all actions will be the same:

  • place a button and a test field,
  • assign them id,
  • for the button, register a method for handling a click,
  • do not forget to check if the controller is specified ( sample.Controller).

Close SceneBuilder and return to IntelliJ IDEA. Here you need to add ids to the code, as well as create a method to respond to button clicks.

IntelliJ IDEA offers two ways to do this. First, when you hover the mouse over the "problem area", a hint will appear, which you can click on:

The second is a hotkey Alt + Enter

Each time you add, you switch to the controller file, where you can immediately see the changes.

At the same time, note, the line "@FXML" is not added. If we manually add it before the variables and the method, then IntelliJ IDEA will immediately offer to add the required java class:

In general, IntelliJ IDEA shows quite good intelligence and acts as an assistant in writing code. And it does it on its own without unnecessary button presses.

Well, let's add our code for the handler and run the program:

Great, everything works!

Total

The main takeaway is visual programming is possible in Java... It may not be ideal, but it is quite suitable, especially for beginners. Learning a language is much more interesting when there is some tangible result - OOP, classes and other wisdom - this is good, but it is better to start with buttons, input fields, menus and everything that a normal program implies. And the console is boring and uninteresting.

I brought three IDEs for a reason. There are a lot of examples on the Web for Java and they are all for different programs. Personally, I have not yet decided on my preference, since everyone has both pros and cons. Probably you need to work with everyone, then it will be clear.

But, the key point is the ability to work with SceneBuilder. Building a form in JavaFX is slightly different from that of Delphi, primarily in the use of complex containers (they can be nested within each other). Therefore, you should first deal with them, after which you can already take on the components themselves.

Top related articles