Category "java"

Java LocalDate invalid date formatting

I have a script to get previous month for current date (script executed on 1st date monthly) the script return valid result for all other month except on Januar

one single ObjectOutputStream for multiple use with sockets

I'm trying to make a very basic example of a network connection where I use an ObjectOutputStream, ObjectInputStream and sockets. The client sends the string "H

Java 8 LocalDateTime.now() only giving precision of milliseconds

Is it possible to get microseconds in Java 8? The Java 8 LocalDateTime class has a .getNano() method which is meant to return nanoseconds, but on both Linux(Ubu

Adding Assertion module to HashTree from Jmeter using Java

Edit The hirerachy of my test script is the following: - test plan - thread group 1 - http sampler 1-1 - thread group 2 - http sampler 2-1 - thre

Developing a Spring REST service with OData interface

I'm developing a RESTful service using the spring framework. This service has a few different controllers. Some of the controllers allow the user to query data

How do I initialize a two-dimensional List statically?

How can I initialize a multidimensional List statically? This works: List<List<Integer>> list = new ArrayList<List<Integer>>(); But

@Transactional method calling another method without @Transactional anotation?

I've seen a method in a Service class that was marked as @Transactional, but it was also calling some other methods in that same class which were not marked as

Difference between Entity and DTO

What is the difference between a DTO and an Entity? In details these are my questions: What fields should the DTOs have? For example my entity classes are: @E

Tracking "hidden" exceptions

I am inspecting the output of a program of mine where from time to time I see a message like "java.lang.NullPointerException" and nothing else. Because this doe

Android Studio - Java JVM

I downloaded the latest version of Android Studio, but I can not use it. The following message appears: Failed to create JVM: error code -4 JVM Path: C:\Progra

Confused over compareTo implementation with PriorityQueue

I am trying to write a program where I replicate a registrar's office using a priority queue. The sorting for this priority queue would be based on a higher GPA

JavaFX "Location is required." even though it is in the same package

I am trying to get my JavaFX program to run but am having some difficulty. I keep getting an error of 'java.lang.NullPointerException: Location is required.' Th

Multiple If-else or enum - which one is preferable and why? [closed]

Here is the original code: public class FruitGrower { public void growAFruit(String type) { if ("wtrmln".equals(type)) {

Getting illegal character in scheme name at index 0 error while calling a post request through apache client

I am trying to execute an apache client httppost call in my java code. The url which I was able to execute successfully using curl command was as below- curl -

AWS Elastic Beanstalk - Failed to deploy application

I am not able to deploy my application on Elastic Beanstalk. Getting below error in eb-engine.log An error occurred during execution of command [app-deploy] - [

How to assert an actual value against 2 or more expected values?

I'm testing a method to see if it returns the correct string. This string is made up of a lot of lines whose order might change, thus usually giving 2 possible

SP2-0310: unable to open file .sql

I am calling batch file from my java program which in result execute some .sql files. the batch script is below: set part1= CREATE OR REPLACE DIRECTORY REPORT

IOException parsing XML document from class path resource

Ok I'm currently trying mavenise a project. However my project fails to find the xml file containing the some beans. combined2.xml I have it defined as: p

Java Graphics, Graphics panel and Buttons Panel

I am trying to create a Frame that has a graphics panel on the top portion (through a Layout) and a buttons / labels panel underneath it in the same frame. So

How to remove all callbacks from a Handler?

I have a Handler from my sub-Activity that was called by the main Activity. This Handler is used by sub-classes to postDelay some Runnables, and I can't manage