Category "java"

In Activity.onCreate(), why does Intent.getExtras() sometimes return null?

This was probably a false alarm, see my own answer. Original question below: An activity has a button that takes the user to another activity. To launch the ne

Execute the remaining code after handling exception in java? [closed]

I may be silly. But I got interviewed and I was asked question regarding how you will run the remaining code after you will get the exception.

Android Studio: W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED

I am trying to make a movie list, but it only shows a white screen with the app name. Apparently, I have a very similar program to this and it runs perfectly fi

how to mock global variable in Mockito

I have a global variable global. My method has a line: global.getListOfObjects() I am trying to write a unit test and keep getting a NPE on the above line.

The input line is too long when starting kafka

I'm trying to run Kafka message queue on Windows. I'm usin this tutorial - https://dzone.com/articles/running-apache-kafka-on-windows-os When i try to run it

How to change element in array?

Array is 2 dimensional 10x10 gameBoard Code I made for array: int gameBoardLength = gameBoard.length; System.out.print(" "); //two spaces to align t

Ignore maven execution block which uses toolchain if ~/.m2/toolchains.xml is not present

I'm working on an open-source library which must work correctly on jre7. Since java 9 has been released, we decided to provide our modules with module-info.java

Gradle - "Changes are not tracked, unable determine incremental changes."

When running my LibGDX desktop project I sometimes get this error: Changes are not tracked, unable determine incremental changes. I've tried using Java 8 and 17

A way to consider the backslash as a normal character

Is there someone who knows how to consider the backslash as a normal character (not an escape character) in a string in Java? Any help will be appreciated!

How to set default download directory in selenium Chrome Capabilities?

Please find the below code with the chrome capabilities. In fact the browser is not downloading the file to the specified path. private static DesiredCapabili

AWS rds - How to read from a read replica inside of a Java application?

I am new to aws. I have a mysql rds instance and I just created 2 read replicas. My application is written in Java, and what I have done up until now is using

Converting String date to SQL Date

I have a string date in the format DD/MM/YY (16/07/13) How do I convert this string date to SQL Date format (maintaining the same DD/MM/YY format) for storing i

Restart Tomcat Service on AWS EC2 instance, on a schedule

I have an instance on Tomcat running on EC2. Based on some resourcing reasons that I don't want to get into, I'd like it to restart each evening at 11:00pm. I

Cannot Add Http Headers to Message with Spring's WebServiceTemplate

I have a fairly simple case where I am trying to add HTTP headers (not SOAP headers) to a request I am making using Spring's WebServiceTemplate. I have defined

how to get next item in ArrayList in java

i followed a YouTube tutorial about programming a quiz app using java android studio in the tutorial you put the question in array list then you get randomly qu

File has been compiled by a more recent version of the Java Runtime error SceneBuilder

I've used JLink + JPackage to build a JavaFX app into a self-contained application. I'm using JDK 14. However, when I try to open one of my FXML files in Intell

JPA created too many fields in table

enter image description here I am trying to map some entities to tables in MySQL database using Spring Boot JPA. I have a problem with one of the tables because

JDBC driver connection problems (sun.jdbc.odbc.JdbcOdbcDriver)

I'm having some issues with the connection with Java and SQL 2008 Express. I'm using sun.jdbc.odbc.JdbcOdbcDriver driver for the connections and have created my

Test a method that use a spring service

I have a problem testing a method in Java (I use jUnit 4) and this method to test make a call to a repository and should throw an exception if something is wron

React Native Android run causes "Illegal number of arguments for updateHotspot command"

I am creating a simple app using React Native for both iOS and Android. I've tested both platforms for a while and all works very well. But recently, I was focu