Most viewed questions in Java

0 votes
1 answer

What causes java.lang.reflect.InvocationTargetException

The exception is thrown if InvocationTargetException - if ...READ MORE

Jun 20, 2018 in Java by Rishabh
• 3,620 points
8,741 views
0 votes
2 answers

Exception found while using Thread.sleep() and wait() in Java

A simpler way to wait is to ...READ MORE

Aug 13, 2018 in Java by samarth295
• 2,220 points
8,723 views
0 votes
1 answer

How to get a context in a recycler view adapter?

Hii, You can add global variable: private Context context; then ...READ MORE

May 26, 2020 in Java by Niroj
• 82,880 points
8,700 views
0 votes
1 answer

“Missing return statement” within if / for / while in Java

Putting a return statement in any of the ...READ MORE

Sep 27, 2018 in Java by code.reaper12
• 3,500 points
8,692 views
0 votes
1 answer

Calling remove in foreach loop in Java

To safely remove from a collection while ...READ MORE

Sep 26, 2018 in Java by sharth
• 3,370 points
8,612 views
0 votes
3 answers

Is it possible to take char input from scanner?

// Use a BufferedReader to read characters ...READ MORE

Sep 7, 2018 in Java by Daisy
• 8,120 points
8,561 views
0 votes
1 answer

How to include jars in classpath using command line?

I have tried the following and it's ...READ MORE

Jan 3, 2019 in Java by Daisy
• 8,120 points
8,457 views
0 votes
1 answer

Deep copying a 2d array in Java

I guess, for deep copying you will ...READ MORE

Nov 13, 2018 in Java by code.reaper12
• 3,500 points
8,444 views
0 votes
0 answers

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'MyController':

I am trying to create a spring ...READ MORE

May 9, 2022 in Java by Kichu
• 19,050 points
8,407 views
0 votes
1 answer

How to fix the Hibernate "object references an unsaved transient instance - save the transient instance before flushing" error

You should include cascade="all" while using XML ...READ MORE

Feb 18, 2022 in Java by Aditya
• 7,680 points
8,363 views
0 votes
1 answer

SuppressWarnings (“unchecked”) in Java

@SuppressWarnings("unchecked") is used when Java generics just don't ...READ MORE

Sep 4, 2018 in Java by anto.trigg4
• 3,440 points
8,350 views
0 votes
1 answer

Is there a way to instantiate abstract class ?

No, you are not creating the instance ...READ MORE

Dec 12, 2018 in Java by Sushmita
• 6,910 points
8,333 views
0 votes
1 answer

No appenders could be found for logger(log4j)?

Just to get you going you have ...READ MORE

Jun 29, 2018 in Java by Akrati
• 3,190 points
8,310 views
0 votes
2 answers

How to return multiple objects from a Java method?

In the event the method you're calling ...READ MORE

Aug 30, 2019 in Java by Karan
• 19,610 points
8,282 views
0 votes
2 answers

Java Security: Illegal key size or default parameters

Starting from Java 9 or 8u151, you ...READ MORE

Aug 23, 2018 in Java by Parth
• 4,630 points
8,203 views
0 votes
0 answers

could not extract ResultSet in hibernate

I am getting this exception: "HTTP Status ...READ MORE

May 20, 2022 in Java by Kichu
• 19,050 points
8,192 views
0 votes
1 answer

How to add action listener that listens to multiple buttons?

Hii, modified form of the source based on ...READ MORE

Apr 21, 2020 in Java by Niroj
• 82,880 points
8,079 views
0 votes
1 answer

how to get latest modified object or folder in s3 bucket in java.

Here's what you could probably try: List all ...READ MORE

Apr 6, 2020 in Java by Liana
8,070 views
0 votes
1 answer

Error: Could not find or load main class org.testng.remote.RemoteTestNG

This worked for me: Right click on your ...READ MORE

Feb 16, 2022 in Java by Aditya
• 7,680 points
8,047 views
0 votes
1 answer

Cannot open local file - Chrome: Not allowed to load local resource

To answer your query, start with opening ...READ MORE

Feb 18, 2022 in Java by Aditya
• 7,680 points
7,996 views
0 votes
1 answer

How to launch Google Maps Directions via an intent on Android?

Hello @kartik, If you are interested in showing the ...READ MORE

May 25, 2020 in Java by Niroj
• 82,880 points
7,966 views
0 votes
1 answer

Which of them among ArrayList, LinkedList, and Vector is most efficient for adding and removing elements from the list?

Of the three, LinkedList is generally going to give ...READ MORE

Dec 3, 2018 in Java by Frankie
• 9,830 points
7,664 views
0 votes
1 answer

How to parse JSON Array in Android?

Hello @kartik, use the following snippet to parse ...READ MORE

May 26, 2020 in Java by Niroj
• 82,880 points
7,406 views
0 votes
1 answer

How to determine programmatically the current active profile using Spring boot ?

Hello, It doesn't matter is your app Boot ...READ MORE

May 21, 2020 in Java by Niroj
• 82,880 points

edited Mar 4, 2022 by Sarfaraz 7,344 views
0 votes
1 answer

No compiler is provided in this environment. perhaps you are running on a jre rather than a jdk?

Once you are on your Eclipse integrated ...READ MORE

Feb 8, 2022 in Java by Rahul
• 9,670 points
7,312 views
0 votes
1 answer

