Most viewed questions in Java

+9 votes
16 answers

javac' is not recognized as an internal or external command, operable program or batch file.

Check your javac path on Windows using Windows Explorer C:\Program Files\Java\jdk1.7.0_02\bin and ...READ MORE

May 23, 2018 in Java by Rishabh
• 3,620 points
472,692 views
+11 votes
13 answers

What are the default xmx and xms values ?

Run this code to see all the ...READ MORE

Nov 13, 2018 in Java by anonymous
405,742 views
+5 votes
11 answers

How to import a jar file in Eclipse?

Click on File > Import. The Import ...READ MORE

Aug 23, 2018 in Java by Daisy
• 8,140 points
363,908 views
+3 votes
2 answers

How to find all the classes of a package in Java?

Looking on internet I found this page with ...READ MORE

Nov 16, 2020 in Java by Juan
• 350 points
348,829 views
+17 votes
25 answers

How can I convert String to JSON object in Java?

Hi @Daisy You can use Google gson  for more ...READ MORE

Feb 7, 2019 in Java by Suresh
• 720 points
256,127 views
+2 votes
13 answers

How does java.net.SocketException: Connection reset happen ?

You can use wireshark to view the ...READ MORE

Dec 7, 2018 in Java by tushh
255,305 views
+3 votes
14 answers

com.mysql.cj.jdbc.exceptions.communicationsexception :Communications link failure

Exception in thread "main" com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link ...READ MORE

Dec 12, 2024 in Java by jack

edited Mar 6 253,617 views
+3 votes
14 answers

“A Non-static method cannot be referenced from a static context” error

Hey Techies, Non-static variables are part of the objects ...READ MORE

Dec 10, 2020 in Java by Roshni
• 10,480 points
251,167 views
+3 votes
13 answers

Unable to execute jar- file: “no main manifest attribute”

add a jar/manifest/attributes setting like this: apply plugin: ...READ MORE

Nov 27, 2018 in Java by krishti
218,036 views
+1 vote
6 answers

How to separate digits of a number in Java ?

