Trending questions in Java

+2 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
• 340 points
293,045 views
+8 votes
16 answers

Unable to resolve this error: "javac is not recognized as an internal or external command"

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,640 points
284,842 views
+12 votes
13 answers

Default parameters of XMS and XMX in JVM

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

Nov 13, 2018 in Java by anonymous
284,572 views
+2 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,110 points
218,395 views
+15 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
216,908 views
+2 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,420 points
184,652 views
+2 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
131,821 views
+1 vote
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
117,435 views
0 votes
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
108,819 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,880 points
107,984 views
+1 vote
14 answers

Communications link failure: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException

Your exception seems to indicate that your ...READ MORE

Dec 11, 2020 in Java by Roshni
• 10,420 points
105,278 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,880 points
73,261 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,880 points
71,772 views
0 votes
6 answers

How can I separate the digits of an int number in Java?

You can also have a look here: To ...READ MORE

Dec 9, 2020 in Java by Roshni
• 10,420 points
69,489 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,050 points
32,900 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,880 points
37,596 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 13, 2020 in Java by Roshni
• 10,420 points
33,945 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
33,669 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,870 points
40,500 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 6, 2018 by Omkar 40,857 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,100 points
28,327 views
+3 votes
4 answers

Using while loop i want to print 10 even numbers

public class Loops { ...READ MORE

Dec 4, 2019 in Java by One of the Simplest ways to answer you q
29,838 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,870 points
33,109 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
31,334 views
+1 vote
3 answers

3 dot in parameter in Java

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

Nov 21, 2018 in Java by geek.erkami
• 2,680 points
26,320 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,050 points
22,149 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,420 points
22,700 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,870 points
24,850 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,880 points
20,271 views
0 votes
1 answer

SLF4J: Failed to load class “org.slf4j.impl.StaticLoggerBinder”

I had the same issue with WebSphere ...READ MORE

Dec 30, 2020 in Java by Gitika
• 65,870 points
1,598 views
0 votes
2 answers

How to convert InputStream to byte array in Java?

The class IOUtils, lib: https://mvnrepository.com/artifact/com ...READ MORE

Sep 23, 2020 in Java by Anthony
9,035 views
0 votes
3 answers

How to clear the console in Java?

import java.io.IOException; public class chkClearScreen {     public static void ...READ MORE

Aug 26, 2020 in Java by ItsJustRaja
24,277 views
0 votes
1 answer

How to append text to an existing file in Java?

Java 7+ If you just need to do ...READ MORE

Dec 30, 2020 in Java by Gitika
• 65,870 points
321 views
0 votes
1 answer

How to redirect to an external URL from controller action in Spring MVC?

Hello @kartik, You can do it with two ...READ MORE

May 22, 2020 in Java by Niroj
• 82,680 points
9,904 views
0 votes
1 answer

How do I count the number of occurrences of a char in a String?

My 'idiomatic one-liner' for this is: int count ...READ MORE

Dec 30, 2020 in Java by Gitika
• 65,870 points
283 views
0 votes
1 answer

How do I check if a string contains a substring in Java?

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

Dec 30, 2020 in Java by MD
• 95,140 points
282 views
0 votes
1 answer

Can't execute jar- file: “no main manifest attribute”

First, it's kind of weird, to see ...READ MORE

Dec 23, 2020 in Java by Gitika
• 65,870 points
531 views
0 votes
1 answer

Unsupported major.minor version 52.0

The issue is because of a Java ...READ MORE

Dec 30, 2020 in Java by Gitika
• 65,870 points
229 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 28, 2020 in Java by Rajiv
• 8,880 points
95 views
0 votes
3 answers

How to check if a String is numeric in Java?

Check if a string is numeric public class ...READ MORE

Dec 28, 2020 in Java by Carlos
116 views
0 votes
4 answers

How to convert a char to a String?

There are two ways you can do ...READ MORE

Dec 28, 2020 in Java by Roshni
• 10,420 points
73 views
0 votes
1 answer

How to install the JDK on Ubuntu Linux?

Open Terminal from Application Dash or press Ctrl+Alt+T Update repository: sudo add-apt-repository ...READ MORE

Dec 30, 2020 in Java by Gitika
• 65,870 points
105 views
0 votes
1 answer

How to install Java 8 on Mac

Oracle has a poor record for making ...READ MORE

Dec 23, 2020 in Java by Gitika
• 65,870 points
407 views
0 votes
1 answer

How to convert Java String into byte[]?

The object your method decompressGZIP() needs is a byte[]. So the ...READ MORE

Dec 30, 2020 in Java by Gitika
• 65,870 points
102 views
0 votes
1 answer

How to remove the last character from a string?

Hi@akhtar, You can use the StringBuffer class. It provides ...READ MORE

Dec 30, 2020 in Java by MD
• 95,140 points
103 views
0 votes
1 answer

Removing whitespace from strings in Java

st.replaceAll("\\s+","") removes all whitespaces and non-visible characters (e.g., ...READ MORE

Dec 30, 2020 in Java by Gitika
• 65,870 points
87 views
0 votes
1 answer

How to read all files in a folder from Java?

public void listFilesForFolder(final File folder) { ...READ MORE

Dec 30, 2020 in Java by Gitika
• 65,870 points
79 views
0 votes
1 answer

Implements vs extends: When to use? What's the difference?

Extends is for extending a class. implements are for implementing an interface The difference between ...READ MORE

Dec 30, 2020 in Java by Gitika
• 65,870 points
75 views
0 votes
1 answer

How to convert a Set to List in Java?

Hi@MD, The most straightforward way to convert a ...READ MORE

Dec 30, 2020 in Java by akhtar
• 38,180 points
60 views
0 votes
1 answer

How to get the current date/time in Java?

It depends on what form of date/time ...READ MORE

Dec 30, 2020 in Java by Gitika
• 65,870 points
60 views