Inspired by a recent 916 post

  • cub Gucci@lemmy.today
    link
    fedilink
    arrow-up
    19
    arrow-down
    6
    ·
    10 hours ago

    Java is neat: you just get what you write. There are things that really makes you cry and Java is not among them

    • Alk@sh.itjust.works
      link
      fedilink
      arrow-up
      11
      ·
      7 hours ago

      It makes me cry when modded minecraft uses 100% of my CPU and eats up 20gb of ram. (This is only a little bit java’s fault)

      • cub Gucci@lemmy.today
        link
        fedilink
        arrow-up
        8
        ·
        6 hours ago
        1. Java should not be used for game engine design. Stop-the-world events and poor shaders support do not help.

        2. JVM eats as much memory as you give it, so try playing with -Xmx param

        • pet the cat, walk the dog@lemmy.world
          link
          fedilink
          arrow-up
          3
          ·
          edit-2
          44 minutes ago

          Java has been used by programmers of mobile games just fine, for ages. The trick is the same that one would need with any other environment: knowing what objects you’ll need to allocate for a level, and not allocate more than that.

        • Alk@sh.itjust.works
          link
          fedilink
          arrow-up
          2
          ·
          6 hours ago

          Oh yeah I know all about that, I’m talking about what it actually uses within the JVM 😅 It’s a messy monster of a game once modded, and there’s really nothing you can do about it other than some slight optimizations here and there.

    • Valmond@lemmy.dbzer0.com
      link
      fedilink
      arrow-up
      16
      arrow-down
      1
      ·
      9 hours ago

      Just make the 200 line boiler code setup to make some

      system.stuff.thingy.log.println(“hello world”);

      Then it’s not compatible with the installed vm.

      • cub Gucci@lemmy.today
        link
        fedilink
        arrow-up
        11
        ·
        8 hours ago

        Then it’s not compatible with the installed vm.

        This almost never happens, unless you do very niche things or have unrealistic expectations from your file system.

        Niche things include using obsolete cyphers for net communication or running java code on the ibm mainframe, not something you do day to day.

      • loutr@sh.itjust.works
        link
        fedilink
        English
        arrow-up
        5
        ·
        8 hours ago

        Java has changed a lot since Java 8. Here’s a 3-line HelloWorld.java compatible with Java 21+:

        void main() {
            System.out.println("Hello, World!");
        }