String numberString = Integer.toString(number);  for (int i = ...READ MORE

Dec 5, 2023 in Java by Akash
• 100 points

edited Mar 5 213,473 views
+1 vote
13 answers

What is the correct way to add external Jars to IntelliJ IDEA Project?

Adding custom JAR files to the EAR project Copy the custom JAR to the ...READ MORE

Dec 10, 2020 in Java by Nikita
188,999 views
0 votes
4 answers

How can we display an output of float data with 2 decimal places in java? Please help

You can use DecimalFormat. One way to use ...READ MORE

Dec 16, 2020 in Java by Gitika
• 65,770 points
167,748 views
+1 vote
13 answers

How to send HTTP POST requests on Java?

With Apache HttpClient In the old days, this Apache ...READ MORE

Dec 10, 2020 in Java by Rajiv
• 8,870 points
161,260 views
+1 vote
1 answer

error creating bean with name 'entitymanagerfactory' defined in class path resource

To solve your ERROR, I would suggest ...READ MORE

Feb 18, 2022 in Java by Aditya
• 7,680 points
159,186 views
+1 vote
5 answers

How to take input using BufferedReader in Java?

yupp i am explaining every thing .. We ...READ MORE

Feb 1, 2020 in Java by Rohan
• 180 points
126,817 views
+1 vote
12 answers

Iterate over a JSONObject?

Assuming your JSON object is saved in ...READ MORE

Dec 11, 2020 in Java by Rajiv
• 8,870 points
126,406 views
0 votes
6 answers

How can we define global variables in java?

To define Global Variable you can make ...READ MORE

Dec 15, 2020 in Java by Gitika
• 65,770 points
119,239 views
0 votes
12 answers

Java - sending HTTP parameters via POST method easily

Below are the steps we need to ...READ MORE

Dec 11, 2020 in Java by Rajiv
• 8,870 points
112,326 views
+1 vote
4 answers

How to take multiple integer input in one line using BufferedReader in Java?

To do this, we could read in ...READ MORE

Dec 14, 2020 in Java by Roshni
• 10,480 points
99,663 views
+4 votes
4 answers

Using while loop i want to print 10 even numbers

Hello @Nitesh, you are pretty much there. ...READ MORE

Nov 22, 2018 in Java by Priyaj
• 58,020 points
94,970 views
+5 votes
4 answers

How to execute a python file with few arguments in java?

You can use Java Runtime.exec() to run python script, ...READ MORE

Mar 27, 2018 in Java by DragonLord999
• 8,450 points

edited Nov 7, 2018 by Omkar 82,567 views
+1 vote
12 answers

Hibernate hbm2ddl.auto possible values and their uses

hibernate.hbm2ddl.auto (e.g. none (default value), create-only, drop, create, create-drop, validate, and update) Setting to perform SchemaManagementTool actions automatically as ...READ MORE

Dec 7, 2018 in Java by Shuvodip
79,377 views
+1 vote
7 answers

What is difference between access modifier and access specifier in java

Access Specifier:- This can be understood as ...READ MORE

Feb 14, 2019 in Java by Priyaj
• 58,020 points
73,355 views
0 votes
4 answers

How do I check if a file exists in Java?

To test to see if a file ...READ MORE

Dec 29, 2020 in Java by Rajiv
• 8,870 points
69,889 views
0 votes
3 answers

HttpServletRequest get JSON POST data

Configure the action as given below: Method: Since ...READ MORE

Dec 16, 2020 in Java by Rajiv
• 8,870 points
69,497 views
+1 vote
4 answers

What is the difference between string object and string literal?

A String literal is a Java language concept. This ...READ MORE

Aug 16, 2019 in Java by Sirajul
• 59,230 points
68,583 views
0 votes
2 answers

What is the difference between Set and List in java?

List is an ordered sequence of elements. ...READ MORE

Apr 26, 2018 in Java by Akrati
• 3,190 points
63,705 views
0 votes
1 answer

How to check if a string contains a substring Java ?

Hi@akhtar, The first and foremost way to check ...READ MORE

Dec 30, 2020 in Java by MD
• 95,460 points

edited Jul 5, 2023 by Khan Sarfaraz 58,479 views
+1 vote
3 answers

3 dot in parameter in Java

The "Three Dots" in java is called ...READ MORE

Nov 22, 2018 in Java by geek.erkami
• 2,680 points
57,913 views
0 votes
3 answers

Setting time zone of a java.util.Date

Using Java 8 Java 8 introduced a new Date-Time ...READ MORE

Dec 15, 2020 in Java by Gitika
• 65,770 points
57,738 views
0 votes
1 answer

No entitymanager with actual transaction available for current thread - cannot reliably process 'remove' call

Hii @kartik, If you have @Transactional // Spring Transactional class ...READ MORE

May 22, 2020 in Java by Niroj
• 82,840 points
54,889 views
0 votes
0 answers

UnsatisfiedDependencyException: Error creating bean with name

 I'm trying to create a Spring CRUD ...READ MORE

May 21, 2022 in Java by Kichu
• 19,040 points
54,316 views
+2 votes
4 answers

Javac command not working in my windows 10

Check your javac path on Windows using Windows Explorer C:\Program Files\Java\jdk1.7.0_02\bin and ...READ MORE

Aug 6, 2019 in Java by Sirajul
• 59,230 points
51,947 views
0 votes
2 answers

Resolving PKIX path building failed Error?

You need to add the certificate for App2 to ...READ MORE

Sep 24, 2018 in Java by Sushmita
• 6,920 points
43,648 views
0 votes
4 answers

“Cannot find symbol” compilation error

The "Cannot find symbol" errors generally occur when you ...READ MORE

Dec 16, 2020 in Java by Gitika
• 65,770 points
42,865 views
0 votes
2 answers

Unable to find valid certification path to requested target

Unfortunately - it could be many things ...READ MORE

Dec 15, 2020 in Java by Roshni
• 10,480 points
42,705 views
0 votes
1 answer

How to get select2 selected value in Jquery ?

The third parameter of the new Option ...READ MORE

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

does java support operator overloading?

In some cases, like the following, operator ...READ MORE

Dec 18, 2021 in Java by Christoph S.

edited Mar 5 42,145 views
0 votes
1 answer

How to find the nth prime number in Java?

Here is the code to find nth ...READ MORE

Mar 4, 2019 in Java by Priyaj
• 58,020 points
40,097 views
+1 vote
2 answers

Retrieve all the implementations of an interface in Java

Take a look to this example: https://github.com/burningwave/co ...READ MORE

Dec 21, 2019 in Java by Roberto
• 460 points

edited Jul 7, 2020 by Roberto 39,787 views
0 votes
1 answer

How to refresh data in ViewPager Fragment ?

Using the ViewPager.OnPageChangeListener is the correct way to go, ...READ MORE

Mar 7, 2019 in Java by developer_1
• 3,350 points
38,061 views
0 votes
1 answer

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'demoRestController'

To answer your doubt, the DemoApplication class ...READ MORE

Feb 23, 2022 in Java by Aditya
• 7,680 points
37,828 views
0 votes
3 answers

How to clear the console in Java?

System.out.println("\f"); You can paste the above ↑↑ code ...READ MORE

Jan 29, 2021 in Java by https://github.com/voyager2005

edited Mar 5 36,755 views
+1 vote
9 answers

How to make mock to void methods with mockito

You can use partial mocking to serve ...READ MORE

Dec 7, 2018 in Java by nitesh
35,907 views
0 votes
1 answer

object references an unsaved transient instance - save the transient instance before flushing

You should add cascade="all" (if using xml) ...READ MORE

Sep 26, 2018 in Java by Parth
• 4,640 points
35,099 views
0 votes
2 answers

How can I solve java.lang.NoClassDefFoundError in Java?

NoClassDefFoundError means that the class is present ...READ MORE

Sep 11, 2018 in Java by Sushmita
• 6,920 points
34,607 views
0 votes
1 answer

How can I solve this: To prevent a memory leak, the JDBC Driver has been forcibly unregistered

What can you do? Ignore these warnings. Tomcat ...READ MORE

Jan 8, 2019 in Java by Daisy
• 8,140 points
32,304 views
0 votes
2 answers

Android Studio Gradle project “Unable to start the daemon process /initialization of VM”

In IONIC Go To > Platform > Android >Cordova ...READ MORE

Dec 16, 2020 in Java by Shahzaib
31,315 views
+1 vote
4 answers

What is a simple way to repeat a string in java?

There is already answer wriiten using StringBuilder ...READ MORE

Dec 16, 2020 in Java by Rajiv
• 8,870 points
30,187 views
0 votes
2 answers

What is the difference between Map and HashMap in java?

The basic difference is : Map is ...READ MORE

Aug 28, 2019 in Java by Sirajul
• 59,230 points
29,781 views