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
votes1
answer62
viewsNullpointer Exception when entering data into a Foreign key
I am facing some problems with entering data in my clients table. Specifically with foreign keys fk_telefone_fisico and fk_telefone_juridico. When I register the user ee gives me a…
-
0
votes1
answer48
viewsError while listing data in Datatable
Good morning, I’m trying to make a simple listing of a table on a primefaces datatable, but they’re not listing anything. Follow code until the moment. .xhtml: <!DOCTYPE html PUBLIC "-//W3C//DTD…
-
0
votes1
answer568
viewsPsqlexception: No results returned by query
I cannot identify the error that is returning when trying to insert data to the BD. I believe the error is in the insert function. The error returned is: Exception in thread "main"…
-
0
votes1
answer105
viewsError starting Tomcat server
I am inserting two Hibernate dependencies into my pom.xml <!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-core --> <dependency>…
-
0
votes0
answers14
viewsHow do I validate login when the user changes fields?
How can I check if a login has already been registered? Below is an excerpt from an attempt I made. If you can help me thank you. This is an excerpt from the DAO layer. public boolean validarLogin…
javaasked 7 years, 9 months ago elbenevides 27 -
0
votes1
answer210
viewsError with Hibernate query
I am trying to perform the following Query on Hibernate: return this.entityManager .createQuery("SELECT u FROM UploadArquivoCondominio u WHERE " + " u.condominio = :ucondominio ) " + "AND u.dtinicio…
-
0
votes1
answer760
viewsHow can I block access to application pages with session filter?
Session Filter Code @WebFilter(urlPatterns = { "/*" }) public class FiltroSessaoUsuario implements Filter { public void init(FilterConfig fConfig) throws ServletException { } public void…
-
0
votes2
answers2097
viewsRead java txt file data and perform Java operations
I am making a vehicle rental company in java need to read from a txt the type of client(char) a date range(string) and the amount of passengers(int). I need to bring this data to be analyzed , for…
-
0
votes1
answer231
viewsLiquibase always running changesets
Hello, I have a problem running Liquibase with Maven + Spring Boot. The following occurs: I have two schemas, schema1 and schema2. In the project, I have 3 scripts in native SQL: first create the…
-
0
votes2
answers45
viewsContent of the array is not being printed, but reference to the object
Hello, I’m making an algorithm that prints only the repeating elements, e.g.: {2,2,3,4,5,5} -> {2,5} I don’t know if my algorithm is correct, but I can see the array itself, it appears something…
-
0
votes2
answers455
viewsRead a TXT file and put its content into a Linkedlist
I need to read a TXT file and add its contents to variables in a list. However, the file does not have the same amount of characters on all lines. In the input we have a sequence of two numbers in…
-
0
votes1
answer55
viewsauto-populated form with the remaining data from one of the selected fields
I wanted to have a dynamic form where the only thing asked is the selection of a user u from a list of users passed to the model from a controller, the email and status fields should be…
-
0
votes1
answer554
viewsHow do I get more memory to run the app?
I’m developing an app android Currently, when running the APP, it starts by reserving 36.62 MB of memory. I would like it to start over 50.00 MB or, when it reaches its limit, add more memory. Is…
-
0
votes1
answer25
viewsHow to initialize the sale id in print class?
I would like to receive the id of venda in the print class of the page, being that it comes null, and I am using it to compare with the idvenda with the parameter created in Jasper. html print.…
-
0
votes2
answers297
viewsCan I have performance problems joining multiple classes to a single file?
Watching many tutorials and video lessons, I always see that a java file is created for each action/class. As I indicate in the image below with arrow number 1 yellow. But as my app is getting huge,…
-
0
votes0
answers87
viewsPopular Jtable with BD data without using Defaulttablemodel
I’m doing a whole layered project and I read somewhere that the use of Defaulttablemodel is not very recommended. I am trying to receive values registered in the BD and fill a jTable with these…
-
0
votes1
answer72
viewsJava Server Application Client loops
I’m developing a system for school reinforcement simple functions. At the time I went to implement my class that makes the data encryption needed to change also the type of data that will traffic…
-
0
votes1
answer4499
viewsJava/JSTL - Table listing with c:foreach
I tried to list database information on a page JSP by means of the tag <c:forEach> but I’m not getting any return value. Bookoid: @Override public List<Livro> consultar() throws…
-
0
votes1
answer698
viewsHow to align Jbutton text to the left of the icon?
I need to align the text of JButton the left of the icon as I do? I tried to use the method button.setHorizontalAlignment(SwingConstants.LEFT); but this method does not align the text the way I want…
-
0
votes1
answer85
viewsJbutton’s actionperformed does not open the Frame before finishing all events
I have the following problem: By clicking on Jbutton I want to open a Waiting Frame that asks the user to wait a few moments and meanwhile the program will process the query methods that take some…
-
0
votes0
answers54
viewsCss file with image inside
Person I’m trying to set inside css an image, for this I’m using: body { margin: 0px; padding: 0px; background: #C0C4C5 url(images/page-body-bg.png) repeat; font-family: "Trebuchet MS", Arial,…
-
0
votes1
answer134
viewsRecyclerview with JSON analysis
My PHP code generates the following JSON: { "resposta":[ { "cd_servico":"1", "ds_servico":"NOME SERVICO", "ITEMS":[ { "ds_descricao1":"DESCRICAO SERVICO", "ds_descricao2":"DESCRICAO 2",…
-
0
votes1
answer545
viewsAccess image from Resources spring
I have the following scenario: I have the srping-Servlet.xml file with the following configuration: <beans xmlns="http://www.springframework.org/schema/beans"…
-
0
votes0
answers74
viewsError in converter for Selectmanycheckbox
I am making a Java web application and came across a problem in the converter to be used in selectmanycheckbox. The converter I made was this: @FacesConverter(forClass = Indicacao.class) public…
-
0
votes1
answer125
viewsPrimefaces inputText Ajax, returns value missing the last character
I’m having a problem using the ajax of primefaces, I also tried with the ajax of jsf. I have the following code snippet: <h:panelGroup> <p:inputText id="skuProduto" size="20" maxlength="20"…
-
0
votes1
answer89
viewsJava.lang.Nullpoinerexception when trying to insert database data into a Jcombobox
Today my team and I came across a problem trying to do something seemingly simple: display a clerk’s surname in a Jcombobox. The problem is that when opening the screen we receive a…
-
0
votes1
answer816
viewsHow to call method with the java array parameter?
I’m starting in java, I only had one class. So I’m making a program to add up the items in an array, and I have to use method. This is my code. Leading: package exercicio3e4; public class Principal…
-
0
votes1
answer115
viewsFirebase - Why it does not execute addOnCompleteListener code
How does addOnCompleteListener work, it is not a System that will be called when the signInWithEmailAndPassowrd operation is executed? It enters a correct login and password and click on the button…
-
0
votes2
answers78
viewsHow to simplify clicks on buttons in Java for Android?
I’m starting to have a lot of buttons in the same Activity and as much as they are simple commands, the code is getting big, and it will get even bigger. I wonder if there is a way to simplify by…
-
0
votes0
answers128
viewsAndroid - java.lang.Nullpointerexception
I’m making an application to send some characters by Bluetooth to an Arduino, however, I can not save the mac address of the module used. The mistake happens right here: EXTRA_ADDRESS =…
-
0
votes0
answers97
viewsIllegal use of <when>-style tag without <choose> as its direct Parent
I am developing a web application using jsp and Servlet page and I would like to show the data of my Servlet in two repeat structures one with the produots and the other with the plots but this…
-
0
votes1
answer49
viewssessionFactory null when trying to select in the database
Good morning,I’m using Spring and JSF. I wanted to query the database and return the data from a table, but in the method I do the search, when calling sessionFactory, it is null. I really couldn’t…
-
0
votes1
answer295
viewsEnum returns null from the database
Hello, I’m implementing a DAO and doing some tests, I’m having some problems in enums. When running the test class the Enum Size returns null, but in the database I have records filled correctly.…
-
0
votes1
answer410
viewsI can’t run script in the STS plugin in Eclipse
I added the STS plugin in the eclipse to create Spring-boot java projects, but when running the project it appears this error. Erro: Não foi possível localizar nem carregar a classe principal…
-
0
votes1
answer547
viewsProcessing decimal places Edittext
I need to set a number of decimals for a EditText on Android. For this I used a InputFilter as shown below: public NumeroFormatado(int digitsBeforeZero,int digitsAfterZero) {…
-
0
votes0
answers38
viewsProblems with Rest Java swing consumption?
I have a java swing application where I get a list of data from a webservice. When I run this by netbeans it does it right, now when I jar to send it to the client, the application just doesn’t make…
-
0
votes0
answers74
viewsError creating a Jsonobject object
I’m trying to create a WebService return to me one or more data from the database, using as return JSON. @Path("teste") @Produces(MediaType.APPLICATION_JSON) public JSONObject teste() { JSONObject…
-
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
votes2
answers487
viewsBreaking lines in a list from the bank
I have this Dao that does a search to the Sql Server Database public String nomeTabela() { String nomeData = ""; String nomeAlarme = ""; String nomeRecebe = ""; ConexaoDao conexao = new…
-
0
votes2
answers74
viewsVariables and if flow control structure in Java
The intended is for the user to enter 3 numbers and for the sentence to appear at the end "The highest value is X the middle value is Y and the lowest value is Z". Where X, Y and Z are the numbers…
javaasked 7 years, 8 months ago Yunrin 127 57 -
0
votes0
answers304
viewsJasper report only works in the local application, does not work on the Web Server
My print report is only working in the local application, using Hibernate connection, when I try to run on the server does not work due to lack of connection to the database, how can I use a…
-
0
votes1
answer637
viewsHow to create an Object Arraylist and iterate over it?
I need to create a ArrayList of this object, however within its own method, and have a method to return the array with the Iterator. I’m trying to do it this way, but nothing happens. MAIN.JAVA…
javaasked 7 years, 8 months ago Thiago Saad 1 -
0
votes2
answers49
viewsCorrect display of Radionbuttons
I’m trying to implement a JRadioButton but after entering the 2 in the form, only one is displayed, someone help please ? package com.roknauta.fasttracker.utils; import java.awt.Component; import…
-
0
votes2
answers146
viewsRemove accent on search using android searchview
I wish that when it was picked up on my listview João were shown João, Joao, joão, joao. I’m using a searchview, I read something about Normalizer but n understood very well. @Override public…
-
0
votes1
answer292
viewssetText method does not insert the text correctly within a repeat loop
I created a method that shows a loop of repetition, and inside it I keep setting the product of the variable by the counter, like a table and such. Only when it arrives in Textset, it does not show…
-
0
votes2
answers84
viewsData sent from one Activity to another arrives null
My Activity I’m displaying the database data in listview @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);…
-
0
votes1
answer296
viewsOpen pdf by URL and Inputstream Pdfview
I would like the user to enter the product code (at activity_main.xml) and click the button. The screen changes (view_pdf.xml), would make a PDF download (AnsyTask) and would open on PDFView for…
-
0
votes0
answers93
viewsEvidar the change of special characters in URI writing
I’m using the google maps API in my project but I’m having a small problem. to mount the URL I am using a URI that concatenates with buildUpon like this in the example below. Uri uriBase =…
-
0
votes1
answer194
viewsComparison of if-Else not continuing even with Else in Java
I have two variables: int trabalhadorFormal; int dispensadoIndireta; And I’m wearing them JOptionPane.showConfirmDialog to confirm as a kind of Boolean, yes or no, for the user. trabalhadorFormal =…
-
0
votes0
answers125
viewsSending byte[] socket data
I’ve had a problem for a few days that I can’t fix. I have a socket connection and I am testing signature on messages, I have an object Mensagem that contain String mensagem, String assinatura and…