Most voted "java" questions
Use this tag when the question refers to some resource, information, or problem relating exclusively to the Java programming language. Java is a class-based, statically typed, reflective, and execution environment (JRE) language. Java programs are compiled to bytecode and run on a virtual machine (JVM), allowing a "write Once, run Anywhere" philosophy (WORA).
Learn more…14,468 questions
Sort by count of
-
0
votes0
answers77
viewsMockito with Nativequery
need to test a method that uses Native query. However on line Query q = em.createNativeQuery(strQuery, Projeto.class); No value is assigned to q and it is null. Can someone help me? It follows the…
-
0
votes1
answer70
viewsColumn not found when performing SUM
I’m developing the system for a school. I need to create the vacation part. For this I need to add the number of days already launched so that per year are not launched more than 30 days per…
-
0
votes1
answer130
viewsRelationship 1:N in Java
I have an API and I’m creating a relationship between Cliente and AtividadeSecundaria, where a client has several activities and the activities belong to a client, however, when I make the…
-
0
votes1
answer75
viewsHow to do this query search?
I am trying to develop a Rest webservice in Netbeans (Java). I have followed this tutorial... https://rafaelsakurai.gitbooks.io/desenvolvimento-distribuido/content/chapter10.1.html However, when it…
-
0
votes0
answers68
viewsI cannot implement the Arraylist values in the table in the JSP file
I’m starting out in Java Web content and got stuck in the following situation: I am trying to transfer the Arraylist values created inside the JSP file to the table that is inside the JSP file as…
-
0
votes1
answer27
viewsMutable jcombobox
People, I’m working on a vacation record. The person places the initial date and a combo with the amount of days (10,15, 20 and 30) appears for her to complete it. Until 30 days of holidays are…
-
0
votes1
answer76
viewsCall Jdialog without closing/hide Jwindow
I’m making a shipment using a Jwindow public class TelaCarregamentoConf extends JWindow{ // JProgressBar barradeprogresso; Outraclasse outra = new OutraClasse(barradeprogresso) new Thread(){…
-
0
votes1
answer194
viewsSend by jsp a command for the controller to update the database method
I want to make a "deposit" into the account with Id "x". The controller sends the "account" to the jsp that returns the deposit value to be updated in the database. That was the logic I used, but I…
-
0
votes1
answer76
viewsSort on an object [java]
Cheers guys, I’m having a doubt about a project I’m doing just to learn more about the language. following, I have a txt file in which I have to read it and separate the different contents (name,…
-
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
votes0
answers35
viewsHibernate error while reading database column (Reverse Engineering)
When I try to reverse-engineer Hibernate, he can’t read the comic book columns. Give this error "Reading Schema Error: Error while Reading column meta data for curso" Does anyone have any idea what…
-
0
votes2
answers212
viewsFailure to Try to Inject Spring Boot Interfaces
I’m developing a three-layer Rest api. Service, Repository and Domain, I injected the repository into the service using @Autowired but when I try to inject the service into the controller in the…
-
0
votes1
answer146
viewsJPQL Illegalargumentexception - Unexpected token: SUM
java.lang.Illegalargumentexception: org.hibernate.hql.internal.Ast.Querysyntaxexception: Unexpected token: SUM near line 1, column 1 [SUM(e.quantidade) FROM br.com.pmro.coad.modelo.Stock and Join…
-
0
votes3
answers171
viewsHow to filter a list of objects? How can I write this method better?
I would like to write this method in a cleaner and more performing way. Someone has an idea? private List<Projeto> filtraResultado(List<Projeto> projetosAssinados, String[] filtros){…
-
0
votes1
answer3841
viewsAuthentication with Spring Boot, Security, Using Bank Html Page, User and Password
Hello, I am starting with Spring Boot and am caught in a problem with the spring security configuration. I’m trying to do the login part of the page, I made the settings with what I found material…
-
0
votes1
answer71
viewsHow to reference a data already existing in the table with Hibernate
I’m creating an api using Java with Springboot, and Ibernate. The idea is to save guests in the database, and these guests have a group, I don’t really understand the notes, but Mapeei with…
-
0
votes1
answer113
viewsConverting Indo-Arabic numbers to Java Roman numbers
Good afternoon, I am with a certain difficulty in programming a converter for Roman numbers, I managed to separate the houses in thousand, hundred, ten and unit as follows if(numericos==1000){…
javaasked 5 years, 8 months ago Cristiano Rezende 1 -
0
votes1
answer82
viewsHow to prevent Hibernate from creating columns from the fields of an abstract mother class
I have an abstract class Pessoas with methods getters and setters and a concrete class that inherits from Pessoas (members). By mapping the concrete class as Entity and its fields, it is creating…
-
0
votes0
answers177
viewsHow to add PDF reference mark with Itext 5.14
I need my footer to contain a description for a reference mark, for those who do not know it is those numbers that get high in a word, and are referenced in the footer with an explanation of that…
-
0
votes0
answers49
viewsError when instantiating object
in java fx, when I click the button, it should run: private void btnLoginClick(ActionEvent event) { String name = txtUser.getText(); String password = txtPassword.getText(); User user = new…
-
0
votes2
answers96
viewsSpring’s Hot Swap features "Bindexception: Address already in use: Cannot bind"
I’m working with a thread that keeps running Broadcasts to map network devices, but when I modify my code and Spring performs Hot Swap, I get Exception "Bindexception: Address already in use: Cannot…
-
0
votes1
answer59
viewsJSOUP does not take unordered list (ul > li)
Hello, if someone very feral in JSOUP can help me, I’m trying to get information from a card on this site "https://www.brasileirao.com.br/". The problem is that the information is inside an…
-
0
votes1
answer31
viewsWhy are you returning the path of class
I’m making a simple schedule and when I go to print the values shows the class path. Why is this happening? The message the console shows [br.novo.itdd.Person@15db9742, br.novo.itdd.Person@6d06d69c]…
-
0
votes1
answer253
viewsSave a list to Sqlite
I have a list of products and use recycleViwer to list them. I want to take these products and save them in the database. Being honest, I can’t do it! I’m researching but I can’t find content. I’m…
-
0
votes1
answer914
viewsHow to rollback the database using Spring Framework
I have this method that saves data in 3 different tables, /** * * @param user - de onde os dados do usuário serão retirados para gravar no banco * @throws GoogleAuthException - se houver algum erro…
-
0
votes2
answers180
viewsError sending push notification with Firebase-messaging
I’m using the below method that worked: public void enviaNotificacaoDenuncia(String mensagem, String token) { Sender sender = new Sender(apiKey); Message message = new Message.Builder()…
java android-studio eclipse firebase-cloud-messagingasked 5 years, 8 months ago jallisson jallis oliveira band 100 -
0
votes0
answers72
viewsIs giving error in (valorG) inside my IF in all parentheses there IF what can be?
package com.example.testetrabalho; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText;…
-
0
votes1
answer37
viewsPassing the Parameters of a Fragment that uses json for another Fragment
I have a screen that searches by name through an Edittext. And when searching by name it brings me a Recycleview with its results. And when I touch an element of the result, it goes to a Fragment…
-
0
votes1
answer214
viewsFragment screen to call another screen Fragment
I’m in a fragment, and in that fragment I want to call another screen which is also a fragment. I’m using recycleview. If I try to call one activity, I can, but I can’t call a fragment. See the code…
-
0
votes0
answers33
viewsApplication terminates on start, error occurs only on Android 9.0
Eae personal, I have an application that works normally in all versions of Android, however in Android 9.0 (Pie) starts everything normal displaying the Splash Screen but when going to Mainactivity…
-
0
votes1
answer481
viewsMock local variable inside method with mockite and spring boot
I’m trying to simulate the return of a method on a local variable, but it’s always null, showing java.lang.Nullpointerexception I have the following code within a @service: @Service…
-
0
votes1
answer77
viewsJtextfield left alignment, but he won’t stay left
I’m working with Jtextfield and I’m having a problem with alignment. The field size is standard, I can’t change it. The field is also not editable, it receives the value based on a calculation…
-
0
votes2
answers63
viewsHow to detect when the user tries to access a URL without having a ROLE for that URL in Spring Security
In my system the ROLES of the screen urls are dynamically loaded from the database through a ObjectPOstProcessor as you can see below: public void configProducao(HttpSecurity http) throws Exception…
-
0
votes2
answers61
viewsRead data, add it to a list and then print it
I have to create a class Agenda, and then create a list of schedules and print. Man main: public static void main(String[] args) { List<Agenda> lista = new ArrayList<Agenda>(); Agenda…
javaasked 5 years, 8 months ago Joao Spirit 101 -
0
votes1
answer172
viewsHow to insert header and footer in documeto docx using Apache Poi
I am trying to insert header and footer in an automatically generated docx file, the image loads but it is not visible in the file. Just follow my code: XWPFDocument doc = new XWPFDocument();…
-
0
votes2
answers34
viewsLogic Problem JAVA Clock Program
Good afternoon my dear I’m having a problem with the logic of this program which is a clock: private void updateDisplay() { if(hours.getValue()==0 && (periodo=="am" || periodo =="AM")){…
javaasked 5 years, 8 months ago Renan Avila 19 -
0
votes1
answer51
viewsAndroid socket does not come out of the while, why?
After sending the event I have to close the program to send another event through the socket. I realized that it is not closing, gets stuck in the while paps go through the…
-
0
votes1
answer177
viewsCalling Activity from Webview
I’m developing my first app Android, using java and I’m having a hard time calling a Activity through the Webview. In the Activity that appears first, it contains only one Webview that will load a…
-
0
votes0
answers40
viewsHow to create a dynamic layout of equations system on android
I’m creating an application for Android that solves systems of linear equations in which the user defines the number of equations, and generates a system of Equations, where the user needs to define…
-
0
votes0
answers70
viewsUpdate Jtexpane (display scrollbar) when inserting information
I have a JTextPane where I enter some values. Components are added directly in the Netbeans IDE, not created on run, instantiating components. What I’d like to achieve is: As the values are added,…
-
0
votes0
answers71
viewsHow to start a class in the same. java file?
I am new in this part of compilation for Android APP, I would like to know how to start a class q is in the same java file, for example: my 'Mainactivity', already declared the button that should…
-
0
votes0
answers35
viewsJava - Problems with normal map generation
Hello, I have a problem in generating a normal texture map, I wonder if there is any way to "soften" tone transitions. Original image (left) and generated map (right) As you can see, the generated…
-
0
votes1
answer172
viewsHow to redirect url - redirect 301 - through a request ? (Httpurlconnection)
I’m trying to get a status code[ redirect 301, Location : ] through a request. This request brings as parameter an id associated to a database stored url (in this case, a Map), with the id, I search…
-
0
votes1
answer65
viewsJSON data return without spacing
I have a class that has a single method to make a request for data that are in JSON format and return a single "fantasy" field that in my case is stored in the Company name variable. This class…
-
0
votes1
answer215
viewsHow to pass data through an Intent to Main Activity?
I’m developing a small android app to exercise what I’ve already learned. The application consists of two Activity’s, Mainactivity and a second Activity. On Main I have a textView and a button,…
-
0
votes2
answers210
viewsCreate execution looping until an element is visible
I need to make a looping in which it stops running only when a specific element becomes visible. It must click the filter button and check if the element is visible, if the return is false, it…
-
0
votes1
answer81
viewsMy icons are not being added to . JAR
Good afternoon, I’m having a problem when compiling my application. I’m using Apache Netbeans 11.0 Java 8 I’m having trouble setting an image on a Jlabel. Call me back Expection in thread…
-
0
votes0
answers80
viewsProblems receiving data from another Activity Android Kotlin, Intent must not be null
Hello, I am trying to pass the data I receive from a call to the API, and send this data to the next Activity, however I am receiving that Intent is null, as code below. I have tried changing the…