Latest questions in Java

0 votes
1 answer

How to resolve 'Must Override a Superclass Method' Errors after importing a project into Eclipse ?

Eclipse is defaulting to Java 1.5 and ...READ MORE

Jan 10, 2019 in Java by developer_1
• 3,320 points
3,912 views
0 votes
1 answer

Xml to Json Conversion

To convert XML File in to JSON ...READ MORE

Jan 10, 2019 in Java by developer_1
• 3,320 points
2,088 views
0 votes
1 answer

Exception Handling: “ConcurrentModificationException” while removing elements from `ArrayList` while iterating it

Iterator<String> iter = myArrayList.iterator(); while (iter.hasNext()) { ...READ MORE

Jan 10, 2019 in Java by Sushmita
• 6,910 points
582 views
+1 vote
1 answer

How can I find memory usage of my application in Android?

You can get memory info programmatically and ...READ MORE

Jan 10, 2019 in Java by Sushmita
• 6,910 points
3,450 views
0 votes
1 answer

Comparing Functions in Java

I would suggest that Version 1 is ...READ MORE

Jan 9, 2019 in Java by developer_1
• 3,320 points
357 views
0 votes
1 answer

Method for escaping HTML in Java

242 StringEscapeUtils from Apache Commons Lang: import static org.apache.commons.lang.StringEscapeUtils.escapeHtml; // ... String source ...READ MORE

Jan 9, 2019 in Java by developer_1
• 3,320 points
4,048 views
0 votes
1 answer

How to convert a date string to a DateTime object using Joda Time library?

DateTimeFormatter formatter = DateTimeFormat.forPattern("dd/MM/yyyy HH:mm:ss"); DateTime dt = ...READ MORE

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

How can we compare objects by multiple fields in Java?

You can implement a Comparator which compares two Person objects, and ...READ MORE

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

Can I help with the gradle code for AspectJ?

You can go to maven repositories https://mvnrepository.com/artifact/org.aspectj/aspectjtools/1.9.2 ...READ MORE

Jan 9, 2019 in Java by Frankie
• 9,830 points
1,200 views
0 votes
1 answer

Where do we get the maven dependency code for Spring Beans?

Don't worry, you can just go through ...READ MORE

Jan 9, 2019 in Java by Frankie
• 9,830 points
2,032 views
0 votes
1 answer

How to solve this error: No Persistence provider for EntityManager named

After <persistence-unit name="agisdb">, define the persi ...READ MORE

Jan 8, 2019 in Java by Daisy
• 8,120 points
18,424 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,120 points
30,353 views
0 votes
2 answers

Why it is not possible to define a static method in a Java interface?

Interfaces are concerned with polymorphism which is ...READ MORE

Aug 27, 2019 in Java by Sirajul
• 59,230 points
1,568 views
0 votes
1 answer

How can I run test methods in specific order in JUnit4?

@FixMethodOrder(MethodSorters.NAME_ASCENDING) public class SampleTest { ...READ MORE

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

simple HTTP server in Java using only Java SE API

The com.sun.net.httpserver solution is not portable across JREs. Its ...READ MORE

Jan 4, 2019 in Java by Daisy
• 8,120 points
2,173 views
0 votes
1 answer

“Unable to load native-hadoop library for your platform” warning: How to resolve it?

If you are running Hadoop on 64bit CentOS, ...READ MORE

Jan 4, 2019 in Java by Daisy
• 8,120 points
2,160 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

How to set JDK in Eclipse?

To manage the list of compilers go ...READ MORE

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

How to specify the certificate to use for authenticating the server to client?

You can try the command given below. System.setProperty("javax.net ...READ MORE

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

What is the need to override the equals and hashCode methods in Java?

You must override hashCode() in every class ...READ MORE

Jan 2, 2019 in Java by Daisy
• 8,120 points
2,868 views
0 votes
2 answers

How to ignore exception in Java?

There is no way to basically ignore a ...READ MORE

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

Unfortunately MyApp has stopped. How do I solve this?

The common solution for solving App has ...READ MORE

Mar 6, 2019 in Java by AllisonE
• 180 points
756 views
0 votes
1 answer

Why is my Spring @Autowired field null?

If you are not coding a web ...READ MORE

Dec 27, 2018 in Java by Daisy
• 8,120 points

edited Mar 4, 2022 by Sarfaraz 18,159 views
0 votes
1 answer

Getting error 404 not found when trying to download JDK

Try this command, it should work: wget --no-check-certificate ...READ MORE

Dec 26, 2018 in Java by Omkar
• 69,210 points
2,882 views
0 votes
1 answer

Is there any difference between ConcurrentHashMap and Collections.synchronizedMap?

ConcurrentHashMap: It allows concurrent modification of the ...READ MORE

Dec 26, 2018 in Java by Sushmita
• 6,910 points
904 views
0 votes
1 answer

GSON throwing “Expected BEGIN_OBJECT but was BEGIN_ARRAY”?

This will work: ChannelSearchEnum[] enums = gson.fromJson(yourJson, ChannelSearchEnum[].class); But ...READ MORE

Dec 26, 2018 in Java by Sushmita
• 6,910 points
27,891 views
+1 vote
2 answers

What is an Object?

Hey @preetiagarwal, your description is an answer ...READ MORE

Dec 24, 2018 in Java by Priyaj
• 58,090 points
960 views
+1 vote
2 answers

How to use try & catch block in Java?

Hey @Jino, Using try catch block for your ...READ MORE

Dec 21, 2018 in Java by Nabarupa
1,378 views
0 votes
1 answer

Why doesn't RecyclerView have onItemClickListener()?

I like this way and I'm using ...READ MORE

Dec 21, 2018 in Java by Daisy
• 8,120 points
779 views
0 votes
1 answer

Java and SQLite

The wikipedia lists some more wrappers: A good tutorial ...READ MORE

Dec 21, 2018 in Java by Daisy
• 8,120 points
607 views
0 votes
1 answer

Http Basic Authentication in Java using HttpClient?

String encoding = Base64Encoder.encode ("test1:test1"); HttpPost httppost = ...READ MORE

Dec 20, 2018 in Java by Daisy
• 8,120 points
3,614 views
0 votes
1 answer

How to set margins in a LinearLayout programmatically?

LinearLayout ll = new LinearLayout(this); ll.setOrientation(LinearLayout.VERTICAL); LinearLayout.LayoutParams layoutParams = ...READ MORE

Dec 20, 2018 in Java by Daisy
• 8,120 points
11,243 views
+2 votes
1 answer

How to import an existing x509 certificate and private key in Java keystore to use in SSL?

keytool does not provide such basic functionality ...READ MORE

Dec 19, 2018 in Java by Daisy
• 8,120 points
2,395 views
+2 votes
1 answer

How do I ask the Selenium-WebDriver to wait for few seconds in Java?

There are two ways to wait: explicit ...READ MORE

Dec 19, 2018 in Java by Daisy
• 8,120 points

edited Dec 19, 2018 by Daisy 597 views
0 votes
1 answer

Under what conditions is a JSESSIONID created?

JSESSIONID cookie is created/sent when session is ...READ MORE

Dec 18, 2018 in Java by Daisy
• 8,120 points
3,644 views
0 votes
1 answer

What is @ModelAttribute in Spring MVC?

@ModelAttribute refers to a property of the ...READ MORE

Dec 18, 2018 in Java by Daisy
• 8,120 points
3,164 views
0 votes
1 answer

Setting $PATH as used by applications in OS X

That's correct; it's in the plist file ~/.MacOSX/environment.plist It ...READ MORE

Dec 17, 2018 in Java by nirvana
• 3,130 points
663 views
0 votes
1 answer

Getting A File's Mime Type In Java

In Java 7 you can now just ...READ MORE

Dec 14, 2018 in Java by Daisy
• 8,120 points
685 views
0 votes
1 answer

How can we override back button to act like home button?

Most of the time you need to ...READ MORE

Dec 14, 2018 in Java by Daisy
• 8,120 points
2,029 views
0 votes
1 answer

HashMap with multiple values under the same key

Use a map that has a list ...READ MORE

Dec 13, 2018 in Java by Sushmita
• 6,910 points
5,282 views
0 votes
1 answer

Android Studio installation on Windows 7 fails, no JDK found

Adding a system variable JDK_HOME with value ...READ MORE

Dec 13, 2018 in Java by Daisy
• 8,120 points
802 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,332 views
0 votes
1 answer

Integrate UTF-8 encoding in Java WebApp

Mostly characters äåö are not a problematic ...READ MORE

Dec 12, 2018 in Java by Sushmita
• 6,910 points
12,259 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,520 points
41,866 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,978 views
0 votes
1 answer

Can anyone show how to implement SortByValue in Tree Map for Java ?

You can't have the TreeMap itself sort on the ...READ MORE

Dec 10, 2018 in Java by Sushmita
• 6,910 points

edited Dec 10, 2018 by Sushmita 549 views
0 votes
1 answer

How do I implement a HttpURLConnection using a Proxy ?

Since java 1.5 you can also pass ...READ MORE

Dec 10, 2018 in Java by Sushmita
• 6,910 points
9,802 views
0 votes
1 answer

Difference between FetchType LAZY and EAGER in Java Persistence API?

Sometimes you have two entities and there's ...READ MORE

Dec 5, 2018 in Java by Daisy
• 8,120 points
2,225 views
0 votes
1 answer

Received fatal alert: handshake_failure through SSLHandshakeException

On update 51, java 1.8 prohibited[1] RC4 ...READ MORE

Dec 5, 2018 in Java by Daisy
• 8,120 points
6,219 views
0 votes
2 answers

How to iterate in a HashMap in Java?

Iterating using Iterator. Using Generics: Map<Integer, Integer> map = ...READ MORE

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