Java Community | Help. Code. Learn.

JCH

Java Community | Help. Code. Learn.

With more than 20,000 members, join one of the biggest and most active Java Communities on Discord! ☕

Join

java-help

❓︱qotw-answers

Help regarding auto seeding of db tables from the auto generated schema

Have a spring boot application where i am using Spring Data JPA and creating the db schema automatically using the ORM. Now my requirement is to automatically run the schema .sql file to create tables and relationships when building and deploying the project the project . Need some help. ...

help making a level editor

hi, I am primarily a Minecraft mod/modpack developer and when I found out how easy it is to make custom levels for the game tasty planet I wanted to make a level editor for it so turned to java as it's what I have the most experience with but I'm getting to the edge of my knowledge and AI isn't being very helpful. basically what I need is help adding a few features I can't (even just placeholder stuff I can use to actually do what I want as I know it's hard to write code to interact with files you don't actually have) so the main thing is I want to add some images to the program but can't seem to figure that out. https://github.com/RemagOfficial/Tasty-Planet-1-Level-Editor here's the GitHub and please don't roast my bad code too hard lol...

Module not found when running tests in Maven

Hi, I'm trying to create a modular application for fetching articles from popular news sources in Poland. A part of the app is a module saving these articles into a database using Hibernate. I wrote a couple of tests for this module and when I run them through intellij they work just fine, but when I try to use Maven it throws errors like these:
[ERROR] Error occurred during initialization of boot layer
[ERROR] java.lang.module.FindException: Module jakarta.cdi not found, required by jakarta.transaction
[ERROR] Error occurred during initialization of boot layer
[ERROR] java.lang.module.FindException: Module jakarta.cdi not found, required by jakarta.transaction
...

isInteger will not seem to work

I am making a work oganization app and focusing on a method that checks if you wrote the date incorrectly and will prompt you to rewrite it if you did. This is in the unacceptabledate method in the file. First I need to make sure that integers are being written in the date. I cant seem to use isInteger though. I tried toString and Integer.parsrInt and tried using isInteger after but nothing has worked. Please help

Deploying Spring Boot application with Stomp over WSS using nginx

Does anyone have experience with Secure Websockets (WSS) over Nginx? I currently have this nginx config file, but the websockets stopped working once I switched from unsecure http:// and ws:// to https:// and wss:// (the https:// traffic and the rest of the application works fine though, just the websocket connection fails to establish) ``` server { server_name 132.231.1.166; server_name sojourner-under-sabotage.se2.fim.uni-passau.de;...

Enums, mutable fields

Look at second message class myClass{ public static void main(String[] args) { // Test the EngineType enum functionality...

how do do this

im trying to connect my kinect im using https://github.com/OpenKinect/libfreenect how do i donwload it or use it

SQLite driver not found with OrmLite

Hi, I am trying to use Ormlite with a sqlite database and it just doesn't work and I don't know why. Here is my code: ```java Class.forName("org.sqlite.JDBC");...
No description

Set up Jersey Rest Api in Eclipse

Hi guys i have an assignment for my college to make a rest api by using jersey and jax-rs...But the problem that i am facing is that i don't know how to start a project and i don't find any info online to set up a project with jersey in eclipse. Can anyone help me?

Need help with @JsonManagedReference and @JsonBackReference

I was getting a Multiple back-reference properties with name 'defaultReference' error for my entities so I implemented ("cartitem-excursions") which fixed the issue but created these new ones. I cant figure out what I'm doing wrong can someone help me setting up my @JsonManagedReference and @JsonBackReference for entities. Entities: https://pastebin.com/p4LCFER8 Errors:...

Pipe data in POST-Controller with dynamically created th:name's (Spring Web, Thymeleaf)

So basically I want, that the th:name stated in the screenshot, the value gets piped into the form-class. Normally you would have i.e. th:name=${someName} and with the POST-request, it gets piped into Form.someName and you can get it with getSomeName(). But in my cae, these th:name's are rendered dynamically with the list-size and each tbody has these two fields. i need to solve it this way, because otherwise, i would only be able to chose on radio button of all and i would only get that value, which is obv nonsene....
No description

In the bitwise compliment operator there is confusion. Please help if you can.

For the 2’s complement, if we take 8 bits for a binary representation, in the case of decimal 200, binary is 11001000 2’s complement is also 11001000 In the procedure to calculate mentioned in the link https://www.rit.edu/academicsuccesscenter/sites/rit.edu.academicsuccesscenter/files/documents/math-handouts/DM3_TwosComplement_BP_9_22_14.pdf, it should be 00111000 The confusion must be because of the 8th bit being a 1....

Comparing strings problem

I have a function called getDirection() which gives me the direction of a character, it is either "north", "south", "east" or "west".. then i have another functtion which splits non cardinal directions into x and y components. For example, north west to "north" and "west".. now when i compare getDirection() with the x component of that complex direcction, it says its not equal.. but when i just write the x component as a string (Manually) it says it is equal! getDirection() is not equal to xDir getDirection() is equal to "west" ...

Help with checksum

Trying to finish this assignment but can't seem to get it to work. Here is the spec sheet and my code. I am so lost.
No description

Java agent throws UnsupportedClassVersionError when Instrumentation#retransformClasses is called.

I need to dump who invokes a setCancelled(boolean cancelled) method in a running jar (Spigot 1.8). I decided to do this via dumping the caller using StackWalker by using a javaagent to add a method call which dumps the caller, the item field which is of type org.bukkit.inventory.ItemStack, & the cancelled argument. The only issue currently, is that when i call retransformClasses the whole thing comes burning down. Target class: org.bukkit.event.player.PlayerInteractEvent The agent is compiled under Java 17.0.12...

New to Java and Ready to Collaborate!

Hey everyone! I'm just starting to learn Java and excited to dive deeper into it. I'm here to connect, help out on projects, and grow together with others learning Java. Let’s code and support each other along the way!