r/javahelp • • Feb 10 '21

Do you recommend courses for learning Enterprise Java Development?

20 Upvotes

I started a new job recently as an IT Developer. I am looking into courses I could take on the side to help me strengthen my experience and knowledge. I would love to take a course that explains Java beans, Java JSP, Java Serverlet, spring book and all that.

Do you have any recommendations?


r/javahelp • • Dec 31 '20

Solved Performance cost of calling Python program from Java program

20 Upvotes

Not sure if this is the right place to post this but I want to call my python program from my Java program. Does anyone know the performance cost for repeatedly calling the python program through shell commands using Runtime.exec()?

There's a library that only has Python support so I was thinking of just creating a python program utilizing that library and then use my java program to call it to get the output.

Edit: thanks to everyone who reponded! Helped me a lot


r/javahelp • • Dec 29 '20

What is the best way to distribute and update Java client applications?

20 Upvotes

I am currently developing a JavaFX application with an built-in update functionality, which I want to distribute to end users. For that I make use of jlink/jpackage and some self-written updater that downloads new versions from github releases automatically.

While creating this I always wondered how other people handle this task. It seems simple, but there are many steps during an update that can fail and taking care of all of them is pretty complicated.

Are there any libraries/frameworks or established workflows that you can recommend and already have experience with?


r/javahelp • • Nov 21 '20

Codeless Static variables and why do we need them?

20 Upvotes

Hello, I'm just curious about static variables. When do we use them? What is the difference between a static variable and a variable?


r/javahelp • • Sep 29 '20

Hey everyone we're using microservices for our upcoming project and I have a question about authentication

20 Upvotes

We use Spring Boot as our framework.
And I have a question that I'm unfamiliar with
---

Let's say user (x) wants to perform the following actions in our media service:
- Upload
- Download
- Delete file
---

Now we already have an authentication service that accepts Bearer token and return account info for the specific service.
But I feel it's bad code practice to copy-paste let's say the auth class and inject it then preform the authentication on the (Bearer token) for each method in our service,
---

So does anyone have any suggestions?
Maybe using AOP for each service to get that token and authenticate the user each time the user requested the service?

So basically the code works for now but I feel it's a really bad practice.


r/javahelp • • Sep 03 '20

Any simple github projects that combine Spring Webflux for Java's backend, and HTML + JS for frontend?

20 Upvotes

Hi, I found something a while ago that did this: https://spring.io/blog/2013/12/19/serving-static-web-content-with-spring-boot

https://github.com/ericbv/staticContentWithSpringBoot/tree/master/src/main/resources.

Problem that I couldn't understand with it was that inside of the controller, it said:

@RequestMapping("/offerView")
public String page(){
    return "html/offer";
}

I couldn't make sense of this path "html/offer", and I'd tried to replicate this relatively simple concept and put it into a WebFlux app, but I couldn't get the thing to work. I'm still searching, but looking for some sort of github project, or example for how to do this linkage, and coming up short. Anyone got any ideas? Thanks


r/javahelp • • Jul 21 '20

Are there meaningful differences between Java observers, listeners and events?

20 Upvotes

I'm studying design patterns (self taught using "head first design patterns" book) and recently got into Observer patterns... The book says some things about Java out-of-the-box Observer/Observable, but it's not fully clear about what i am asking for... Maybe is a stupid question, but i want to dive deeper into this. Thanks.


r/javahelp • • Jul 08 '20

Best practices for returning JSON from a Spring Boot API?

20 Upvotes

I have created a Spring Boot API with some specific business requirements. For most of my controller methods, I am just returning an object that is being serialized into json (correct me if I am using the wrong terminology).

For example, lets say I have an object Dog with fields name and age. Most of my controller methods will just return a json such as: { “Name”: “Fido”, “Age”: “5” }

However, as a business requirement, sometimes I just need to return an Age value, or even a list of ages such as:

{ “Age”: “5 }

Or

{ “List”: [“5”, “3”, “8”] }

Most of my controller methods have the return type ResponseEntity<Dog>

But what should I do about the 2 situations above ( or similar situations)?

For now, I am just using a BSON document. The return type is ResponseEntity<Document>. In the controller method, I would do something similar to

public ResponseEntity<Document> getAge() { String age = dogService.getDogAge(); Document doc = new Document(); doc.put(“Age”, age); return ResponseEntity.status().body(doc); }

Is there a better way to do this?


r/javahelp • • May 30 '20

Dijkstra's program in Java

20 Upvotes

