Category "java"

How to prevent touches prematurely stopping smoothScroll in RecyclerView?

I am using an Adapter to fill a RecyclerView with numerous CardView layouts (horizontally). Each CardView has a Button at the bottom of the layout, which when p

Automatically delegating all methods of a java class

Say I have a class with many of public methods: public class MyClass { public void method1() {} public void method2() {} (...) public void met

Could not find or load main class org.testng.remote.RemoteTestNG - in Eclipse

I've tried to update Selenium webdriver version and now i cant run my tests because of following exception: Error: Could not find or load main class org.t

error: package javafx.scene.media does not exist

I'm trying to create javafx media player as gradle project, but got this error.error: package javafx.scene.media does not exist on line: import javafx.scene.med

Install Protocol Buffers on Windows

I am unable to find clear instructions to install Google Protocol Buffers (including compiler) on Windows x64 platform. I went through the instructions README

My tests were running and then I clicked "Run as --> Maven clean" and now when I click "Run as --> Maven test" it doesn't work anymore

My project worked after right-clicking on the pom.xml file in Eclipse and selecting: "Run as --> Maven install" and then "Run as --> Maven test". I start

Illegal UTF8 string in constant pool in class file error in IntelliJ

Whenever I try to run a file (java main, cucumber feature, junit test) I get the following error in IntelliJ Idea: Information:15/05/2015 14:57 - Compilati

Creating a jar from a maven project in intellij

I created a new maven project in IntelliJ and set packaging to jar but when I build it, the target folder does not contain a jar. I'm sure its something really

How to increase IDE memory limit in IntelliJ IDEA on Mac?

I'm using IDEA 12 Leda on Mountain Lion. I wanted to increase the maximum memory that IDE can use. I set the VMOptions in Info.plist file to be -Xmx2048m -ea -X

Netbeans 12.6 and 13.0 SQL profiler no longer works for Java 8

I get this error stack when trying to SQL profile a Java 8 project which I don't get on 12.5 and below: Profiler Agent: Established connection with the tool Pro

Dynamic drop down list with AJAX and database

I'm hoping someone could guide me in the right direction. What I'm trying to do is create two drop down lists where the second one (cities) depends on the first

List<String> as input of GET method

I have a REST service. The input type of the GET method is List<String>: @GET @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public L

Get Current Day (Monday, Tuesday, etc) in Java

I am working on a program that asks the user which day they would like to see a lunch menu for. They can enter any day by name (Monday, Tuesday, etc.). This wor

MongoSocketOpenException - trouble with connecting to MongoDB

This is my first time trying anything with MongoDB, so I would love any tips if you guys have any, but in particular, Im having trouble establishing a connectio

How to check if exists any duplicate in Java 8 Streams?

In java 8, what's the best way to check if a List contains any duplicate? My idea was something like: list.size() != list.stream().distinct().count() Is it

Kotlin + Java 9 modules (Java 11 in use) + maven

I've created a simple project with Java and Kotlin code, and I'm trying to compile it as Java 9 module. Here is my pom.xml: <?xml version="1.0" encoding="UT

For each loop using 2D array

This is the snippet of Java code: int[][] uu = new int[1][1]; uu[0][0] = 5; for(int[] u: uu){ System.out.println(u[0]); } It prints 5. But why does the d

Use Mockito 2.0.7 to mock lambda expressions

I want to mock a query provided on my repository like this: @Test public void GetByEmailSuccessful() { // setup mocks Mockito.when(this.personRepo.find

Tomcat does not start. Where was I wrong?

I did everything according to the instructions, installed all environment variables, but it still does not start. This is what is output in cmd when I try to st

Set PlaceHolder on JPasswordField

I am developing a system with Java (using NetBeans) and, to make it more "professional", I've added some cool functions, such as Placeholders (Yes, I know, it's