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

Minecraft Client

So i am making a minecraft client in eclipse and im running into this problem when i run it: [18:43:28] [Client thread/INFO]: Setting user: Player296 [18:43:28] [Client thread/INFO]: (Session ID is token:0:Player296) [18:43:29] [Client Shutdown Thread/INFO]: Stopping server does anyone know how to fix it?...

JUnit succeeds when run as "debug as junit test" but fails as "debug as gradle test".

I'm doing a simple hibernate test and the code all works fine when run from Eclipse normally as well as when I create a junit to test it. But I'm now trying to run as ./gradlew test (from bash or within eclipse) and I'm having a problem with: em.persist(jazz); causing:...

how to stub the method which is being called inside the constructor?

for a class im testing, it has parameterized constructor and in that there is a method being called, i tried to stub using doReturn().when.class.function but it doesnt stub it, the function always gets ran. So to stub these kind of functions is there any other way

in java how to use Spy for a class with no no-arg constructor

when i use @Spy annotation i get this error,
org.mockito.exceptions.base.MockitoException: Unable to initialize @Spy annotated field 'videoTranscriptService'.
Please ensure that the type 'VideoTranscriptService' has a no-arg constructor.
org.mockito.exceptions.base.MockitoException: Unable to initialize @Spy annotated field 'videoTranscriptService'.
Please ensure that the type 'VideoTranscriptService' has a no-arg constructor.
...

How long should it take at minimum for a person to learn this much for incoming semester exams ?

Following are the list of topics: 1. First Programming steps with Karel(methods, loops, conditions and first software engineering principles) and Top-down approach 2. Graphics Programming, classes of ACM Library, how to use objects...

mvn dependency:tree skips an transitive dependency

I have a problem according to maven. I have a module A, B and C. For legal reasons I am not allowed to tell the real names. Module A has a dependency to module B, module B has a dependency to module C. They are configured this way in the poms correctly. For some reason, if I call dependency:tree to the modul A, the module B is listed but the module C is not listed. Module A,B and C are in scope compile. They are of packaging "jar". The local repository is fresh. The group-ids for all modules are "x". The version for all modules is "1". Maybe exclusions are made, but I do not know where....

Use Case Diagram Question:

1. A customer uses a drink in the following way: he puts a coin in the drink collector parts, he selects the drink, he collects the chosen drink from the drinks tray and excess change in the change trap. Who is the actor in the system? Is it the drink, the coin collector, the customer, the drinks bin or the coin trap? ...

how do i unit test singleton classes in java?

specifically using mockito and junit

unit4

does someone know how can I download and use unit4 (node) in vscode?

Guice with empty Module

I'm learning Guice and I have working code, but my Module (extending AbstractModule) is empty (because I'm injecting a class not an interface). I can see that there's no overload of Guice.createInjector() which takes no params. Is there some way of not needing a module in my scenario? Not sure if: 1) it's not a big deal; you might add bindings to it later 2) using Guice with an empty module is an anti-pattern - always use interfaces (but I don't think that's correct) 3) I'm missing something....

make github actions build artifact public

https://github.com/asdru22/Game2D/actions/runs/12453995171 i have a jar that is built that i can download. however, only i can download it. how can i change it so that anyone can download it?...

build javaFX jar from github via maven

maven.yml: ```yml This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven ...

How would I hide a specific Character in a ListArray

Basically, i'm making a simple terminal file editor, which has basic syntax highlighting. I'm facing an issue where the character used for the 'cursor' (which is controlled by arrow keys) is fucking up the syntax highlighting. I use 2 variables which store its location (currentLine, and currentColumn), so how would I hide it or something off the syntax highlighting function? Code: ```java...

Help with interfaces/ inheritance

Hello im building a game where I'll have a board and GamePiece's that will be placed on the board, I have tokens, these can be placed on the board after some validation and they can't be moved once placed for the rest of the game I have totems, these will be automatically be placed in the center at the start of the game and they can be moved afterwards ...

How to set UUID as a primary key, and make an entry?

```java @Table("restaurant_group") public class RestaurantGroup extends Base { @Id...

Pig Latin Project Java

Hi, I've been working on my piglatin project but there seems to be an error with one of the conditions. I'm a beginner coder so I'm not really sure where I went wrong. I have a PigLatin and PigLatinRunner classes, the runner calls a translate method in PigLatin. Along with my translate method, I have boolean methods that check for punctuation. However, my output has a problem with counting punctuation. For example in a word string of money!" it only counts the quote on the right, but disregards...
No description

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"...