Eclipse java debugging: source not found

Eclipse debugging works with the class actually loaded by ...READ MORE

Oct 25, 2018 in Java by Daisy
• 8,120 points
7,287 views
0 votes
1 answer

Best XML parser for Java

If speed and memory is no problem, dom4j is ...READ MORE

Jul 21, 2018 in Java by samarth295
• 2,220 points
7,227 views
0 votes
1 answer

java.lang.classnotfoundexception: com.mysql.jdbc.driver

I assume that your mysql connectivity library ...READ MORE

Feb 8, 2022 in Java by Soham
• 9,700 points
7,188 views
0 votes
1 answer

How to build jars from IntelliJ properly?

How to build a jar with IntelliJ ...READ MORE

Oct 12, 2018 in Java by sharth
• 3,370 points
7,169 views
0 votes
1 answer

Using setTimeout to delay timing of jQuery actions

The JavaScript setTimeout () function  is used ...READ MORE

May 30, 2022 in Java by gaurav
• 23,260 points
7,167 views
0 votes
1 answer

How to run a JAR file in Java?

The command given below will help you ...READ MORE

Jun 1, 2018 in Java by Parth
• 4,630 points
7,159 views
0 votes
0 answers

Spring Maven clean error - The requested profile "pom.xml" could not be activated because it does not exist

I am  getting this message when I ...READ MORE

May 8, 2022 in Java by Kichu
• 19,050 points
7,093 views
0 votes
1 answer

nodemon command is not recognized in terminal for node js server

You need to install it globally npm install ...READ MORE

Feb 17, 2022 in Java by Aditya
• 7,680 points
7,075 views
0 votes
1 answer

Mocking static methods with Mockito

@RunWith(PowerMockRunner.class) @PrepareForTest(DriverManager.class) public class Mocker { ...READ MORE

Dec 12, 2018 in Java by Daisy
• 8,120 points
6,979 views
0 votes
1 answer

How to Read/Write String from a File in Android

Writing a File in android: private void writeToFile(String ...READ MORE

Oct 3, 2018 in Java by sharth
• 3,370 points
6,970 views
0 votes
1 answer

The difference between Classes, Objects, and Instances

A class is a type of blueprint ...READ MORE

Jun 7, 2022 in Java by pranav
• 2,590 points
6,947 views
0 votes
1 answer

Multiple return types in Java

No, you don't have two return types.It's ...READ MORE

Feb 8, 2019 in Java by developer_1
• 3,320 points
6,916 views
0 votes
1 answer

How to tell Jackson to ignore a field during serialization if its value is null?

To suppress serializing properties with null values ...READ MORE

Jul 4, 2018 in Java by Rishabh
• 3,620 points
6,833 views
0 votes
2 answers

How can we Split Java String by New Line?

If you don’t want empty lines: String.split("[\\r\\n]+") READ MORE

Aug 22, 2018 in Java by Daisy
• 8,120 points
6,810 views
0 votes
2 answers

How can I get current time in YYYY:MM:DD HH:MI:Sec:Millisecond format in Java?

public String getCurrentTimeStamp() { ...READ MORE

Sep 21, 2018 in Java by Parth
• 4,630 points
6,789 views
0 votes
1 answer

What are the -Xms and -Xmx parameters when starting JVM?

The XMX parameter helps in signifying and ...READ MORE

Feb 8, 2022 in Java by Soham
• 9,700 points
6,674 views
0 votes
0 answers

java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)

This is the exception on getConnection(): java.sql.SQLException: Access denied ...READ MORE

May 16, 2022 in Java by Kichu
• 19,050 points
6,613 views
0 votes
1 answer

Error: Could not create the Java Virtual Machine Mac OSX Mavericks

Hello @kartik, Normally this error occurs when you ...READ MORE

May 21, 2020 in Java by Niroj
• 82,880 points
6,598 views
0 votes
3 answers

Does Java support Default Parameters?

You can try this with method overloading. void ...READ MORE

Sep 21, 2018 in Java by Sushmita
• 6,910 points
6,590 views
0 votes
2 answers

Give an example for encryption and decryption in AES using Java

getfullstring: Splashscreen.text >>> READ MORE

May 8, 2019 in Java by anonymous
6,581 views
0 votes
1 answer

How to convert or cast hashmap to JSON object in Java, and again convert JSON object to JSON string?

You can use: new JSONObject(map); READ MORE

Jun 27, 2018 in Java by Akrati
• 3,190 points
6,574 views
0 votes
1 answer

How to call a method from Constructor?

Have a glance at below steps: You create ...READ MORE

Nov 13, 2018 in Java by Frankie
• 9,830 points
6,479 views
0 votes
1 answer

How to decode jwt token in javascript without using a library?

Working unicode text JWT parser function: function parseJwt ...READ MORE

Nov 4, 2022 in Java by Damonlang
• 700 points
6,445 views
0 votes
1 answer

Maven project using testng dependecy

Hello @zaraaq, First try to replace the scope ...READ MORE

Nov 25, 2020 in Java by Niroj
• 82,880 points
6,314 views
0 votes
1 answer

Java Client Certificate over HTTPS/SSL

The missing links was (mostly) the first ...READ MORE

Nov 28, 2018 in Java by Sushmita
• 6,910 points
6,256 views