Trending questions in Java

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,870 points
15,444 views
0 votes
1 answer

Error:serializable class Foo does not declare a static final serialVersionUID field of type long

Hello @kartik, If you're serializing just because you ...READ MORE

Jul 28, 2020 in Java by Niroj
• 82,580 points
1,351 views
0 votes
0 answers

I need to Post api to database using java in intellij. After testing sample api through postman i got an Sql exception saying Syntax error at or near ',' Please tell me where i made a mistake

public Result setModelMasterParams(){         try{             long tenantId = request().getHeader("tenant_id")==null                     || request().getHeader("tenant_id").equalsIgnoreCase("")                     || ...READ MORE

Aug 19, 2020 in Java by Sriram
• 120 points

recategorized Aug 19, 2020 by Niroj 392 views
0 votes
1 answer

How to get comments by given user in Facebook Graph API? Can we get list of comments made by given user?

Hii kartik, You can get the list of ...READ MORE

May 7, 2020 in Java by Niroj
• 82,580 points
4,640 views
0 votes
0 answers

Trying to avoid detection using selenium chrome driver (Java)

I am trying to do an automated ...READ MORE

Jul 14, 2020 in Java by laiman
• 330 points
1,751 views
0 votes
0 answers

Restsharp support webservice automationtesting like rest

Hi , Restsharp support webservice automationtesting like rest ...READ MORE

Aug 9, 2020 in Java by anonymous
• 3,010 points
436 views
0 votes
1 answer

How to run a .java file from command line passing arguments in Maven?

Hello @kartik, You could run: mvn exec:exec -Dexec.args="arg1". This will ...READ MORE

Jun 3, 2020 in Java by Niroj
• 82,580 points
3,032 views
0 votes
2 answers

What's the difference between @JoinColumn and mappedBy when using a JPA @OneToMany association?

JPA mapping annotation can be classified as ...READ MORE

Oct 28, 2020 in Java by bjjj
• 140 points
12,580 views
+2 votes
1 answer

How to pass dynamic JSON request with parameter in POST request using Rest assured java?

here payload is short you can also ...READ MORE

Jul 23, 2020 in Java by Vivek
9,095 views
0 votes
1 answer

How to add local jar files to a Maven project?

Hello @kartik, You can add local dependencies directly ...READ MORE

Jul 28, 2020 in Java by Niroj
• 82,580 points
413 views
0 votes
1 answer

How to get an enum value from a string value in Java?

Hello @kartik, Yes, Blah.valueOf("A") will give you Blah.A. Note that the name ...READ MORE

Jul 28, 2020 in Java by Niroj
• 82,580 points
383 views
0 votes
1 answer

Error:The method must override a superclass method after importing a project into Eclipse

Hello @kartik, This problem happened when I imported ...READ MORE

Jul 28, 2020 in Java by Niroj
• 82,580 points
253 views
0 votes
1 answer

How to use an existing database with an Android application?

Hello @kartik, If you are having pre built ...READ MORE

Jul 28, 2020 in Java by Niroj
• 82,580 points
245 views
0 votes
1 answer

Error:java.lang.UnsupportedClassVersionError: Unsupported major.minor version

Hello @kartik, This error means you're trying to ...READ MORE

Jul 28, 2020 in Java by Niroj
• 82,580 points
194 views
0 votes
1 answer

How to Install Java in Windows system?

Hi@akhtar, You can follow the below-given steps to install ...READ MORE

Jul 6, 2020 in Java by MD
• 95,060 points
1,095 views
0 votes
1 answer

How do I convert a String to an int in Java?

Hello @kartik, We can use the parseInt(String str) method of ...READ MORE

Jul 28, 2020 in Java by Niroj
• 82,580 points
139 views
0 votes
1 answer

How to directly initialize a HashMap?

Hello @Kartik, In plain java 8 you also ...READ MORE

Jul 28, 2020 in Java by Niroj
• 82,580 points
107 views
0 votes
1 answer

How can I get the current stack trace in Java?

Hello @kartik, Try this: Thread.currentThread().getStackTrace(); is fine if you don't ...READ MORE

Jul 28, 2020 in Java by Niroj
• 82,580 points
106 views
0 votes
0 answers

create multiple excel sheets.xlsx based on each iteration

Prob : I have a method executeunixcommand ...READ MORE

Jul 14, 2020 in Java by Jyra
• 580 points
726 views
0 votes
1 answer

How to create a memory leak in Java?

Hello @kartik, A simple thing to do is ...READ MORE

Jul 28, 2020 in Java by Niroj
• 82,580 points
87 views
0 votes
1 answer

How to avoid Java code in JSP files?

Hello @kartik, JSTL offers tags for conditionals, loops, sets, ...READ MORE

Jul 28, 2020 in Java by Niroj
• 82,580 points
72 views
0 votes
1 answer

IllegalArgumentException: navigation destination xxx is unknown to this NavController

Hello @kartik, Check currentDestination before calling navigate might be helpful. For ...READ MORE

May 26, 2020 in Java by Niroj
• 82,580 points
2,768 views
0 votes
1 answer

JsonMappingException: No suitable constructor found for type [simple type, class ]: can not instantiate from JSON object?

Hello @kartik, his happens for these reasons: your inner ...READ MORE

Apr 8, 2020 in Java by Niroj
• 82,580 points
4,737 views
0 votes
1 answer

Convert data in List<JsonNode> to Map <String,String> in Java

Hi, @Jyra, Basically, you can use the object mapper to ...READ MORE

Apr 7, 2020 in Java by Gitika
• 65,870 points
4,787 views
0 votes
1 answer

Get sub-string from text based on certain conditions/rules

Hello @laiman, You can use IsMatch function that tests whether ...READ MORE

Jul 28, 2020 in Java by Niroj
• 82,580 points
112 views
0 votes
1 answer

How can I create an executable JAR with dependencies using Maven?

Hello @kartik, You can use the dependency-plugin to ...READ MORE

May 28, 2020 in Java by Niroj
• 82,580 points
2,405 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,580 points
2,477 views
0 votes
1 answer

if i given invalid data how to get alert in selenium using java

Hello, Here is some of the method you ...READ MORE

Jul 20, 2020 in Java by Niroj
• 82,580 points
148 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,100 points
21,789 views
0 votes
1 answer

Error:java.lang.OutOfMemoryError: Java heap space in Maven

Hello @kartik, Here is the whole config that ...READ MORE

Jun 3, 2020 in Java by Niroj
• 82,580 points
1,854 views
0 votes
0 answers

Provider class org.springframework.context.index.processor.CandidateComponentsIndexer not in module

package spring.demo; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; public class Client { public ...READ MORE

Jul 3, 2020 in Java by DUGASANI
• 120 points
382 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,580 points
1,992 views
0 votes
1 answer

GSON fails to read/map a field with name like USERId

Hello @ RamaKrishnaRaju, You should note the Javadoc of configureMessageConverters states ...READ MORE

Jul 1, 2020 in Java by Niroj
• 82,580 points
292 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,580 points
3,158 views
0 votes
1 answer

Error:The superclass “javax.servlet.http.HttpServlet” was not found on the Java Build Path

Hello @kartik, Include servlet-api-3.1.jar in your dependencies. Maven <dependency> ...READ MORE

Jun 3, 2020 in Java by Niroj
• 82,580 points
1,233 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,580 points
1,738 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,580 points
1,475 views
0 votes
1 answer

Error: getExtractedText on inactive InputConnection warning on android

Hello @kartik, The warning appeared when the soft ...READ MORE

May 26, 2020 in Java by Niroj
• 82,580 points
1,365 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,580 points
1,344 views
0 votes
1 answer

Error:Maven Unable to locate the Javac Compiler in:

Hello @kartik, Go to Window -> Preferences... -> ...READ MORE

Jun 3, 2020 in Java by Niroj
• 82,580 points
744 views
0 votes
1 answer

How to configure encoding in Maven?

Hello @kartik, I use some reporting plugins. In ...READ MORE

Jun 3, 2020 in Java by Niroj
• 82,580 points
753 views
0 votes
1 answer

How to unzip files programmatically in Android?

Hello @kartik, This is my unzip method, which ...READ MORE

May 25, 2020 in Java by Niroj
• 82,580 points
1,046 views
0 votes
1 answer

Error:jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class

Hello @kartik, The servlet API .jar file must ...READ MORE

Jun 3, 2020 in Java by Niroj
• 82,580 points
654 views
0 votes
1 answer

What is the equivalent to a JavaScript setInterval/setTimeout in Android/Java?

Hii @kartik, As always with Android there's lots ...READ MORE

May 26, 2020 in Java by Niroj
• 82,580 points
997 views
0 votes
1 answer

How to install Maven artifact with sources from command line?

Hello @kartik, To download sources for your dependencies: mvn ...READ MORE

Jun 3, 2020 in Java by Niroj
• 82,580 points
453 views
0 votes
1 answer

How to get the current working directory in Java?

Hello, Using java.nio.file.Path and java.nio.file.Paths, you can do the following to ...READ MORE

May 28, 2020 in Java by Niroj
• 82,580 points
656 views
0 votes
1 answer

Error: setOnItemClickListener cannot be used with a spinner

Hello @kartik, See the first line of your ...READ MORE

Jun 1, 2020 in Java by Niroj
• 82,580 points
447 views
0 votes
1 answer

Error:“java.lang.OutOfMemoryError: PermGen space” in Maven build

Hello @kartik, When you increased MAVEN_OPTS, you increase the MaxPermSize, ...READ MORE

Jun 3, 2020 in Java by Niroj
• 82,580 points
324 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
2,793 views
0 votes
1 answer

How do I configure Maven for offline development?

Hello @kartik, You have two options for this: 1.) ...READ MORE

Jun 3, 2020 in Java by Niroj
• 82,580 points
166 views