Java Community | Help. Code. Learn.

JCH

Java Community | Help. Code. Learn.

We are a Community full of Java developers. Connect with other devs, get help, help others and do much more!

Join

java-help

❓︱qotw-answers

Modular Spring app can't find persistence provider

Hi, I'm trying to run my JPMS app through the command line instead of IntelliJ. I set up maven to copy all dependencies to a specified folder, so that they can be added to the module path. I use the following command to start the app: ``` java --module-path "infodb-app-1.0-SNAPSHOT.jar;modules" --add-reads ovh.eukon05.infodb.app=ALL-UNNAMED -m ovh.eukon05.infodb.app/ovh.eukon05.infodb.app.Main -Dinfodb.sources.articlelimit=5 -Dinfodb.hibernate.db.user=sa -Dinfodb.hibernate.db.pass= -Dinfodb.hibernate.db.url="jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1"...

Kotlin Branch Test coverage question

I have this line of code:
if (neighborhood.street.house?.family?.contains("Steve") == true) {
if (neighborhood.street.house?.family?.contains("Steve") == true) {
Test coverage is saying 1 out of 8 branches missed. But how in the world are there eight branches here??? IMO there are only 4 branches:...

Sequence allocation size question

Hi, I have a question on what my allocation size should be for my call to batch insert records into a table. I'm using sequence generator and I have a batch process that has to insert or update 50,000 records. I'm noticing the performance for this process isn't great and I read online I might need to adjust allocation size (currently have it as 1). So if I'm batch inserting in batches of 500 records, does that mean my allocation size should be 500?

I'm trying to get back to Java

Hello, I've been studying Java for a prolonged period of time, however, due to personal reasons & issues, I had to stop for a period of 5 months. Right now, my memory is really vague regarding several topics, what would you suggest to do? Is it better to start from the basics and build up again, or just hop into it & re-learn on the way?...

Help on an old Notch game (Herp Fortress)

Hello! Around a decade ago, Markus Persson (Notch), the creator of Minecraft, began working on a demake of Team Fortress 2 called Herp Fortress. He developed it as a personal Java project and even live-streamed the process on his Twitch account. The streams were later archived. After a few months, Notch canceled the project but shared the source code on Twitter....
No description

run in docker container error

I can run my project localhost without any issues, but it compile error when I run it in a Docker container. Could someone help me figure out why this might be happening
No description

Looking for assistance getting a string to display on the frontend in an Angular project

Hello, I've been working on a project for my course and I've spent a ridiculously long time trying to get this string to display. I'm honestly confused because I have a string array that displays just fine. Basically, I'm trying to get a handful of time zones to go from my controller, to app.component.ts, to app.component.html. I'll include the relevant code below. Any assistance you can provide would be great, as I'm not sure if this is too far outside the realm of Java for the server. And please don't worry about immediate urgency, I won't be able to check this post for a few hours, though I may have a couple of follow-up questions. timeConv.java (Excluding imports) ```java @RestController...
No description

java calendar

the first week displays weirdly. pls help: ```java package lab4; import java.util.Scanner; import java.time.Month;...

java.util.LocalDate cannot be resolved

why is this giving me an error. pls help ```java package lab4; import java.util.LocalDate;...

In Project Annotation Proccessor

very short: Some classes are required by my annotation proccessor which when run first compiles the whole project to run which fails because of the classes that its generating missing in some other classes because they are loaded at the same time causing a chikcen egg problem. Running in different sub projects causes either a dependency loop or missing dependencies for some classes with dependencies. full explenation: I recently stumbled across annotation Proccessing and wrote one that works for my purposes as long as its in a different gradle project. However If I want to add something that utilises Classes from my main Code I need to change the location to that other class including that classes dependencies which is quite annoying. However I cant put it in the same project since parts of my code are generated using that annotation Proccessor. That means that the compilation which is needed before the processing fails since the imports to those auto generated classes fail since they are deleted on regeneration. meaning a chicken and egg problem. However the classes that use that generated code are not required by my processor. Meaning I basically would have to only compile the annotation processor first and then the classes as it needs them. After that the rest can be compiled. Question is how could I do that? any other way is also fine by me....

Netbeans not creating a actionperformed section for a certain button?

so, im trying to make a gui trivia application in java and netbeans isn't creating a actionperformed section for my submit button like it did for other buttons, I tried creating it manually biut it did not work, what do I do?

Netty server and javafx services

Hi my server seems to stop without me telling it to 😦 The object of the Server class isn't getting garbage collected but it's channel does get magically stopped...

Unallocating direct buffer

I have a direct buffer that I eventually no longer need and set to null. This however does not free up the memory usage until I perform GC manually. Is there a way to forcefully free that memory automatically when im setting the buffer to null?...
No description

Help what am I missing?

So this is just something I've been doing for boredom and this is the small part of the code, but essentially I'm using MouseMaker for this frog math game ;-; and it's not running and maybe I'm a lil dumb? Is this not right sobbing
No description

got 403 forbidden, can't pass the SecurityFilterChain

So, I am try to hardcoded information on UserDetails to get know how it will pass the authentication by validating if it has "USER" role. but when I try to make request to it I got 403 forbidden.
No description

Spring Boot with Kubernetes Issue

Here is the link : https://github.com/Rapter1990/todowithcouchbase/pull/28 todowithcouchbase -> container "todowithcouchbase" in pod "todowithcouchbase-6c49dcd7f7-jjf2x" is waiting to start: trying and failing to pull image (Here is the image location : https://hub.docker.com/repository/docker/noyandocker/todowithcouchbase/general) Can you help me for my Kubernetes issue ?...
No description

Making an object that can be various types?

I have a byte[] and a short[] used for the same thing. I want to switch from using the byte[] and short[] based on the maximum value needed, which changes occasionally. My idea is to have an Object that is swapped between referencing the byte[] or the short[] as needed. The part I can't figure out is casting the Object to the array type its referencing. I tried this to alter the contents of the array the object is referencing: ```java...