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

Posts tagged java

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

75%
+4 −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 1mo ago by hkotsubo‭  ·  last activity 1mo 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 2mo ago by Gagamelius‭  ·  edited 2mo 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 3mo ago by cuzzo‭  ·  last activity 3mo 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 4mo ago by cuzzo‭  ·  edited 4mo 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 4mo ago by billy‭  ·  last activity 4mo 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 5mo ago by cuzzo‭  ·  closed 5mo 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 5mo ago by cuzzo‭  ·  last activity 5mo ago by cuzzo‭

Question java intellij-idea
28%
+0 −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 12mo ago by cuzzo‭  ·  last activity 5mo ago by cuzzo‭

Question java class
33%
+0 −2
Q&A How to solve missing JAR files error from Ant

I keep getting this error: Cause: the class org.apache.tools.ant.taskdefs.optional.ssh.SSHExec was not found. This looks like one of Ant's optional components. Action: Check that the ap...

1 answer  ·  posted 10mo ago by Megan‭  ·  last activity 10mo ago by Megan‭

Question linux jenkins ant jar
77%
+5 −0
Q&A How to open a file and edit its content in groovy script

I have a Makefile in my Jenkins job's workspace, that I want to edit out certain parts from and then save it, before running next part of the script that uses this Makefile. The part that I want t...

2 answers  ·  posted 10mo ago by Megan‭  ·  last activity 10mo ago by Alexei‭

Question jenkins shell groovy
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 1y ago by klutt‭  ·  last activity 1y 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 1y ago by Holden‭  ·  last activity 1y ago by hkotsubo‭

