Latest Questions tagged Java

Browse all latest questions tagged Java

92
Votes
Published 19 Sep, 2022
Java - POST InputStream with RestTemplate

I have a client that needs to POST a large number of large json files to a server. I've been able to get it working by reading each of the files into memory and posting the entire file with RestTempla...

131
Votes
Published 19 Sep, 2022
Java - Java 8 Unsafe: xxxFence() instructions

In Java 8 three memory barrier instructions were added to Unsafe class (source): /** * Ensures lack of reordering of loads before the fence * with loads or stores after the fence. */ void loadFence...

122
Votes
Published 19 Sep, 2022
Java - Error:No such property: GradleVersion for class: JetGradlePlugin

I am getting below error in intellij for a gradle project. I am importing existing gradle project and trying refresh it in gradle window. Error:No such property: GradleVersion for class: JetGradlePlu...

95
Votes
Published 19 Sep, 2022
Java - Datagram Transport Layer Security (DTLS) on Android/Java

Has anyone used DTLS on Android or is there an open source Java implementation that supports DTLS? What are my other options for securing UDP traffic on Android?

101
Votes
Published 07 Sep, 2022
Java - How to filter a PostgreSQL array column with the JPA Criteria API?

I am using: Hibernate 4.3.5 Spring JPA 1.6.0 Javax Persistence API 2.1 The "refcodemailing" column is defined as an array of int: int[] My entity object: @Entity @Table public class CalendarEven...

22
Votes
Published 19 Sep, 2022
Java - Deploying my application at the root in Tomcat

I have the war file of my application. I need to deploy this at the root level. The current URL is http://localhost:8080/war_name/application_name.

84
Votes
Published 19 Sep, 2022
Java - How can I get access to the HttpServletRequest object when using Java Web Services

I'm using Java 6, Tomcat 6, and Metro. I use WebService and WebMethod annotations to expose my web service. I would like to obtain information about the request. I tried the following code, but wsCtxt...

32
Votes
Published 07 Sep, 2022
Java - How to get previous date in java

I have a String Object in format yyyyMMdd.Is there a simple way to get a String with previous date in the same format? Thanks

85
Votes
Published 16 Sep, 2022
Java - What is the difference between `bitCount()` and `bitLength()` of a `BigInteger`

The descriptions of bitCount() and bitLength() are rather cryptic: public int bitCount() Returns the number of bits in the two's complement representation of this BigInteger that differ from...

64
Votes
Published 19 Sep, 2022
Java - java.lang.IndexOutOfBoundsException: setSpan (N ... N) ends beyond length 10500

I get this exception when I call EditText.setSelection() java.lang.IndexOutOfBoundsException: setSpan (N ... N) ends beyond length 10500 N can be any number. For example if I call setSelection(1047...

24
Votes
Published 19 Sep, 2022
Java - Connecting to Heroku Postgres from Spring Boot

I'm looking for the simplest, cleanest way of connecting to Heroku Postgres in a Spring Boot app using JPA/Hibernate. I don't see a good, complete example for this combo in either Heroku or Spring Bo...

27
Votes
Published 16 Sep, 2022
Java - IPv4/IPv6 network calculations and validation for Java?

I am looking for a package that is similar to Net_IPv4 and Net_IPv6 but written for Java. It needs to be able to do the following: Verify an address is valid (e.g. 127.0.0.1 is valid, 127.0.0.257 is...

40
Votes
Published 16 Sep, 2022
Java - Unit testing equals and hashcode - a complexity story

I'm having a moral dilemma. I have some value objects in my application, which are immutable and extremely simple. I've generated the equals and hashcode with an IDE (intellij in my case) but doing th...

67
Votes
Published 19 Sep, 2022
Java - Why is it possible to declare a variable without an initial value?

I'm reading Gilles Dowek's Principles of Programming Languanges: He says that it's also possible to declare a variable without giving it an initial value and also that we must be careful not to use a...

122
Votes
Published 16 Sep, 2022
Java - Tired of Java IDEs, Need simple and basic alternative

I am really happy that I got my work in Java programming, and I am doing it since last 3 yrs. And I am netbeans user, and worked on eclipse for sometime (4 months).. Now I am tired on IDE's and its is...