Most voted "java-8" questions
Java 8 was released in March 2014 and contains new features, enhancements, and bug fixes to increase the efficiency of Java program development and execution.
Learn more…208 questions
Sort by count of
-
0
votes0
answers55
viewsMonitor treadmill running, with mobile phone
Context: Using the sensors of the mobile phone, need to set a running pattern on the treadmill, to know the average speed and distance traveled. I created a program to print sensor values on the…
-
0
votes1
answer76
viewsQuery with Java 8 parameter to generate random numbers using Collectors.toList()
I have this method to generate random numbers in a ArrayList; public static List<Integer> gerarAleatorio() { List<Integer> aleatorios = new ArrayList<>(); while(aleatorios.size()…
-
0
votes1
answer147
viewsApplication works in eclipse and stops working after generating JAR executable
I am working on two apps here in the company that are giving me a certain headache for a reason that the solution should be simple but I am not able to locate the error, the two applications work…
-
0
votes0
answers139
viewsInsert horizontal scrolling in line chart in Mpchart Android
I’m using the library Android Mpchart (v3.0.1) to draw graphics on my Android app, however I wanted to make my chart scrollable on X-axis, this is my code: private void loadDadosGraficoLinha()…
-
0
votes0
answers61
viewsError: HTTP Status 500 - org.json.Jsonobject cannot be cast to jdk.nashorn.api.scripting.Jsobject
In my java system appeared this error: I’m sweating the POSTMAN tool to study the case. HTTP Status 500 - org.json.Jsonobject cannot be cast to jdk.nashorn.api.scripting.Jsobject Code: import…
-
0
votes1
answer474
viewsImplementation using API-Streams and API-Lambda Java 8
Good Staff. Trying unsuccessfully to solve a proposed exercise using the new features of the java 8 Lambda and Streams Apis. In this exercise you can only create and change methods signature in the…
-
0
votes1
answer38
viewsUcanaccess problem in Select with Between Dates
I am having a problem when performing a query having as condition a period of two dates, this query in MS Access works perfectly however via code with ucanaccess library I get the error of 'Unknow…
-
0
votes1
answer37
viewsI need to modify the action taken when closing a Jframe
I am developing an application with persistence in Java for a college job, and I need the system to automatically save the data when closing the application (with a ready function provided by the…
-
0
votes1
answer1232
viewsRemove the last value of an array
I have a basic college project and one of the requirements of the exercise is to remove the last value from an array of integers. I am not able to do with the last value be removed without using an…
-
0
votes1
answer43
viewsTransactions between several classes
Good, I’m relatively new to Java programming! The following is a Super Class named User of which there are 2 subclasses Citizen and Autarchy, within the Citizen class I have created an Arraylist…
-
0
votes1
answer23
viewsCustomize validation message in Wicket
I currently have a project that is using Wicket 7.8.0 and Java 8 and I have one DateTextField that every time I put one wrong date, the FeedbackPanel reports that the: "deDateField" não é um número…
-
0
votes1
answer80
viewsConvert query return to Integer
How can I cast a query for Integer? Follow what I tried to execute. public Integer validaPrincipal(String usuario, Integer tipo) { try{ return (Integer)…
-
0
votes1
answer34
viewsHow to call a Jlabel with its content from another Class?
In a certain class I have a Jlabel thus: public class Links { private JLabel link; lblLink.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent arg0) {…
-
0
votes1
answer76
viewsSave text with line breaks in BD
See below for a java code to save an SQL command return in Postgresql. The command is EXPLAIN ANALYZE. The problem is that while saving this in the database, it loses line breaks. Someone would know…
-
0
votes1
answer67
viewsHow do I import the "javax.Measure" package without IDE?
I am trying to import, in Java 8 and without using IDE, the package javax.measure with the following code: import javax.measure; public class Measure { public static void main(String[] args) {…
-
0
votes0
answers4
viewsHow to automate a status by contacting the Tories?
I would like to automate a test someone can give me a hint
-
0
votes0
answers234
viewsHow to change the content of an inherited class variable?
I am developing a transaction system for methodological purposes. I have the following classe mãe calling for Conta: public class Conta { private double _saldo = 0; private String _nome; private int…
-
0
votes0
answers198
viewsSpring Boot query does not return records
I am developing a system with Java 8 and Spring Boot with JDBC accessing an Oracle base. When I do a query, using Namedparameterjdbctemplate, it does not return any record, but if I copy this same…
-
0
votes0
answers133
viewsOptimize code with prime numbers
I have the following problem: I need a program that receives an even positive number and forms a "training wheel" with these numbers, so that: All numbers from 1 to n are used in the circle only…
-
0
votes1
answer443
viewsHow do I pass a lambda function as a parameter?
I’m doing a college project where I have to develop a calculator with Java. I am trying to find a way to pass lambda functions as a parameter so that it is possible to put these functions inside a…
-
0
votes1
answer59
viewsProblems with Thread in Javafx
I am creating an application to receive serial ports in computer use using the library jSerialCom. For this, I would like to keep updating this information in a ComboBox. But I can’t implement the…
-
0
votes0
answers23
viewsNullpointerexception
I have a button that takes 2 text fields and sends to Mysql by MVC standard only it is giving a java.lang.Nullpointerexception q do not know how to solve The code of the button private void…
-
0
votes2
answers547
viewsIdentifying triangles in Java
I’m doing java exercise, but I can’t find a logic for this: Receive 6 numbers representing measures a,b,c,d,e,f and relate how many and which triangles can be formed using these measures.(To form a…
-
0
votes1
answer212
viewsSending numeric value of an Enum by HTTP request in Java
I have a problem in my system, in my back-end in Java com Spring Boot I have a class that has a property that’s kind of a Enum that I created, and my Front-end which is in Angular when making a…
-
0
votes1
answer211
viewsMysql returns Localdate a day ago
I am unable to identify a problem using Java Localdate with Mysql Date. When saving a date in my Mysql database it saves on the correct date, for example: 2019-05-24. When doing a search using…
-
0
votes1
answer82
viewsCompletablefuture - How to use?
In this situation, how should I work with Completablefuture? Using the method of Worldcupsocialapi implement the method CompletableFuture<Stream<String>> getMostPopularTeamNames(int…
-
0
votes1
answer169
viewsHow to sort my Java list alphabetically?
I have a Spring Framework project, and I need to alphabetize my list, and I have no idea how to do it. At first I managed to load the list, but it has to have that order. Please, how should I do?…
-
0
votes1
answer133
viewsRead data from a file and save to a Set, but Set is null
I’m trying to read a txt file, select a specific column called "customerid", take all the values from that column and show on the screen how many different values there are. But when I try to do…
-
0
votes2
answers99
viewsI cannot run a query with jdbc java
public List<Sistema> buscarUsuarioSistemaPor(Long cpf) throws SQLException { List<Sistema> listSistemas = new ArrayList<>(); String sql = "select s.* from sistema as s\r\n" +…
-
0
votes1
answer22
viewsHow to print in a select in a jsp one list within another?
<div align="center"> <table border="1" cellpadding="5"> <caption> <h2>Lista de Usuarios</h2> </caption> <tr> <th>CPF</th>…
-
0
votes0
answers236
viewsError JSP not displayed - HTTP Status 404 - Not Found
jsp code to display error messages: <%@ page isErrorPage="true"%> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> <html> <head> <title>Show Error…
-
0
votes1
answer1140
viewsSpring data JPA error (Parameter 0 of constructor and entityManagerFactory)
Guys, for hours I’ve been trying to solve a problem in my Spring Data JPA I execute the code and I get this error Description: Parameter 0 of constructor in…
-
0
votes1
answer259
viewsHow to test Controller with Junit?
I’m testing the URL like this package br.com.aluguel.de.carros.unidade.usuario; import br.com.aluguel.de.carros.endereco.Endereco; import br.com.aluguel.de.carros.usuario.Usuario; import…
-
0
votes1
answer48
viewsListview prints only the first element of Arraylist
My application has a screen that lists all the elements registered in BD. The method I use to list the results returns a List (in the Diagnosticodatasource class), until then all right, the problem…
-
0
votes1
answer323
viewsHow to Update Only Some Put Fields in Springboot
Hello People Explaining speed the code this endpoint there is my route updating an already registered student I enter with the data I want to register and send to update function and la "Arrow" data…
-
0
votes1
answer54
viewsMap data like Mysql TIME to JAVA above 24 hours Example (37:26:30)
I have a system that I need to bring Mysql database time information above 24 hours to Java. We use Ibernate and it’s like this; In the bank the data is as TIME (37:13:36) example: TEMPO_REPOUSO…
-
0
votes0
answers110
viewsPersist child objects with parent id 1:N
Guys I’m having difficulty in relationships with Hibernate, I have a 1:N relationship between Provider and Address (1 provider may have N addresses). My problem is this, when I try to persist a…
-
0
votes0
answers17
viewsInsert with JXL reading is registering only 36 values
Hello. I am creating a program whose purpose is to read files. xls and save to the bank, but when I use the read method with Insert, it inserts only 36 lines, without presenting errors. Could you…
-
0
votes0
answers44
viewsException java.lang.Noclassdeffounderror: javax/xml/Ws/Endpoint
It is a simple code, where I will create a Webservice with SOAP, but when I run the code in Eclipse it presents me the following error: Exception in thread "main" java.lang.NoClassDefFoundError:…
-
0
votes1
answer29
viewsJava - Uninitialized "x" variable
I’m having a question: The code is as follows:: package yan.exercises.java.struct.repeat; import java.util.Scanner; public class exe2 { public static void main(String[] args) { Scanner scan = new…
-
-1
votes1
answer458
viewsDifference of dates with Legend in a Textfield
I am developing a hotel system and would like to automate some features in the system. I would like that when you select two dates being the dataEntrada and dataSaida using Calendar, make that when…
-
-1
votes1
answer90
viewsPMD and checkstyle in windows 10
How and which link to install PMD and Checkstyle in windows 10. I only see Linux tutor .
-
-1
votes1
answer133
viewsTurn an SQL command into Lambda or Java 8 Stream
I’m starting in Java 8 and would like to turn the SQL command below into a lambda function: SELECT * FROM Correspondencia c, (SELECT entidadeOrigem, MAX(m1) similaridadeMaxima FROM Correspondencia…
-
-1
votes1
answer70
viewsHow to remove a Where from @Query in Spring Jparepository
I am using Spring BOOT with Starter JPA and java 8 and I have this query in my Repository : @Query("select p from Product p where p.name like %:name% and p.costValue = :costValue and p.saleValue=…
-
-1
votes1
answer73
viewsAndroid Studio stopped working after installing Flutter and this error infirmmation
Good morning! I had Android Studio installed on my machine and after installing Flutter it stopped working. I uninstalled Flutter and even then Android Studio does not work and only presents this…
-
-1
votes1
answer176
viewsGenerate standard bar code 2 of 5 interspersed in java
Good morning, I’m trying to implement a barcode generator to generate the payment code for a billet collection type. Researching realized needed to be in pattern 2 of 5 interspersed, the way I did…
-
-1
votes1
answer42
viewsHow to fill null spaces in a java array?
I need to store a person’s first and last name within a variable. I was able to separate String words within an array and take the first name (by index 0) - and now I would like to know how to get…
-
-1
votes1
answer19
viewsWhy when I use spring boot save method it changes the persistence of the data in several places?
Talk personal, all right? In my context, I need to do an undo method, this out using an array object that saves in memory my last given database persintência and, when saved this data in the array…
-
-1
votes1
answer28
viewsProblems with Creating New Java Projects in Netbeans
The options for creating a new java project do not show the 'Java' option itself. The first option is Java Whith Maven as you can see. Among the available options or select Java Whith Maven the…
-
-2
votes1
answer284
viewsOptional.ofNullable with ifPresent
If the property ano is null but the model and year are filled, will save the car data in the repository ? public Class Carro { int ano; String modelo; int valor; } public void carro(final Carro…