News for hackers. Stuff that matters.
Re:Java Is Underhyped by the_gipsy on Friday April 16, 2021 @08:20AM (#26832958)
I'm talking about a maven project I have to use sometimes at work. Let me walk you through all the shit I had to do:

  - Install and set the right java version system-wide
  - Copy some config files for the project system-wide (granted, this is not java specific, but still)
  - Click in some IDE menu to enable some build settings
  - Click in some IDE menu to install some "Lombok" plugin
  - Click in some IDE menu to select the right jdk
  - Click in some IDE menu to edit the run configuration:
    - select main class
    - paste program args
    - paste env vars
    - select right “Use classpath of module:” option
  - Click in some IDE menu to fiddle with "Spring Loader path": modules, dependencies, reorder the dependencies (!)
  - Click in some IDE menu to configure getting the actual logs
  - Click maven-sync, rebuild-project multiple times, restart IDE until it suddenly works
The first guy who got it to work had to write a guide with screenshots!

I know you will say, this is all fault of whoever made this crap project, or my fault for not fixing it. However this was my experience, and it has been similar every time in my life that I had to touch some java project (although this last one is the worst).

Re:Java Is Underhyped by oblio on Friday April 16, 2021 @10:39AM (#26834426)
I've interacted to a ton of Java projects. And with a ton of various other commercial and Open Source projects.

In my experience (sample size of hundreds of projects), Maven projects are <<by far>>, on average, easier to build and manage than most other languages. The repo structure is standardized, the build cycle is standardized, the built packages are always in the same place, etc.

The Java installation is a 1-time think. It's also a quick google away. I see this complaint a lot, I never understand it. It's plain and simple bikeshedding: someone complaining about a 1-time task that takes 5 minutes in total.

The rest of the stuff is IDE specific and I have no idea why you'd have to configure "getting the actual logs"?

Re:Java Is Underhyped by the_gipsy on Friday April 16, 2021 @10:53AM (#26834623)
Well Java is arguably one of the most IDE-reliant mainstream languages. It's completely unusable and unergonomic without the myriad of constant code generation and fixing as you write.

Treating the IDE like a separate problem is not realistic with java.

With e.g. Rust, I can use vim, vscode, whatever floats your boat.

> no idea why you'd have to configure "getting the actual logs"?

Some genius java logging library, I can only guess.

Re:Java Is Underhyped by throwaway189262 on Friday April 16, 2021 @03:33PM (#26838145)
IMO it's the other way around. Java has some of the best IDE's around so everyone uses them. You can code in notepad and compile with maven but why would you?

With Rust you code in VIM because there's nothing better. Improving Rust IDE's has been one of the teams big focuses for years. Everyone codes in random text editors because there's no amazing IDE.

Re:Java Is Underhyped by the_gipsy on Saturday April 17, 2021 @04:28AM (#26842600)
With rust yoy don't need to constantly generate code. Vim is just perfect, if you have rust-analyze you get inline errors, code completion, jump to definition, autoimport, autoformat...

You don't need to constantly "extract method", move to class, generate all these mountains of classes by rightclick. This says a lot about the language.

But the main point is that with rust it actually just works: there is one way to set global toolchain and per project/dir. You're not required to also click through a million menus and dialogs and copypaste stuff and sync and rebuild and restart to get the editor barely working.

Re:Java Is Underhyped by throwaway189262 on Saturday April 17, 2021 @06:39PM (#26848069)
> With rust you don't need to constantly generate code.

In Rust, macros generate code on build. In Java, Annotations Processors do. I don't see a big difference between these approaches, besides Java's mechanism being older and crustier. Rust macros generate tons of code.

> if you have rust-analyze you get inline errors, code completion, jump to definition, autoimport, autoformat...

Last time I checked, Rust analyzer was in alpha/beta. Java has all this and it's battle-tested. Including language server for VScode and other lightweight editors, and several options for build plugins that auto format.

> You don't need to constantly "extract method", move to class, generate all these mountains of classes by rightclick.

Lombok, or one of the popular Builder libraries, gets rid of all this boilerplate. I don't generate anything using IDE. In my experience, most Java user don't. There's many mature libraries for geting around class ceremony.

> there is one way to set global toolchain and per project/dir. You're not required to also click through a million menus and dialogs and copypaste stuff and sync and rebuild and restart to get the editor barely working.

You are right. Rusts build system is simpler and better integrated. But Java has amazing build tools, maybe the best out there. A properly configured maven project will compile, test, and run with one command. And it will import into your IDE with a simple "import project, yes"

I have worked on a ton of Java projects over the years and never had to deal with most of what your describe.

Re:Java Is Underhyped by oblio on Friday April 16, 2021 @01:14PM (#26836573)
> Well Java is arguably one of the most IDE-reliant mainstream languages. It's completely unusable and unergonomic without the myriad of constant code generation and fixing as you write.

True, but with IntelliJ 99% of what you wrote is auto-configured.

Eclipse needs a bit of hand-holding, but almost everything you described is due to project configuration.

> Some genius java logging library, I can only guess.

That's your problem, you're assuming that Java is dumb and its libraries are dumb. They're not. I'm reasonably sure that <<all>> mainstream Java logging libraries log to console by default.

The previous engineer must have been a marvel of a developer to manage to screw even that up.

What I'd say is: Java, especially older enterprise code, had a ton of over-engineered patterns. These are slowly fading away, except for Spring, and even Spring's simpler these days. Java also tends to have some low quality and a ton of average but unmotivated working devs on Java projects. So yeah, there's that ecosystem problem.

But for example, if you'd start a new project and you approach Java with an open mind, it's one of the most powerful and flexible techs available. And it's much more modern than the stereotypes imply.

Re:Java Is Underhyped by the_gipsy on Friday April 16, 2021 @02:34PM (#26837461)
> with IntelliJ 99% of what you described is auto-configured

It is not, that's what I'm saying. And I don't understand why, if IntelliJ is the de-facto IDE. I'm sure that a fresh project is a one-click import, but an average project that isn't fresh anymore, always have similar IDE-setup-magic problems. At least in my experience over the years.

Re:Java Is Underhyped by JAlexoid on Friday April 16, 2021 @07:49PM (#26840300)
I code in Java, Scala and Python using an IDE just because I like to not remember the documentation to the code.

I know plenty of people who don't use a formal IDE. This "I don't use an IDE" is a stupid flex.

Re:Java Is Underhyped by the_gipsy on Saturday April 17, 2021 @04:36AM (#26842625)
Me too, that's why I have vim setup with language-servers. I get inline type info, code completion and so on.

It's not a flex, simply a matter of preference: I find using the mouse too irritating, others prefer it because it's simpler.

But that's not my gripe, my gripe is that setting up IntelliJ, the one defacto standard IDE to actually work is some voodoo ritual of a dozen steps and restarts and so on.

Re:Java Is Underhyped by Yeroc on Friday April 16, 2021 @03:28PM (#26838079)
In my experience even Eclipse does a pretty good job of importing Maven projects without needing to tweak things.
Re:Java Is Underhyped by Deadron on Tuesday April 20, 2021 @02:36PM (#26879059)
Surprisingly, or maybe not, slf4j requires an implementation to be provided at runtime to log anything.
Re:Java Is Underhyped by kaba0 on Friday April 16, 2021 @11:10AM (#26834840)
You can write java with vim, without any trouble. It’s just that Java has the very best IDEs available and I would be stupid to not use them.
Re:Java Is Underhyped by furstenheim on Friday April 16, 2021 @05:26PM (#26839250)
100% lombok can only be developed on eclipse. They have an open issue to make it compile on intellij...
Re:Java Is Underhyped by oblio on Friday April 16, 2021 @06:42PM (#26839846)
I don't know if something changed, but for sure 2 years ago I used Lombok with IntelliJ.
Re:Java Is Underhyped by furstenheim on Saturday April 17, 2021 @03:17AM (#26842279)
I don't mean lombok as a library, which works. I mean developing lombok itself
Re:Java Is Underhyped by oblio on Sunday April 18, 2021 @03:39PM (#26855615)
Ah, sorry, haven't done that. It sucks if it's Eclipse only :-(

However I'd expect Lombok users to outnumber Lombok devs 100k to 1 :-)

Re:Java Is Underhyped by furstenheim on Wednesday April 21, 2021 @06:23AM (#26887591)
Specially since it can only done in Eclipse xd
Re:Java Is Underhyped by kybernetikos on Saturday April 17, 2021 @04:07AM (#26842503)
> The Java installation is a 1-time think. It's also a quick google away. I see this complaint a lot, I never understand it. It's plain and simple bikeshedding: someone complaining about a 1-time task that takes 5 minutes in total.

I frequently find that the particular constellation of build tooling and libraries particular projects have requires a particular version of the jvm and all the environment variables set up correctly. In some other languages there is widely used tooling to manage the install and use of the appropriate platform version for the project.

If you're working with a variety of projects, fiddling with the installed jvm and java_home and friends is not a one time thing.

Re:Java Is Underhyped by Nursie on Friday April 16, 2021 @08:50AM (#26833238)
> I know you will say, this is all fault of whoever made this crap project

It is. There's really no excuse for that. If it's been similar every time then you've worked on crap every time.

Building a java project should be (and is on projects I work on) as easy as installing a jvm and running either maven or gradle to build it. End of story.

"Install some lombok plugin" is only necessary if you want the IDE to understand lombok, IntelliJ will just pop up a box saying "Want this?" and you click "Yes". I don't see what's so onerous about that.

The rest you describe is really down to poor developers.

Re:Java Is Underhyped by shoemakersteve on Friday April 16, 2021 @01:04PM (#26836445)
No offense, but regardless of how right you might be, you come off as a bit of a condescending asshole. Like "Oh, you don't know that there's a more efficient way to do things? There can't possibly be any explanation other than you're literal human garbage and presumably have brain damage!". Come on, get off your high horse.
Re:Java Is Underhyped by Nursie on Friday April 16, 2021 @01:08PM (#26836503)
I'm really not on my high horse here, if you have a team working on a java project that's that hard to build, they're doing it wrong. Doesn't even matter what the language is really.

So "no offense", but shove it.

Re:Java Is Underhyped by JAlexoid on Friday April 16, 2021 @07:51PM (#26840317)
There's a difference between - "anything can be turned into an non-compiling pile of crap" and "this ecosystem comes as a pile of crap".
Re:Java Is Underhyped by kaba0 on Friday April 16, 2021 @11:09AM (#26834827)
> I know you will say, this is all fault of whoever made this crap project, or my fault for not fixing it. However this was my experience, and it has been similar every time in my life that I had to touch some java project

Yeah that’s a crap project. My experience was always that mvn install / ./gradlew run will just work. On all three OSs. And if I happen upon a decade old random jar file, and run java -jar something.jar, it will just work in the great majority of time. I think no other platform has it this smooth.

Re:Java Is Underhyped by sixbrx on Friday April 16, 2021 @08:41AM (#26833143)
IDE's can be fiddly, and anyway I don't think it's good to depend on an IDE for building.

The project could have been set up instead with the "Maven wrapper"(1) which provides "mvn.cmd/sh" scripts at the top level of the project to fetch and run the proper Maven. So after cloning the project, all you have to do is set a proper JAVA_HOME if it's not already set, and then do "./mvn clean package" at the top of the project to do a complete build. The IDE's will then set themselves up properly if you import the project as a Maven project, and will sync with changes to the Maven pom.xml whenever it changes (Intellij does at least). That's really hard to beat.

(1) https://github.com/takari/maven-wrapper (Being integrated into Maven itself soon).

Re:Java Is Underhyped by the_gipsy on Friday April 16, 2021 @10:00AM (#26833957)
I can (and often do) build from CLI, that is much smoother. I tried using vim on java, but honestly you need an IDE for all the constant code generation and incessant fixups by mouseclicks that are needed. Vim+coc is more than enough in the other languages that I use.
Re:Java Is Underhyped by dboreham on Friday April 16, 2021 @10:24AM (#26834252)
You're living in a parallel universe from the rest of us. IDE isn't necessary (and positively odd) for building Java.
Re:Java Is Underhyped by vips7L on Friday April 16, 2021 @11:19AM (#26834940)
He is. VsCode (or any editor) + the Eclipse Language Server is more than enough. His complaints about debugging is because he doesn't know about attach debugging.
Re:Java Is Underhyped by the_gipsy on Friday April 16, 2021 @10:46AM (#26834519)
You do need to be able to build from IDE when you set breakpoints to debug.
Re:Java Is Underhyped by Hackbraten on Friday April 16, 2021 @10:50AM (#26834585)
Your IDE should be able to connect to any JVM that has been launched with the proper VM arguments.

We occasionally do remote debugging at work. It’s just a matter of copy/pasting the correct JVM incantation into the IDE.

Re:Java Is Underhyped by Hackbraten on Friday April 16, 2021 @10:47AM (#26834538)
I feel the parent comment was about editing, not building.
Re:Java Is Underhyped by ivan_gammel on Friday April 16, 2021 @10:00AM (#26833950)
I can find maybe only one or two things from this list related to Java, both not reflecting current state of affairs. You do not make the need to have a run configuration a language or platform fault, do you?
Re:Java Is Underhyped by KronisLV on Friday April 16, 2021 @04:41PM (#26838842)
If you're using IntelliJ from JetBrains, there should be an option to store the run profiles for the project in the version control system.

Even if your project is so messy, then you should be able to just to version a working setup (maybe needing to figure out how to make the correct JDK version be used across different machines) and after that it'd become a question of just having to check out the project from the version control system and click a green button in IntelliJ.

This most likely wouldn't solve all of your issues, but at least would help make onboarding slightly less painful and slow.

Re:Java Is Underhyped by lenkite on Sunday April 18, 2021 @01:46AM (#26850094)
Isn't this rather overblown ? The first 5 steps appear to be a ONE-time framework and system setup for your IDE - and this assumes you have multiple JDK's. You certainly don't need to repeat this for every project.

The run configuration can be automatically created by Intellij by attempting to execute a runnable class. You only need to set program args and env vars if needed - and that would be true for ANY language or program.

The spring loader path appears to be specific for this project.

The run logs are independent of Java. Thats just getting program logs.

There is no need to maven-sync and rebuild-project multiple times, unless you are explicitly refactoring the project module/build structure. Once you have imported a maven project, you can simply click build.

Re:Java Is Underhyped by cutler on Friday April 16, 2021 @06:47PM (#26839885)
You left out Gradle installed/downloaded options, Gradle version, Gradle JVM version, Gradle plugin auto-upgrades and the unholy mess this lot can create.
Re:Java Is Underhyped by ta988 on Saturday April 17, 2021 @10:57AM (#26844670)
This is why we virtually all use the ./gradlew script that manage all of that by itself on every platform... No global installation of gradle should ever be done.
Re:Java Is Underhyped by liveoneggs on Friday April 16, 2021 @10:26AM (#26834278)
You say this as if python could do any better
Re:Java Is Underhyped by towndrunk on Friday April 16, 2021 @08:56AM (#26833288)
I think you work at the same company as me!
Re:Java Is Underhyped by dunefox on Friday April 16, 2021 @08:46AM (#26833188)
This is one of the main reasons why I won't work with Java. Everything is much more complex and unnecessarily arcane compared to other languages.