r/javahelp • • Jun 20 '19

Why do I need to add --module-path %PATH_TO_FX% --add-modules=javafx.controls on a new computer for javafx to work and how can I fix it?

18 Upvotes

Sorry for the long title. I've moved to a new laptop and I guess I forgot how I set everything up on my old machine and now I'm using openjdk. The only way I can get my anything using javafx to work is by adding the options. How can I make that permanent instead of keeping a note somewhere to add them when I want to run the program.

Thanks and sorry if this is a stupid question.

Also:

java --version
openjdk 11.0.2 2019-01-15
OpenJDK Runtime Environment 18.9 (build 11.0.2+9)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.2+9, mixed mode)

r/javahelp • • Apr 26 '19

How important is UML to Java/other languages?

18 Upvotes

First year programming student at a local community college and in Programming 1 we're learning Java as our vehicle, and towards the end of the class they are really pushing UML diagrams. I honestly hate UML diagrams just because it's extra work that I feel isn't really necessary unless you're really needing to keep track of your public and private variables across a large project to ensure theres not interference.

Is UML actually an important thing I should pay more attention to or not really?


r/javahelp • • Apr 16 '19

Shoutout to Spring developers

18 Upvotes

You guys who understand and use Spring are gods.

This is the most advanced thing I’ve ever seen, all I get are problems and I haven’t a clue how any of it works and honestly at this point I want to go back to single class console based applications.

And I thought Swing was tricky at first.... HA!


r/javahelp • • Oct 15 '18

Getting back to programming, what's the best way to refresh your memory for Java?

18 Upvotes

Somewhere around March this year, I started learning Java (and programming in general) very intensely and almost every day for six months.

I'm glad to say that throughout all that time I've learned a lot, and I've created a lot of my own programs and even games (albeit very basic).

However, in September this year, I hit a small hiatus which made me ignore anything related to programming, until now. Now that I'm going back, I do feel a bit rusty and would like to know what might be the best way to refresh your memory of all the topics you've learned?

I'm already doing online quizzes and some simple exercises which I did before on codingbat, codeabbey...

Any suggestions?


r/javahelp • • Oct 09 '18

Best books for learning more advanced programming in Java 8?

18 Upvotes

Looking for some good books to study a bit. Thank you :D


r/javahelp • • Apr 26 '17

Opinion - I *want* to like Streams and lamdas, but mostly it just looks like walls-of-code

18 Upvotes

I wrote this function that roughly just combines force vectors applied to different boxes. What it does isn't so important, it's the fact I wrote it in a streams-style and then looked at it and thought - I can barely understand this and I wrote it... So I wrote it in the plain-java way and it looks to me a million times simpler.

I don't want to get into a "use what you think's best" type of debate, but I do want to think about is there ways to represent this problem using streams and lamdas that doesn't look obtuse

  Map<Box, Force> results =
        delegates.stream()
            .map( pressure -> pressure.calculate( c ) )
            .reduce(
                new HashMap<Box,Force>(),
                (acc, next)-> {
                    next.entrySet().forEach(entry -> {
                        ForceaccVector = acc.get(entry.getKey());
                        if (accVector == null) {
                            accVector = new Force();
                            acc.put(entry.getKey(), accVector);
                        }
                        accVector.x += entry.getValue().x;
                        accVector.y += entry.getValue().y;                            
                    });
                    return acc;
                }
            );
    return results;

Traditional version (seems simpler)

    Map<Box,Force> acc = new HashMap<Box,Force>();

    for( Pressure pressure : delegates ) {
        Map<Box,Vector> next = pressure.calculate( c );
        for( Map.Entry<Box,Force> entry : next.entrySet() ) {
            Force accVector = acc.get( entry.getKey() );
            if (accVector == null) {
                accVector = new Force();
                acc.put(entry.getKey(), accVector);
            }
            accVector.x += entry.getValue().x;
            accVector.y += entry.getValue().y;
        }
    }

I am totally aware that there are specific situations where lamdas are amazing and streams too, but I was kind of sad that it didn't give my code here such an advantage. Is there a better way to arrange this or is there some advantages I'm missing here ?