Hi, I need to implement Dijkstra's program, I have already done the calculating part, but the problem is that I can't get there right path when I gave the start and finish nodes. Please can you help me? It's homework that I have been working on for more than 3 weeks straight and I feel so close now to finish it.

https://pastebin.com/y3qvLHhV


r/javahelp • • Mar 25 '20

Advice for a java high performance project

20 Upvotes

Hi everyone, I'm looking for some tips on designing a performance constrainted system. It should handle 1k+ request per second and have response time under half second. The specification explicitely says it should be spring based and will listen on an existing kafka stream. I thought of using a webflux listener and pair it with a reactive mongo persistence layer, since it has to keep track of aggregated counters such as message per hour and so on. One thing I'm doubtful is, will concurrent updates be an issue with reactive mongo driver? What else can be done aside from boosting cpu and ram to improve performance on such a component? I've been developing for quite some years but a performance constrainted project is a first timer for me. Any help is appreciated, cheers!


r/javahelp • • Mar 18 '20

Is there a performance cost when using Arrays.asList().contains() within a loop?

20 Upvotes

I'm reviewing some code a junior guy on my team and he has written the following logic:

for(final Object data : list)
{
	if(Arrays.asList(properties.getExtendedSlots()).contains(data.getId()))
	{
		...more logic
	}    
        else 
        {
            .....
        }
}

At first look I thought it made more sense to create a list variable before the loop and call contains on that, instead of using Arrays.asList() each iteration. Like so:

List<Object> extendedSlotsList = Arrays.asList(properties.getExtendedSlots());
for(final Object data : list)
{
	if(extendedSlotsList.contains(data.getId()))
	{
		...more logice
	}
}

But I'm not actually sure if there actually is a performance trade-off to simply doing it the first way. In my head it seems costly, as it must be creating a new list every iteration before calling contains(), which seems unnecessary when you can just create it once. But perhaps I'm wrong?


r/javahelp • • Mar 16 '20

How Can I Run Java Without Internet Explorer?

20 Upvotes

I'm working from home due to COVID-19. My work computer has Internet Explorer but my home laptop is a Chromebook. I know Chrome OS does't support Java any longer. I've got pre-conditions that make me susceptible to COVID so I don't really want to drive into work and get a loaner. Is there any way to work around this? Google-fu fails me.

Thanks guys!


r/javahelp • • Mar 09 '20

Homework How to put a max character length on a string

20 Upvotes

Im doing a college assignment and cannot figure how to put a max character length of 40 on a String


r/javahelp • • Jan 29 '20

What's your preferred IDE/compiler

20 Upvotes

My professors in the past had recommended Eclipse for the class but now my prof this semester is saying IntelliJ is better to use. So I was wondering which you prefer to use for writing.


r/javahelp • • Dec 31 '19

Spent an hour on MOOC ex. 33 come to realize I was only missing an "=" sign

20 Upvotes

int sum = 0;

    while(low <= high){
         sum += low;
         low++;
         
   }

I spent an hour trying to figure out why my program would not give me the correct sum between two numbers ( 2 and 8 in this case).

After about 45 minutes I wrote down how the program went piece by piece. I know how loops work, but writing it down on paper was very difficult for me. Keeping track of the iterations these loops run through and the output was something I usually just did in my head.

Long story short, the sum was supposed to be 35 but kept coming up a few numbers short, cause I had the loop stop one iteration early without that "=" sign.

I had one question though. When loops run, is the first iteration listed as "1" or "0"? I was thinking about array indexes for some reason when I was trying to figure this problem out.


r/javahelp • • Sep 08 '19

NetBeans or Intellij IDEA

20 Upvotes

Which IDE is widely used among java developers?


r/javahelp • • Apr 03 '19

How do I structure a 2d Java game?

20 Upvotes

Is there a proper way to set up the classes, packages, and such, or does everyone figure it out on their own. I've created two small games before, but they seem to be completely different with number of classes being more on the more in-depth game. For example, in my first game, I had the player have an array of his inventory saved to a variable in the player class, but in my other game I had a class called inventory that was an object of the player. It just seems like there are so many different ways of doing things and at times I feel like I'm just throwing things together.

I've learned from my computer science class about interfaces and abstract classes, but I've never once felt the need to use them in my code. One game used just one package with all the classes in there and the other I tried splitting them up into logic, graphics, and internal packages and it worked out just as well albeit with a lot more confusion.

