Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Welcome to Software Development on Codidact!

Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.

Posts tagged java

30 child tags

Use for questions about Java, a high-level programming language. Consider tagging the question with more specific tags related to the actually used framework (e.g. [spring], [spring-boot], [jakarta-ee], [android], [javafx], [gradle] and [maven]).

This tag doesn't have a detailed wiki yet.

66%
+2 −0
Q&A LocalDate format in fields stored as json via Hibernate

Setup I have a database table with field of JSONB type. I access said database using Hibernate. In hibernate I have entity mapped on said table. Entity contains field marked with @JdbcTypeCode(...

1 answer  ·  posted 18d ago by talex‭  ·  last activity 18d ago by talex‭

50%
+0 −0
Q&A Hexagonal Architecture + Domain Driven Design. How to perform a correct implementation?

Hello! Currently, I am trying to implement these two architectures together with Java and Spring (although technology shouldn't matter I think). But I'm encountering problems getting them to work...

1 answer  ·  posted 1mo ago by rudahee‭  ·  last activity 1mo ago by harmony‭

77%
+5 −0
Q&A Json deserialization of enum, forbid int

I have a DTO that contains an enum field: @Getter @Setter static class Foo { Bar bar; } enum Bar { X, Y } When I deserialize a JSON, it allows int as values: var objectMapper ...

2 answers  ·  posted 2mo ago by talex‭  ·  edited 2mo ago by hkotsubo‭

Question java json jackson
66%
+2 −0
Q&A SQL scripts referenced in persistence configuration must have each statement on its own line

I'm currently working on a Java application using Jakarta Persistence with EclipseLink and PostgreSQL. While setting up the application to test the database layer, the persistence configuration is ...

0 answers  ·  posted 2mo ago by ɯıpɐʌ‭  ·  edited 2mo ago by ɯıpɐʌ‭

81%
+7 −0
Q&A Map<?, Optional<T>> to Map<?, T>

I have a Map with Optional values. I want to filter it to remove empty values. Map<K, Optional<T>> input; Map<K, T> result = input. // here is some code I'm looking for ...

2 answers  ·  posted 2mo ago by talex‭  ·  last activity 2mo ago by hkotsubo‭

Question java stream
71%
+3 −0
Q&A Prevent anonymously subclassing

Is it possible to somehow prohibit anonymously subclassing of a specific class? For instance, with a plain public parent class: public class Parent { } Extending this class should not be pos...

1 answer  ·  posted 4mo ago by Andreas witnessed the end of the world today‭  ·  last activity 2mo ago by Antares‭

Question java inheritance
66%
+2 −0
Q&A Spring Boot application not excluding Jdbi bean when running tests using WebFluxTest

I have a simple Spring Boot 3.x reactive application that exposes a RESTful API. The application uses Jdbi in the persistence layer, and the configuration for Jdbi is straightforward: @EnableTrans...

0 answers  ·  posted 3mo ago by ɯıpɐʌ‭

71%
+3 −0
Q&A Why does a lack of object encapsulation constitute a security breach?

In the current version of OpenJDK's JEP 401: Value Classes and Objects (Preview), it is said that value classes can leak data stored in their fields, and that this is potentially a security concern...

1 answer  ·  posted 3mo ago by Andreas witnessed the end of the world today‭  ·  last activity 3mo ago by Derek Elkins‭

66%
+2 −0
Q&A Maven JPA integration: processor not found

My annotation processor "cannot be found" but everything ~looks okay. In Eclipse IDE, I created a new Maven project with the "quickstart-architype" resulting in a project with this structure: ___...

1 answer  ·  posted 8mo ago by tylerbakeman‭  ·  edited 4mo ago by Andreas witnessed the end of the world today‭

Question java xml jpa
60%
+1 −0
Q&A ServletContext matched by more than 1 path

The javadoc for ServletContext.getContextPath() says that It is possible that a servlet container may match a context by more than one context path. I was trying to find any explanation how t...

0 answers  ·  posted 6mo ago by morgwai‭

77%
+5 −0
Q&A How can one import two classes with the same name in Java8?

Some development tools provide an error message when a user tries to import two things (classes, packages) with the same name. Some programming languages offer a syntax to import one of those thing...

2 answers  ·  posted 10mo ago by tarhalda‭  ·  last activity 7mo ago by Michael‭

Question java java-8
40%
+0 −1
Q&A Eclipse Custom Errors for Annotation Processing

In Eclipse, is it possible to setup custom errors or markers in the editor, for annotation processing? For example, the standard squiggly lines with descriptions. This question is not important. ...

0 answers  ·  posted 7mo ago by tylerbakeman‭

Question java jpa Eclipse
60%
+1 −0
Q&A How to log first n lines of a stack trace in Java?

How to log first n lines of a stack trace in Java?

2 answers  ·  posted 9mo ago by propatience‭  ·  last activity 9mo ago by hkotsubo‭

60%
+1 −0
Q&A MongoDB Java Morphia case insensitive criteria query?

So I googled some on how to make a case insensitive criteria query but could not find the solution very easily. So I basically have code that looks like this: ... query.criteria("fieldName").con...

1 answer  ·  posted 9mo ago by propatience‭  ·  edited 9mo ago by propatience‭

66%
+2 −0
Q&A What is the purpose of having a wrapper class for JarFile in Spring-boot-loader?

My question relates to Spring-boot-loader v2.6.15. For the purposes of this question, I will refer to Spring's custom JarFile class as CustomJarFile to avoid confusion. Context I am reusing so...

1 answer  ·  posted 10mo ago by Miss Skooter‭  ·  last activity 9mo ago by Miss Skooter‭

50%
+1 −1
Q&A How do I properly render a quad in OpenGL using a GL_TRIANGLE_STRIP primitive?

I am currently working with LWJGL and the obstacle I face right now on my project is rendering textures to a cube, e.x a set of 8 vertices with position, color, and UV information. For now, I am st...

1 answer  ·  posted 1y ago by cuzzo‭  ·  last activity 1y ago by djm‭

71%
+3 −0
Q&A Clear selectManyMenu component if user unselects item in JSF 2

I am working with JSF 2.3 and have a selectManyMenu component that is marked as required but that I want to be cleared if the user unselects all items. Currently, the user can unselect all items, b...

1 answer  ·  posted 1y ago by tarhalda‭  ·  edited 1y ago by BalusC‭

66%
+4 −1
Q&A How do I remove an element from a Java array?

One way to remove element from array is to replace element with zero. Below is a rough snippet I am sharing: int N = sc.nextInt(); int pos = sc.nextInt(); int A[] = new int[N]; if(pos == i) { ...

1 answer  ·  posted 1y ago by abhinavxyz‭  ·  edited 1y ago by E_net4‭

Question java array
60%
+1 −0
Q&A How to put text next to my ImageIcon on a cell in a JTable

I have an application that works with a JTable, and in this JTable, I want each cell to have both an ImageIcon and some text. I see at this link, JTable supports ImageIcon OR text, but seemingly n...

1 answer  ·  posted 1y ago by davidalayachew‭  ·  edited 1y ago by Alexei‭

77%
+5 −0
Q&A How to trigger an error/warning immediately upon compile/run if an item on my class-path is missing

I have a very simple source file -- HelloWorld.java public class HelloWorld { public static void main(String[] args) { System.out.println("hello world"); } } I have th...

0 answers  ·  posted 1y ago by davidalayachew‭  ·  edited 1y ago by davidalayachew‭

66%
+2 −0
Q&A Log4j2 not looking for log4j.properties even with the system property set

I am migrating an application from Log4j1 to Log4j2 using the API bridge jar. All references to the log4j1.jar have already been removed. I set the system property in Websphere as a JVM argument -...

1 answer  ·  posted 1y ago by tarhalda‭  ·  edited 1y ago by Alexei‭

Question java log4j
75%
+4 −0
Q&A DocuSign eSignature API SDK: java.lang.NoClassDefFoundError errors.

I am trying to implement DocuSign's eSignature REST API by using Java SDK. I am following instructions here: https://developers.docusign.com/docs/esign-rest-api/sdks/java/setup-and-configuration/ ...

1 answer  ·  posted 1y ago by Vanity Slug ❤️‭  ·  last activity 1y ago by Vanity Slug ❤️‭

77%
+5 −0
Q&A Is it worth using the Java Platform Module System in application code?

Is it worth using the Java Platform Module System introduced in Java 9 to structure application code? Given that the Java Platform Module System introduced in Java 9 doesn't manage dependency vers...

1 answer  ·  posted 3y ago by meriton‭  ·  edited 1y ago by __blackjack__‭

Question java architecture
81%
+7 −0
Q&A How to verify if a year is leap in Java?

How to verify if a year is leap? Given a numeric value (such as 2023) or some object that represents a date (such as Date, Calendar, LocalDate, etc), how can I do it?

1 answer  ·  posted 1y ago by hkotsubo‭  ·  last activity 1y ago by hkotsubo‭

Question java date
50%
+1 −1
Q&A Rest service doesn't find @GET Method (Jersey Rest service in Gradle).

I have to implement a JSON based REST web service for querying literature. Ordinary users should be able to query data and process it in their clients. The "main user" can adapt database entries vi...

0 answers  ·  posted 2y ago by Gagamelius‭  ·  edited 2y ago by Alexei‭

55%
+3 −2
Q&A How to proportionally convert a number in the range of -1 and 1 to a number in the range of 0 and 319

I have float noise values, between -1 and 1, for every x,y coordinate in a 2D area and I am trying to convert that to a whole number between 0 and 319 which represents a vertical z coordinate to re...

3 answers  ·  posted 2y ago by cuzzo‭  ·  last activity 2y ago by Dirk Herrmann‭

Question java 3d math
66%
+2 −0
Q&A How would I avoid textures being blurred when mapped to a TriangleMesh?

I am making a game using JavaFX and the Fxyz library. I have chunks which are made of Point3D's, these points are then passed to a ScatterMesh and that is used to generate a TriangleMesh so I can m...

0 answers  ·  posted 2y ago by cuzzo‭  ·  edited 2y ago by Alexei‭

Question java 3d javafx fxyz3d
33%
+0 −2
Q&A Deep linking from another app isn't working for Amazon prime and disney+hotstar

It's not possible to send data to amazon prime and disney+hotstar. I was trying to send user to amazon prime when they click a (video) link (e.g. https://www.amazon.com/gp/video/detail/B01MSPI8JN/r...

1 answer  ·  posted 2y ago by billy‭  ·  last activity 2y ago by billy‭

28%
+0 −3
Q&A How would I go about chunk loading around player in a 3 dimensional cartesian coordinate space [closed]

So I am in the process of creating a voxel sandbox survival game (minecraft clone) in javaFX. I am at a point where I need to come up with a way to load the chunks in my surrounding given a render ...

1 answer  ·  posted 2y ago by cuzzo‭  ·  closed 2y ago by cuzzo‭

Question java javafx
66%
+2 −0
Q&A Why is IntelliJ not finding these modules?

So to preface I started a new JavaFX project in IntelliJ and all of this is from what was auto-generated out of the box. The modules I'm having trouble with are Edit to make this post more query...

1 answer  ·  posted 2y ago by cuzzo‭  ·  last activity 2y ago by cuzzo‭

Question java intellij-idea
37%
+1 −3
Q&A Java cannot find class within same package

I've written a class object, QueueObject, but when I try to construct it inside of my main class, it says it cannot find the symbol on compilation. I've read lots of pages saying how misspellings o...

1 answer  ·  posted 2y ago by cuzzo‭  ·  last activity 2y ago by cuzzo‭

Question java class
75%
+7 −1
Q&A How to avoid "exception is never thrown" when commenting out a line while debugging

I have a code block like this: try { ... x.foo(); // This is the line that forces us to have the try block ... } catch (ArrayIndexOutOfBoundsException e) { logger.error(e.getM...

1 answer  ·  posted 2y ago by klutt‭  ·  last activity 2y ago by anatolyg‭

Question java exception
57%
+2 −1
Q&A How can the Caesar cipher be implemented in Java?

The Caesar cipher is a substitution cipher in which the letters of an ordered alphabet are cyclically shifted by a given number. A detailed description can be found e.g. here. Let u be the index o...

2 answers  ·  posted 2y ago by Holden‭  ·  last activity 2y ago by hkotsubo‭

37%
+1 −3
Q&A Mocking methods with arguments

Let's say I have this class I want to mock class A { public void add(T arg) { B b = A.getB(); U val = somefunc(arg); V ret = b.add(val); } } I have a spy o...

3 answers  ·  posted 2y ago by klutt‭  ·  last activity 2y ago by klutt‭

42%
+1 −2
Q&A How to create an object, call one of it's methods and pass it as an argument as a oneliner?

Assume I have this class Foo class Foo { private int x; void setX(int x) { this.x = x; } } And I have a Junit test like this: Bar bar; @BeforeEach void setu...

3 answers  ·  posted 2y ago by klutt‭  ·  last activity 2y ago by Alexei‭

Question java junit
72%
+6 −1
Q&A How to unittest method that involves contacting remote servers?

Let's say I have this class: class myService { private boolean foo(T arg) { return arg == 42; } public Response bar(U arg) { if(foo(U.field)) { return Response.st...

1 answer  ·  posted 2y ago by klutt‭  ·  last activity 2y ago by meriton‭

66%
+2 −0
Q&A How to check if a ldap username is valid without contacting the active directory via ldap?

I have some code connecting to an active directory via ldap. Something like this: public Response add(User user) { try { LDAPConnectionPool ldapPool = ldapConnectionPool.getPool();...

0 answers  ·  posted 2y ago by klutt‭  ·  edited 2y ago by klutt‭

40%
+2 −4
Q&A How do I properly format a String for parsing with a com.google.gson.JsonParser

I am trying to check a JSON array for a certain element. However, when I try to instantiate a JsonElement to search the list for: JsonElement builderElement = JsonParser.parseString( "{\"disc...

0 answers  ·  posted 3y ago by cuzzo‭  ·  edited 2y ago by Stephen C‭

Question java json json-parser
77%
+5 −0
Q&A How to prevent token from being refreshed

I have an Angular application. The frontend has a mechanism that periodically fetches some information like this: ngOnInit(): void { setInterval( () => { this.http.get(... ).sub...

1 answer  ·  posted 3y ago by klutt‭  ·  last activity 3y ago by meriton‭

37%
+1 −3
Q&A Cannot write multipart message to byte array [closed]

I'm trying to write a MIME message to the console. ByteArrayOutputStream out = new ByteArrayOutputStream(); MimeMultipart replyMsg = mdnCreator.createMDNData(); replyMsg.writeTo(out); out.close...

0 answers  ·  posted 3y ago by artaxerxe‭  ·  closed 3y ago by Alexei‭

62%
+3 −1
Q&A java.lang.UnsupportedClassVersionError: when trying to connect to JDBC with JDK 14 in Eclipse

I'm trying to connect to a db file in my project but having some troubles. I'm using JDK 14 with ojdbc11 however I am still getting this when trying to connect: java.lang.UnsupportedClassVersionEr...

1 answer  ·  posted 3y ago by cuzzo‭  ·  edited 3y ago by Alexei‭

53%
+5 −4
Q&A What's the difference between Inheritance and Polymorphism?

I'm using Java code as an example, but this can be answered if you don't know Java. class Bird{ public void sing(){ System.out.println("Testing"); } } class anClass ex...

2 answers  ·  posted 3y ago by deleted user  ·  edited 3y ago by Alexei‭

57%
+2 −1
Q&A Hash sum mismatch (only for openjdk-11-jdk)

I was installing Java yesterday. I had faced lot of problem. I had fixed most of them. But I had changed Hash that's what I think. I don't remember which command I had executed since I had executed...

1 answer  ·  posted 3y ago by Anonymous‭  ·  edited 3y ago by Alexei‭

22%
+0 −5
Q&A Why I am unable to find a class after implementing library also?

I had found a better way to plot in Java. int n = Integer.parseInt(args[0]); // the function y = sin(4x) + sin(20x), sampled at n+1 points // between x = 0 and x = pi ...

0 answers  ·  posted 3y ago by Anonymous‭  ·  edited 3y ago by Anonymous‭

Question java package
50%
+0 −0
Q&A Why some items aren't clickable in RecyclerView?

if (type=="dialer") { String timestamp = list.get(position).get(Constants.DATE); holder.txtTimestamp.setVisibility(View.VISIBLE); holder.imgDelete.s...

0 answers  ·  posted 3y ago by Anonymous‭

60%
+1 −0
Q&A WARNING: environment variable DISPLAY is not set (netbeans)

I was trying to install Netbeans in Xubuntu. I had installed Netbeans using Snapd. sudo snap install netbeans --classic I was trying to start Netbeans then I got an error which was looking like...

1 answer  ·  posted 3y ago by Anonymous‭  ·  last activity 3y ago by Anonymous‭

60%
+1 −0
Q&A Why is the switch statement not executing the correct case blocks?

In the code below, the value of order variable should change according to i's value: String order; switch (i){ case 0: order = CallLog.Calls.DATE + " DESC "; contactViewAda...

1 answer  ·  posted 3y ago by Anonymous‭  ·  last activity 3y ago by hkotsubo‭

36%
+2 −5
Q&A What are the disadvantages of using static methods in Java?

I was using static method few moments ago. But I noticed that I was returning a variable using that static method. According to the article, Static is a keyword that identifies the class-related...

4 answers  ·  posted 3y ago by Anonymous‭  ·  last activity 3y ago by hkotsubo‭

Question java static class
57%
+2 −1
Q&A What's the minimum API level for activity transition?

I was trying to show transition on activity changes. I had followed two method from SO. I lost those link so I can't add them here. My first method was I had used overridePendingTransition on onCr...

1 answer  ·  posted 3y ago by Anonymous‭  ·  last activity 3y ago by Anonymous‭

50%
+0 −0
Q&A What should I use instead of managedQuery?

managedQuery is recently deprecated. ManagedQuery was used for using Cursor. What should I use since managedQuery was deprecated? Without it, I can't work with Cursor. So there must be alternative ...

1 answer  ·  posted 3y ago by Anonymous‭  ·  edited 3y ago by Alexei‭