Edit: One big advantage is that you can fairly easily add in a "ParallelStream" into streams and it will use multiple cores to handle different sections. That is a big benefit over old-school foreach

Edit2: /u/rmslashusr has posted this very elegant solution, which is everything I hoped it would look like. https://www.reddit.com/r/javahelp/comments/67nsav/opinion_i_want_to_like_streams_and_lamdas_but/dgrx1ot/

    return delegates.stream()
                .flatMap( pressure -> pressure.calc(c).entrySet().stream() )
                .collect(
                        Collectors.toMap(
                                Map.Entry::getKey,
                                Map.Entry::getValue,
                                Force::add
                        )
                );

r/javahelp • • Jul 18 '26

Can anyone explain me difference between Encapsulation and Abstraction?

17 Upvotes

and what on earth is Interface in Java?


r/javahelp • • Mar 14 '26 Bravo

What is JVM

17 Upvotes

I tried googling about JVM and VM in general. But I cant wrap my head around what VM is and what JVM is. Can you explain what they are in simple terms, so I can get a general idea?


r/javahelp • • Feb 22 '25

What's the purpose of using DTO ?

17 Upvotes

Hello, I am a junior programmer and I have an interrogation about something.

If I understand correctly, DTO are used to store data that will not be persisted, data that are needed by services. But I don't understand why we don't pass theses datas via parameter, path variable or even body of HTTP Request.

For example : User need to change password (that is just for illustrating my post)

  1. Using DTO : UserService(UserDTO) :: Do what it needs and then map it into User before persists

  2. Using Request : UserService(User, newPassordFromHttpRequest) :: Do what it needs and persists the objet

Thanks in advance for helping junior programmer like myself


r/javahelp • • Feb 16 '25

What makes Spring Boot so special? (Beginner)

17 Upvotes

I have been getting into Java during my free time for like a month or two now and I really love it. I can say that I find it more enjoyable and fascinating than any language I have tried so far and every day I am learning something new. But one thing that I still haven't figured out properly is Spring