42%
+1 −2
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 1y ago by klutt‭  ·  last activity 1y 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 1y ago by klutt‭  ·  last activity 1y 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 1y ago by klutt‭  ·  last activity 1y 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 1y ago by klutt‭  ·  edited 1y 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 1y ago by cuzzo‭  ·  edited 1y 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( () =&gt; { this.http.get(... ).sub...

1 answer  ·  posted 1y ago by klutt‭  ·  last activity 1y 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 1y ago by artaxerxe‭  ·  closed 1y 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 1y ago by cuzzo‭  ·  edited 1y 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 1y ago by deleted user  ·  edited 1y 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 1y ago by Anonymous‭  ·  edited 1y 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 1y ago by Anonymous‭  ·  edited 1y 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 1y 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 1y ago by Anonymous‭  ·  last activity 1y 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 1y ago by Anonymous‭  ·  last activity 1y ago by hkotsubo‭

40%
+2 −4
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 1y ago by Anonymous‭  ·  last activity 1y 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 1y ago by Anonymous‭  ·  last activity 1y 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 1y ago by Anonymous‭  ·  edited 1y ago by Alexei‭

60%
+1 −0
Q&A Why ArrayList is always same value in only Adapter?

This is the worst bug I have ever seen.. I was fetching CallLogs following way. ArrayList&lt;HashMap&lt;String, String&gt;&gt; callLog= new ArrayList&lt;&gt;(); HashMap&lt;String, Strin...

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

60%
+1 −0
Q&A event_start always returning contact number in android

Why ContactsContract.CommonDataKinds.Event.START_DATE always returning contact number. The number is available in Google Contacts. Here what I am doing... Cursor c; if (contactID==""...

0 answers  ·  posted 1y ago by Anonymous‭

50%
+0 −0
Q&A What's the alternative of "ContactsContract.Contacts.LAST_TIME_CONTACTED"?

What should I use instead of ContactsContract.Contacts.LAST_TIME_CONTACTED? According to documentation, LAST_TIME_CONTACTED variable was deprecated. Even it was written in ContactsContract.class /...

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

60%
+1 −0
Q&A Find image for contact list in Android Java

How to get image of contact list? I was using cursor to get contact list. Here how it looks like. ArrayList&lt;HashMap&lt;String, String&gt;&gt; contactList = new ArrayList&lt;&gt;(); Has...

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

80%
+6 −0
Q&A Proper way of sending large amount of data from View to ViewModel

The problem I am working on a simple drawing app for Android. I have a custom view on which the user can draw. This means that a lot of data (a list of points) is generated in this View. I want t...

1 answer  ·  posted 2y ago by FractionalRadix‭  ·  last activity 1y ago by nnlei‭

Question java android binding
80%
+6 −0
Q&A How to parse a date with more than 3 decimal digits in the fractions of second?

I'm using SimpleDateFormat to parse a string containing a date/time, but the result has a different date, hour, minute, second and millisecond: SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM...

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

83%
+8 −0
Q&A How can I emulate regular expression's branch reset in Java?

I've got this sample regex: Pattern p = Pattern.compile("(?:([aeiou]+)[0-9]+|([123]+)[a-z]+)\\W+"); It basically has the following parts: one or more lowercase vowels ([aeiou]+), followed by one ...

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

Question java regex
66%
+2 −0
Q&A How to manage decibel meter?

I had build an application using following source code (following the steps). package com.decibal.level; import androidx.appcompat.app.AppCompatActivity; import android.media.MediaRecorder; ...

1 answer  ·  posted 2y ago by deleted user  ·  last activity 2y ago by deleted user

Question java android physics
66%
+2 −0
Q&A Changing the font of an entire JTable column.

I know I can change the font of each cell individually by overriding getCellRenderer(row, col) in JTable but I want to be able to change the font of an entire column at once and, ideally, have the ...

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

Question java swing JTable
75%
+4 −0
Q&A Changing the font of a certain cell within a JTable

I am trying to change the font type and size in a JTable cell. Ive looked at tons of posts and while most don't produce stack traces, they don't seem to do anything either. Here is the code I curr...

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

Question java swing
71%
+3 −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 versi...

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

Question java architecture
71%
+3 −0
Q&A Trying to create a POST request with Apache

I have tried many different ways to do this with apache but the server seems to not be receiving the data. Stacktraces are not being printed so I can only assume I have the request set up wrong for...

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

75%
+4 −0
Q&A How to reason about transaction isolation during development

Consider the following code: public class OnlineShoppingService { @Transactional public void cancelOrder(String id) { if (shipmentRepository.findShipmentForOrder(id) != null) { ...

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

44%
+2 −3
Q&A What is the latest, efficient way to create a login page in JAVA?

I am a noob Java programmer. I want to create a simple login page with just username and password. So I have to combine Java and HTML. While googling I found that Servlets do the job but people are...

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

Question java
75%
+4 −0
Q&A Improved Atkin-Bernstein sieve for generating primes

This is a class from my personal code library, and from a package which deals with integer sequences. It implements an interface package org.cheddarmonk.math.sequence; public interface IntegerSequ...

0 answers  ·  posted 2y ago by Peter Taylor‭

Question java prime-numbers
66%
+2 −0
Q&A Will my implementation of a Spring Boot app work after being deployed on the Internet?

Say I want to implement a very basic group chat application. I use the H2 database, a user class, a controller, and a text file in the Resources folder that stores the chat texts. All texts would b...

1 answer  ·  posted 2y ago by sonofel‭  ·  last activity 2y ago by Moshi‭

71%
+3 −0
Q&A What options can be set via swing.properties?

The default Swing look and feel can be set in $JAVA_HOME/conf/swing.properties What else can be set in this file? I can't find any other documentation of it.

1 answer  ·  posted 2y ago by ajv‭  ·  last activity 2y ago by Stephen C‭

Question java swing
66%
+2 −0
Q&A Validating xsd schema that contains import from external http source in Java 11

In the example.xsd file I have an import to an external xsd file that looks like this: &lt;schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://test.example.com" ...

0 answers  ·  posted 2y ago by Janar‭  ·  edited 2y ago by Monica Cellio‭

Question java spring xsd