Does Java 22 Kill Build Tools? - Inside Java Newscast #63

Поділитися
Вставка
  • Опубліковано 16 чер 2024
  • #Java 22 brings multi source-file execution to the platform. It allows us to run programs consisting of multiple source files and even dependencies with just a simple `java` command. For experienced developers, this will make exploration and experimentation simpler but it's a real game changer for people just learning Java or even just to program: They can now write Java code from single to multiple source files and even add dependencies before they need to consider an IDE or build tool.
    JEP 458: openjdk.org/jeps/458
    ~~~ Chapters ~~~
    0:00 Intro
    1:24 Launching Multiple Source Files
    3:10 Launching With Dependencies
    3:44 Compilation Odds & Ends
    4:42 But... Why?
    6:34 Outro
    Tags: #Java #Java22 #OpenJDK
  • Наука та технологія

КОМЕНТАРІ • 93

  • @niklasklein696
    @niklasklein696 4 місяці тому +58

    I actually think this is a huge change for the tutorial/beginner/basics part of the java community. Makes applications easier and less overwhelming for beginners to run. IDEs are often introduced (too) early to reduce overwhelm in the building/compiling process of files.

    • @dragondove6197
      @dragondove6197 3 місяці тому +2

      That's what I'm scared when first time learning C#. With dotnet, I even don't know how to compile a single .cs file and run it. And someone told me to setup a project first, but what is a project, why I should do that, I just want to run my hello world code!!!

    • @ITksh-zp1ob
      @ITksh-zp1ob 3 місяці тому

      so do you propose to start learning programming without IDE, like from notepad without assistance in syntax, highlighting tools and imports? how offen you run java code from console? just useless.

    • @dragondove6197
      @dragondove6197 3 місяці тому +1

      @@ITksh-zp1ob For learning purpose, I think the best way is a single file and a single button to run. I can just create a single text file and write code with vscode and press F5 to run when I'm learning C/Cpp/Java.

    • @ITksh-zp1ob
      @ITksh-zp1ob 3 місяці тому

      @@dragondove6197 so it is not needed in prod or for work purposes, does not solve business needs and have no business value. ok

    • @dragondove6197
      @dragondove6197 3 місяці тому

      @@ITksh-zp1ob yes, we are talking about beginners. For business eveyone uses build system. But for beginners, there is no java beginner's lesson started from maven, that will scare newbies

  • @danirm93
    @danirm93 4 місяці тому +11

    Multiple Java files with the java command is a great addition that will make running small prototype programs more convenient. Awesome! 🎉

  • @sillystuff6247
    @sillystuff6247 4 місяці тому +5

    this video's audio quality is surprisingly good,
    especially since it was made at a conference
    with many people nearby talking.
    good job !

  • @JosifovGjorgi
    @JosifovGjorgi 4 місяці тому +30

    It won't kill build tools
    However, it will make poorly structure legacy projects run better and it will make bad managers feel good about themselves about their decision that build tools are just waste of time.
    But those same legacy projects won't be affected until 2040, because they are still running Java 1.4.2 and the migration to Java 1.5 is still scheduled in 2025

    • @sayanbiswas8847
      @sayanbiswas8847 4 місяці тому +3

      This is some corporate MNC experience talking!

    • @nipafx
      @nipafx 4 місяці тому +5

      Man, that's bleak. 😳 But even in that world, it's probably a good thing that the poor people who have to maintain those no-build-tool projects will have another option to run them - even if only by 2040.

    • @pipzgutz
      @pipzgutz 4 місяці тому +1

      Can't wait for them to migrate to Java 8 by late 2030. 😂

    • @bororobo3805
      @bororobo3805 4 місяці тому

      Build tools are just a waste of time

    • @zoladkow
      @zoladkow 4 місяці тому

      ​@@bororobo3805ahhh, yes - the good old days when you had to code it all in machine code starting with BIOS 😁

  • @TheLegendher0
    @TheLegendher0 4 місяці тому +3

    I spent the worst 3 weeks of my life understanding maven in my first job because it was an integral part of the introduction materials they provided, this was the answer. This is what someone learning Java needs in order to have a better learning experience. Thanks

  • @IfeSunmola
    @IfeSunmola 4 місяці тому +13

    This definately reduces the reliance on maven/gradle and forcing the programmer into a com.example. folder structure for a project that won't be published anywhere. It will go well with Makefiles

  • @onebeartoe
    @onebeartoe 4 місяці тому +1

    Great work! I remember writing scripts early on with the -cp option.

  • @yatsuk
    @yatsuk 4 місяці тому +8

    I was surprised by how quickly it executed a Java command.

    • @lufenmartofilia5804
      @lufenmartofilia5804 4 місяці тому +1

      Then you haven't tried graalvm binary format yet

    • @yatsuk
      @yatsuk 4 місяці тому

      @@lufenmartofilia5804 I tried and "Hello world" compilation takes few minutes on my PC and required 8+ Gb of RAM

    • @zoladkow
      @zoladkow 4 місяці тому

      @@lufenmartofilia5804 yeah, while you're perfectly right about the speed, but the case here is you can run straight from source, without the extra compilation step, and that's the main benefit here. Speed is just added bonus.
      Granted it would be fun to also have the option to do "native-image hello.java" :)

  • @NachTheRz
    @NachTheRz 4 місяці тому +2

    I dont know If somebody brought this up, but this ist huge when it comes to serverless/cloud computing. I think this is a smart move for java to stay relevant.

  • @vatterger
    @vatterger 4 місяці тому +1

    This is a good change, but the reason i use gradle (and before that maven) is mainly to automatically fetch and install dependencies in a reproducible manner, and to automate the jlink and jpackage setup for exporting application packages. Building a native installer for a java applications feels more cumbersome than it should be right now.

  • @Ozzy34405
    @Ozzy34405 4 місяці тому +3

    java becoming new starter friendly 😄 this was unexpected, after all years

  • @ane18s
    @ane18s 4 місяці тому +6

    Maybe in the future and with a few modifications, Java could be used as a scripting language in Linux.

  • @davidgrajalesmirage
    @davidgrajalesmirage 4 місяці тому +1

    This is actuslly a grat festure that will help a lot beginners and students with all the extra configuration introduced by tool chains

  • @ozgurugur5196
    @ozgurugur5196 4 місяці тому +1

    The problem maven(or gradle) solves is not using that jar in that folder on runtime, it is to put the right jar required to that folder on build time to run your program on runtime. if you want to be the one who put that required jar to the correct folder then turn back and use Ant.

  • @lodgin
    @lodgin 4 місяці тому +1

    This is a fantastic change and a first step in being able to build Java _with Java,_ instead of with XML/Groovy/Kotlin (ie, completely different languages)

  • @funprog
    @funprog 3 місяці тому

    Finally java arrived to 2024 modern software development. Really nice feature for prototyping and exploring

  • @hariseldon02
    @hariseldon02 4 місяці тому +1

    A build tool right in the JDK would be cool though, like Go and Rust do. Having something like "[tool] package" download dependencies, compile a modular project, and build a jlink image containing only the modules I actually reference.

    • @nipafx
      @nipafx 4 місяці тому +4

      I agree, at least for a simple tool. I don't think it needs to be feature complete but a way to at least get dependencies and build artifacts would be really nice. I think a good line to draw is their publication - that and everything related to it could be left to Maven and Gradle.

    • @avalagum7957
      @avalagum7957 4 місяці тому

      I agree. Installing rust gives you a lot of things (a build tool, a code formatter, the Rust Book, the API documentation) enough to play with on an air plane without Internet.

  • @juancarlospizarromendez3954
    @juancarlospizarromendez3954 4 місяці тому +2

    No, this does not kill build tools. The build tools are very complex that manage dependences from many versions of jars, modules, etc. Let call it "dependences managers" to have working lightweight applications, frameworks or libraries instead of giant bundles.

  • @devtoro5601
    @devtoro5601 4 місяці тому +1

    very useful!

  • @Cyber_Lanka
    @Cyber_Lanka 3 місяці тому

    Dear God thank you. I remember java 8 classpath horrors still to this day

  • @dansshade5621
    @dansshade5621 3 місяці тому

    Cool! What next, proper REPL? 😊

  • @Growlizing
    @Growlizing 3 місяці тому

    This is extremely nice for beginners in Java. I love this change. But having compile errors show up even after program has started executing main is controversial to say the least.

  • @anirudhachari6801
    @anirudhachari6801 4 місяці тому +5

    Why did java not have these basic features in the first place? It always takes me 10+ tries to figure out how to compile a simple java project (every time I try to do it without an IDE)and another 10 to run it.

    • @nipafx
      @nipafx 4 місяці тому +8

      Would definitely have been nice to have this from day 1. But the same is true for enums, generics, lambdas, modules, virtual threads, etc. Can't have everything on day 1, though, and better late than never.

  • @duckydude20
    @duckydude20 4 місяці тому +3

    wow. i was actually looking for something like this. i need to test my gradle plugin. i don't want to write in shell or bat. so went for single source java. but now its getting complicated. this is huge thing.
    rn, i am planning to create e2e gradle sourceset and it calls gradlew again...

    • @zoladkow
      @zoladkow 4 місяці тому

      If you're already working with Gradle, you could leverage Groovy which is great for precisely things like that.

  • @michaelsimons2560
    @michaelsimons2560 4 місяці тому

    Haha, Nicolas you're killing it definitely in this one, with the clown shell and the music… Well done.

    • @nipafx
      @nipafx 4 місяці тому

      Glad you liked it! My desktop PC has the matching 🎪-shell. 😁

  • @RaushanKumar-dx7ns
    @RaushanKumar-dx7ns Місяць тому

    I feel java have solution of every problem thank you

  • @avalagum7957
    @avalagum7957 4 місяці тому +1

    Ah, then maven, gradle are not just a build tool, they are dependency managing tools also. So, I guess they are still needed for a very long time.

  • @jmrah
    @jmrah 3 місяці тому

    This is neat, but why does this toll the bell for Maven and Gradle?

  • @hunter_gatherer9184
    @hunter_gatherer9184 4 місяці тому +2

    This is a good news

  • @Bas_Code
    @Bas_Code 3 місяці тому

    I keep asking my self, where's his coffee mug....
    What a great explanation, java keep better and better every single day and beating other languages. My passion for java, only heaven can separate us.....

  • @Rogueixpresents
    @Rogueixpresents 3 місяці тому

    Huge!

  • @tahirhussain8812
    @tahirhussain8812 Місяць тому

    Which ide and icon theme he is using

  • @akam9919
    @akam9919 2 місяці тому

    Lightmode? I am appauled!

  • @orange-vlcybpd2
    @orange-vlcybpd2 4 місяці тому

    Will it also solve the problem of maven clean install not cleaning the target folder?

    • @zoladkow
      @zoladkow 4 місяці тому +2

      If you want to clean after install then you should use "mvn install clean" instead. Maven executes phases in requested order. Aaand you can even do "mvn clean install clean" to be extra clean ;)

  • @GordonChil
    @GordonChil 4 місяці тому +2

    What about a shebang line? Can it do that?

    • @nipafx
      @nipafx 4 місяці тому +2

      That works with a single source file since Java 11 (nipafx.dev/scripting-java-shebang/) but not with multiple source files. I think that makes sense because a project with multiple files isn't really a script.

  • @mirkocaserta
    @mirkocaserta 4 місяці тому

    This is awesome, especially for scripting.

  • @veselinmarkov
    @veselinmarkov 4 місяці тому

    I like your nails matching your t-shirt :)

  • @farooqmss
    @farooqmss 4 місяці тому +1

    I see no Ant and SBT in the thumbnail :(

    • @delabassee
      @delabassee 4 місяці тому +1

      It's already too busy, sorry. 🤷

    • @farooqmss
      @farooqmss 4 місяці тому

      @@delabassee ☹️

  • @ketanparmar
    @ketanparmar 4 місяці тому +2

    With this features. Java 22 programm can be work like Nodejs.. where nodejs put packages in node_modules. 😄

  • @static-m-s
    @static-m-s 4 місяці тому

    I didn't heared a word after 4:11

    • @nipafx
      @nipafx 4 місяці тому +2

      Was it the game or the food? 😅

    • @static-m-s
      @static-m-s 4 місяці тому +1

      @@nipafx the food looks amazing :)

    • @nipafx
      @nipafx 4 місяці тому +1

      @@static-m-s It tasted great, too. 😁

  • @malexejev
    @malexejev 4 місяці тому

    not bad. but adoption rate for newer Javas is still horrible, and younger devs generation is not picking it up. worth trying J22 vs Python hackathons to reach that audience with such new features

  • @Speiger
    @Speiger 4 місяці тому

    Just want to point out this comment: "That you can run into compile errors during runtime, which we might not be used to"
    Eh for every intellij user out there.
    Eclipse is capable to run programs with compiler errors and as long as you don't run into the compiler error line (not function but actual line) you are totally fine.
    And every eclipse user has the ability to fuck over any Intellij user. We are just nice enough to not do that. XD

  • @gugolinyo
    @gugolinyo 4 місяці тому +1

    No.

  • @goaserer
    @goaserer 4 місяці тому +1

    what a ridiculous click-baity question to ask 😛

    • @nipafx
      @nipafx 4 місяці тому

      💯

  • @wowooo7843
    @wowooo7843 4 місяці тому

    Why does he look like Danilo Gallinari?

    • @nipafx
      @nipafx 4 місяці тому

      You should ask Danilo, he came half a decade later!

  • @larryd9577
    @larryd9577 4 місяці тому +2

    Gradle can die any day.

  • @zoladkow
    @zoladkow 4 місяці тому +1

    yeah, good luck downloading the dependency tree one by one.
    TBF i'm not adreassing the feature, which is cool and long overdue - it's the obvious clickbaity claim in the title that i'm after. Why the F can't Java ecosystem just stay mature and serious 🤦

    • @nipafx
      @nipafx 4 місяці тому +8

      Because the playful clickbait means that twice as many people get to watch the video and hear the news. I think that's worth the 80 seconds suspense it took to resolve the tension.

    • @zoladkow
      @zoladkow 4 місяці тому +1

      ​@@nipafxeh, yeah i get it... it just makes me sad to see such tactics used in this area, that's all

    • @nipafx
      @nipafx 4 місяці тому +1

      @@zoladkow May I ask where on UA-cam you saw the video when you clicked to watch it?

    • @zoladkow
      @zoladkow 4 місяці тому

      ​@@nipafxyeah, no problem, sorry it took so long tho' - it's in my subscription feed. And, otherwise, while i get usual suggestions for Java topics in general (ie. Spring, Graal, etc) I don't get them for this Java channel. But luckily my subscriptions are manageable enough, so I don't miss anything even with a few days of break.

    • @zoladkow
      @zoladkow 4 місяці тому +1

      Also, Nic, my soft skills are terrible, but I realize how I may come across in my comments - just wanted to say I don't have anything against you personally. I see what you are doing and I get why you are doing it and I think it's on the right level. And I know i am not the target audience.
      My issue is (beside myself, duh!) that this channel mixes different topics and delivery styles. I worked with Java since, oh a few years, and I feel attached. While it might be unfounded i expect some seriousness from the source of it. I prefer concise and to-the-point information delivery. I can be psyched about new great stuff on my own without a show or hype - i think i'm good with just plain text. But talks with some deeper insight from architects behind it all is what I especially like.

  • @jwenting
    @jwenting 4 місяці тому

    so Java is turned into an interpreted language, which the detractors have for 25 years claimed it is as an argument for how slow and bad Java is.

    • @nipafx
      @nipafx 4 місяці тому +13

      Java has always been a (partially) interpreted language: All code that the JIT didn't yet get its hands on runs in a bytecode interpreter. This addition doesn't change that - the JVM still interprets bytecode before JIT kicks in. All that changes is that you don't need to explicitly create that bytecode with javac anymore. Instead, the Java launcher will compile in memory.

  • @RichardLucas
    @RichardLucas 3 місяці тому

    I love how he's sporting a "punky, free-thinker hairdo" whilst shilling for Java. I guess it takes that, at least. Who uses Java, anyway? Law enforcement and intel agencies? Lol. Yeah, free spirit.

  • @FABGIO1
    @FABGIO1 4 місяці тому

    So, at the end of the day, under the hood which is the difference between javac helloworld.java - java helloworld and java helloworld.java?