Wherever I go and whichever forum or conversation I stumble upon, I always hear about how big of a deal Spring Boot is and how much of a game changer it is. Even people from other languages (especially C#) praise it and claim it has no true counterparts.

What makes Spring Boot so special? I know this sounds like a super beginner question, but the reason I am asking this here is because I couldn't find any satisfactory answers from Google. What is it that Spring Boot can do that nothing else can? Could you guys maybe enlighten me and explain it in technical ways?


r/javahelp • • Feb 15 '25

Homework what is the point of wildcard <?> in java

17 Upvotes

so i have a test in advanced oop in java on monday and i know my generic programming but i have a question about the wildcard <?>. what is the point of using it?
excluding from the <? super blank> that call the parents but i think i'm missing the point elsewhere like T can do the same things no?

it declare a method that can work with several types so i'm confused


r/javahelp • • Jan 23 '25

Zero to hero?

17 Upvotes

Hey guys! I'm a cs student learning Java. I'm curious to know what you guys did to go from new to coding to a confident programmer?

I'm fast at some things now, but overall I'm quite slow in trying to grasp the syntax and how/when to use certain bits of code.


r/javahelp • • Apr 28 '24

Codeless What exactly is the use of getter and setters?

17 Upvotes

So I’m coding for a while now and this question came to my head. The access modifiers for getter and setters are public so I think it’s kind of useless? Like it’s the same as not having them? I’ve been using them for a while now but can’t really determine what really is the use of it. As of now, I think it’s unnecessary encapsulation or coding?


r/javahelp • • Mar 23 '23

Codeless Out of Depth at work

17 Upvotes

Hello everyone,

I currently have 3.5 YOE working with Java and Spring Boot.

Not gonna lie, I was never confident with my skills, most of the time just Java 1.8 with some crud operations, microservices, Kafka and DDD. But I spent hours everyday sharpening my interviewing skills and I am already in my 3rd job with double the income from the first one.

I've got a new job and the code base is...insane. The code is brilliant, everything is amazing and I feel completely out of depth.

I feel like I missed the "tutorials" for implementing complex communications with external SDKs with insane concurrency implementations. Search functionalities that are utilizing in an extreme way BiFunction with Enum and Generics out of of this world. Code that in order to work it needs multiple classes and test cases.

The people that implemented those brilliant codebases are similar to my age and YOE. I feel like I skipped something, there is no way I could come up with that without extensive collaboration and assistance.

I feel like that using Java and Spring as my first job and then just doing that hurt me in the long run. I never faced complicated or demanding concurrency issues.

Not sure what to do, I am reading programming books, blogs, videos, courses etc. But I am sure I would never come with that level of code at my work.


r/javahelp • • Sep 19 '22

Constructor vs initialising manually

17 Upvotes

Sometimes I’m confused why we need constructor if we can initialise objects manually:

Example:

Person p1 = new Person(); //so we have default constructor
p1.name = “Alex”;

or if name is private just we can use get method

Why we actually need a constructor? I read a comment somewhere and they told like it’s wrong to initialise fields manually so always use a constructor, but why?

Like we use constructor to initialise fields of objects or it has some more functionalities?

I’m confused.


r/javahelp • • Sep 13 '22

Codeless Do I need to know HTML,CSS and Javascript to make springboot projects.

17 Upvotes

I am interested in becoming a backend developer and was wondering how much if any html, css and JavaScript I need to know in order to make projects?


r/javahelp • • Aug 09 '22

what does for(;;) mean?

17 Upvotes

Just like the title asks, what does for(;;) mean? A double semicolon in a for loop, I found it in some code I'm trying to understand and Google can't seem to answer my question. Thanks!


r/javahelp • • Jul 16 '22

what should an intermediate java developer be able to do ?

17 Upvotes

I've been learning java for about a year but still wondering to figure out my level

I think am intermediate as long as I can do oop things

could anyone help me with what should a java developer be able to do at a certain level like beginner intermediate and advanced


r/javahelp • • Jun 12 '22

Homework Casting from int to Integer.

17 Upvotes

So i've been fiddling around with java, and encountered a problem, that I don't quite understand.

int a = 10;
Integer bigA = a;
Integer bigB = a;
System.out.println(bigA == bigB);

This piece of code returns true, for every int below and including 127. Above that it returns false. How so?


r/javahelp • • May 18 '22

Codeless Advice for a programmer with ADHD?

17 Upvotes

hey there! i’m currently a senior in high school, planning to major in computer science. i took AP computer science A this past year and failed horrifically. java is very difficult for me to understand, and it’s difficult to pinpoint an exact reason why. i know that i have a hard time understanding the syntax of java and memorizing what different things do, and my teacher was unfortunately very unhelpful. i was wondering if anyone had any suggestions on how to learn java in addition to other languages with ADHD.


r/javahelp • • Apr 18 '22

I am tasked with updating a Java Project from Java 8 to (Current) Java 18, how should I approach this?

17 Upvotes

So I don't really know where to get started with a problem like this. I have a pretty big Java application that is filled with files doing most of there stuff through Java Swing and .form files and has an executable jar file for the application. Any insight to anything like this?


r/javahelp • • Dec 08 '21

How come we don't use the new keyword to instantiate a String in Java?

17 Upvotes

My understanding was that we instantiate everything with the new keyword in Java that is not a primitive type and String is not a primitive type.


r/javahelp • • Sep 29 '21

I need to hire a Java developer but I know next to nothing about the language

17 Upvotes

I'm not sure if this is the correct subreddit to ask this, but as the title says, I need to hire a Java developer. The issue is that I know next to nothing about Java. I was hoping you guys can help me figure out some questions (and answers) that I can ask during the interview process to help me assess who actually knows the language, so I do not get mislead.


r/javahelp • • Jul 08 '21

Node dev wants to understand spring

17 Upvotes

I've been building APIs for a while now and I would consider myself pretty component in Node.js and Express. As a result I know a lot about the Node.js ecosystem (tools, packages, yada yada). I want to transition into Spring Boot and carry over as much of my Node.js knowledge as possible. I've done some research, but the whole Java world is very foreign to me. Can anyone recommend resources that explain Spring concepts while giving examples in Node.js. Asking for a friend.