Today I ran into this problem. I have a main game class with the main loop calling an update and a render function that both call functions in other classes. Some of these need to only be called when the game is in a specific state. Should I make a new renderer class and just call that one objects function once and have it deal with deciding the game state or do I put the if else statement and all the functions in the main game class.

Honestly, I feel like I could write an entire simple game in a single class. Are there any resources out there that could help me get better at this?


r/javahelp • • Apr 12 '17

Solved What are the simplest design patterns for beginners to learn.

20 Upvotes

I have to write a paper on a design pattern, and I'm trying to find one that is easy to understand. Factory seems simple but I think several other people are doing it also.

Edit: Thanks everyone I went with the Strategy Pattern.


r/javahelp • • Feb 07 '17

What are some good web service tutorials out there?

20 Upvotes

I have been a Java developer for many years now, but I have never implemented a web service. I would like to pick up this skill, but would also like to bypass bad tutorials (e.g., poorly written, old, relies too heavily on external libraries, etc.). Can you recommend any good tutorials to get me up and running with REST and SOAP?

Thanks!

edit: In case somebody is looking at this at some point in the future, I found these two that aren't bad:

I am still looking for good ones, especially ones that don't require JAXWS or ones that aren't back by a database. If I find them, I'll post another update.


r/javahelp • • May 23 '16

Solved How to multiply an integer by two without using +, -, *, /

20 Upvotes

I know I must use bitwise operators but I have no clue how


r/javahelp • • Mar 05 '16

Wanting to learn Java for enterprise level application development.

20 Upvotes

Hey guys,

I've been involved in web development for many years. Mainly using PHP, Node, Python and frontend languages/technologies. One language I've constantly neglected is Java. It brings back pain from my University days.

I've heard all the hype, and how most large high traffic sites are using Java. Since I started learning Service Orientated Architecture I've been reading the benefits of Java. I'm slowly moving into enterprise level application design and it makes sense to move with the flow and start using Java. I'm no stranger to OOP, and use OOP and design patterns in most of my projects.

But, I don't know where to begin. I am basically approaching Java web development as a noob.

Where is the best place to start? What should I avoid? What would you recommend I learn to begin?

Thanks for any advice.


r/javahelp • • Jan 09 '14

Hey r/javahelp we've been putting together a buddy system over at r/programming buddies

20 Upvotes

and I wanted to invite anyone that wanted to find someone to learn with/from and teach to, to come on over and check it out. Theres a list of people and their relevant experience to peruse and a bunch of nice people looking for others who just want to learn. Seems to be quite a few people there who are into java. Hope to see some of you around :)


r/javahelp • • 7d ago

How do developers study Java src code ?

19 Upvotes

Hey everyone,

I’m currently learning Java to build projects and grind Data Structures & Algorithms (DSA), but I am hitting a massive wall with how the code is structured.

Today, I was trying to implement a simple ServerSocket. To understand what was happening, I instinctively Ctrl+Clicked on it. The IDE immediately unzipped the internal source code and dragged me down a never-ending rabbit hole: from ServerSocket, to SocketImpl, all the way into NioSocketImpl and hidden factory classes.

It throws hundreds of lines of complex internal implementation code at me. It is incredibly time-consuming, frustrating, and completely breaks my momentum. I feel like I'm getting sucked into a black hole of code that I didn't even write, and if I keep this up, I am going to get stuck and fail to actually build anything.

I need a serious reality check and some practical advice:

  1. How do developers actually read and reason about Java without constantly opening up the internal source files?

  2. What is the fastest, cleanest way to look up how to use a class/method without getting bogged down by its underlying implementation code?

  3. How do I force myself to treat things like ServerSocket as "black boxes" so I can just focus on building my app and solving DSA patterns?

Any strategies to help me break this habit and speed up my learning would be deeply appreciated. Thank you!


r/javahelp • • 21d ago

Workaround Learn Java in 2026

19 Upvotes

Hey I am a computer science graduate.... From a tier 3 college (2023 graduate) I have learnt core java but I don't know how to proceed ahead? What should be my next step.... I am working in Non it from past 2 years.... I do learn algos and stuff... I understand and write basic code... I am admiring to be a good software engineer.... It love building apps..... I do not have much knowledge on React/Angular Java is my thing. I want to learn and switch my domain..... Please give me a roadmap or career suggestions and from where I can learn...... I have studied Head First java and learnt whatever knowledge I have now...... I know this is not enough.... !! Also suggest what technology should i master along with Java.... so that I can get a good job..... ! Any input will be helpful... Thanks