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
answer112
viewsProblem printing PDF with iText
I have to print out a Jasper report with attachments, which are images and other Pdfs. My approach is to pass this pdf from Jasper to iText and then merge with the attachments. For the method that…
-
0
votes1
answer163
viewsFixture-Factory lib, Index 55663 out of Bounds for length 2187
I’m ultilizing the lib Fixture-Factory to create templates for my tests, but working with it, I got the following error! Index 55663 out of bounds for length 2187 those are my models: Cityprop:…
-
0
votes1
answer41
viewsHow to place an increment inside a FOR loop?
Please observe the code; BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(getArquivo()))); File arquivoLeitura = new File(getArquivo()); LineNumberReader…
-
0
votes1
answer148
viewsPair or odd loop does not show the expected result
public class ParImpar { public int totali; public int totalp; public ParImpar(int totali, int totalp) { this.totali = totali; this.totalp = totalp; } public static void main(String[] args) { new…
-
0
votes0
answers133
viewsSet @Bean Datasource at runtime in Java Spring Boot
In the Java with Spring Boot framework the @Bean are normally automatically set, including the DataSource which is the main issue, but also has as settar the @Bean manually by code in the case of…
-
0
votes1
answer340
viewsHistogram in Java
Hello, I need to transform an image into a pixel array. For example: Given the image "Netuno.jpeg", of 256 x 256 pixels, I need to allocate the value of pixels in that Matrix and print the amount…
-
0
votes1
answer164
viewsMultiplication between two vectors for a final sum in Java
I would like to perform a multiplication between two vectors, each with its corresponding, as I can illustrate below: i = [a1, a2, a3, ...] j = [b1, b2, b3, ...] I could end up with a third vector,…
javaasked 5 years, 11 months ago Sander dos Santos Zuchinalli 3 -
0
votes1
answer37
viewsError changing record in table
I can change manually, but in the error project.. The Error: Cannot add or update a child row: a foreign key constraint fails (sistema.veiculo, CONSTRAINTveiculo_ibfk_1FOREIGN KEY (fk_idassociado)…
-
0
votes1
answer42
viewsRepetitive array
Good morning guys, I am new here and new also in JAVA. I have a problem trying to solve it and I am not getting. When I run the program, the array within the open catalog method repeats countless…
javaasked 5 years, 11 months ago Arthur Bianchi Quiessi 13 -
0
votes2
answers47
viewsStore items in a cart
Good afternoon! Guys, I have a problem in my code where I have a method to open the catalog (open catalog) with some items and select the iens that I wish, but I can’t pass these selected items to…
javaasked 5 years, 11 months ago Arthur Quiessi 3 -
0
votes1
answer260
viewsRecyclerview click item 1 open Activity 1, click item 2 open Activity 2
public class ListAdapter extends RecyclerView.Adapter<ListAdapter.MyViewHolder> implements View.OnClickListener { private List<Categoria> categoriaList; private Context Context; public…
-
0
votes1
answer62
viewsDoubt Java Server Faces
I’m doing a JSF application, I have a Bean class that has a method. In this method I have a variable of type String and as the method is running, the variable is updating values. I wonder if it is…
-
0
votes1
answer1245
viewsHow to initialize an Arraylist in the constructor?
I have to develop a program in Java that will rent a library. In one part of the program I have to make a ArrayList of publications, follows the question: We must create a system for controlling…
-
0
votes2
answers644
viewsObservable List in a list View Javafx
I need help with a code, this code is just an example that I’m trying to implement, my idea is like a sales screen where I would be adding in List View products to be registered in a sale later, my…
-
0
votes1
answer241
viewsError in Java connection to Mysql Database
I am connecting a Java application to an SQL Database, I have the following connection code: Connectionfactory.java.: package connection; import java.sql.Connection; import java.sql.DriverManager;…
-
0
votes1
answer116
viewsAccess Poke api via java eclipse
I would like to create a java program (via eclipse), which can read a URL referring to the Pokeapi site, to 'access' the site and write all the JSON present in the URL. However, my next problem: I…
-
0
votes1
answer1140
viewsEdit Zebra ". lbl" Java printer file
I have a problem that is the following, I have a system where the user will upload a standard label, made in Zebra Designer (ex: etiqueta.lbl), for your products and according to the product that it…
-
0
votes1
answer348
viewsTry/catch on switch creating infinite loop on run
I’m also wanting to implement a try/catch within the while so that when a user enters a double with a dot instead of a comma, the program points the error and sends it back to code execution. But…
-
0
votes1
answer50
viewsHow do I add the "same" object to a list and change a property?
I have to send a list of entitys to a method that will make the Insert of these entitys in the bank. This entity represents an inscription of a patient who will enter some waiting queues of…
-
0
votes0
answers805
viewsorg.postgresql.util.Psqlexception: ERROR: Operator does not exist: bigint = bytea
I have a method that retrieves all paths from the appendices of a ledger, so the appendices can be printed. They are listed in a p:datatable within a dialog, but when opening the screen so that I…
-
0
votes1
answer68
viewsQuery in database returns incorrect data
Hello! I am making a query in the database and it is returning the incorrect data (as shown in the image). It is returning the class path within the package. Below is the code of the class (for…
javaasked 5 years, 11 months ago Lucas Verissimo 51 -
0
votes1
answer45
viewsHow to return the index of a java ARRAY
I have a little problem that I believe is logical but I can not solve. Let’s assume that, I wrote a little algorithm that creates 10 panels and puts them next to each other, as shown below. JPanel…
-
0
votes0
answers109
viewsVery slow Java SE application with remote Mysql BD, how to optimize?
Hello, people. I am developing a desktop application with Java SE and testing the software with a remote database it gets very slow, while with the local database it works normally. The following is…
-
0
votes1
answer428
viewsSign up for Spring Boot
Good afternoon, you guys. I’m having difficulties to implement my Register on Spring Boot. I’m willing to do the method in three ways(if,else if,else) that if it is all right to register, that if…
-
0
votes2
answers485
viewsParent class array with two different subclasses
I created a program for the following exercise: Exercise: Do a program to register customers from an accountant’s company. It is important to store customer information such as name, address, phone…
-
0
votes1
answer35
viewsProblem in a connection class
well I’m with this error in my connection class: Caused by: java.sql.SQLException: No suitable driver found for jdbc:mysql///helpsemeq I don’t know which part I got wrong in the code: package…
-
0
votes1
answer59
viewsDoubts when applying a DAO method
Well I have 2 classes the User class and the Request class my user class is like this: public class Usuario { private static Usuario instance; private Long id; private String login; private String…
-
0
votes1
answer233
viewsConnection app with firebase
Good afternoon, I have the following error in my logcat, when trying to register an email and password in firebase Authentication, where it jumps to my "Else" of "Alert" and soon after the error in…
-
0
votes1
answer45
viewsProblem with a method
good i have a method on the button to call my validation: public void valida2(){ String Login = jLogin.getText(), Senha=jSenha.getText(); Usuario u = new Usuario(Login,Senha); UsuarioDAO dao = new…
-
0
votes1
answer105
viewsImplementation of the Responseerrorhandler Interface (Spring)
Hello. I’m trying to override the Responseerrorhandler interface so I can return the entire request (status code, body etc.) in case of any answer other than 2xx. I noticed that the default Spring…
-
0
votes2
answers1327
viewsStreamcorruptedexception: invalid stream header
I have a JSF project, I use Netbeans. This function generates a Jasper report and was working normal, but after compiling the project started to release the exception…
-
0
votes1
answer95
viewsOperator ">" cannot be used comparing strings
import java.util.Scanner; public class ordenarNomes{ public static void main(String[] args) { Scanner in = new Scanner(System.in); String [] nomes = new String [20]; for(int…
-
0
votes1
answer142
viewsPass values from a Fragment to an Activity
I want to pass the value of an Edittext (which is in a Fragment) to an attribute of an Activity object, but I am not succeeding, Toast from Activity returns null. Follow the code of the Fragment:…
-
0
votes1
answer36
views"lazily" error in java web application
Good afternoon, I am developing a library web system, however, on the book page I can usually persist with the data, but when I try to edit them, the error occurs: "HTTP Status 500 - failed to…
-
0
votes1
answer104
viewsWhy does the getter return null?
In my android studio project I have a class of getters and setters to help me, but for some reason on main Activity when I call the db.busca() (which is in the database operations class) which…
-
0
votes3
answers229
viewsUpload with Thymeleaf
Good afternoon, you guys, I am with a difficulty, I am developing a simple system, it reads a csv file and imports to a database, I risked using Thymeleaf, I found some tutorials but I could not…
-
0
votes3
answers140
viewsJPA+Hibernate: Error removing from an entity
I’m getting this Exception while doing the remove, already broke my head looking for what and Exception in thread "main" java.lang.Runtimeexception: Error Interpreting query [delete from Book Where…
-
0
votes1
answer79
viewsWhy is the class expected error?
I am programming in Java in Android Studio and there is an error .class expected: package com.example.equacaodosegundograu; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle;…
-
0
votes1
answer92
viewsError starting JSF application in Apache - CDI Beanmanager instance is not available in JNDI
I have a JSF + Primefaces application that runs smoothly in the development environment. But when it comes to deploying . War in Tomcat, in production, I can’t. The error in the logs is:…
-
0
votes0
answers53
viewsLeaving a Hidden table using javascript, primefaces and JSF
I have a screen that asks for cnjp, dtini and dtfim, status and a query button. In javascript, the query function calls another function that validates the fields. If the fields are ok, a table with…
-
0
votes2
answers171
viewsListeners from firebase database does not run and does not retrieve data, write - java server desktop
There are a few days I’m trying to understand what is happening with my code that I should write and read in Firebase Realtime Database, but without success and there is no apparent problem, error,…
java firebase-database desktop-application realtime-databaseasked 5 years, 10 months ago Wellington DC 1 -
0
votes1
answer21
viewsAdd first item to Jcombobox
I’m filling my Jcombobox like this: private void preencherCombo( ){ jComboEstado.removeAllItems(); List<Estado> lista = ec.listaObj(""); jComboEstado.addItem("Selecione um estado"); for(…
-
0
votes1
answer27
viewsHow to inform columns with contiguous positions?
The method needs to return the lines that has given number of adjoining armchairs of a sector, I tried as follows(I could not do functional): public String buscaContigua(int s, int c){ String msg =…
javaasked 5 years, 10 months ago Mateus José da Silva Monteiro 1 -
0
votes2
answers280
viewsInfinite loop when reading integers with Scanner
I’m trying to treat an exception within a repeating structure for, but I am having difficulties, because the catch is not returning to the for, and by typing an invalid value, it is in an infinite…
-
0
votes1
answer34
viewsError while getting Bytearray from.3gp file on Android/Java
I am trying to convert a file from audio.3gp for string Base64 and send to the server using Volley, but for all I know, I need to transform the audio.3gp in Bytearray and transform that array string…
-
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
votes2
answers55
viewsMethod returning Nullpointerexception (JAVA)
I’m doing an object-oriented exercise, I have a Car object and a Driver object, when I try to assign String name to one of the objects this returning me a Null public class Motorista { String nome;…
-
0
votes2
answers162
viewsPRIMARY KEY AUTOINCREMENT - Android Studio Error
I’m trying to insert records with auto increment, but every time I get failure return. But if it’s auto increment he shouldn’t ask me for the fifth record? Database code: database1.execSQL("CREATE…
-
0
votes2
answers34
viewsjTable does not add the second string I put in an array
I created an array with two values and wanted to put it in a table... with an insert button (insert several lines) 1-I declared the string line[] and the values below; 2- I thought a 'for each'…
-
0
votes1
answer23
viewsPopular combobox with a list of a query
Well I have a DAO class Departamentosdao I wanted to popular a combo box with a consultation I do in this DAO my DAO: public class DepartamentoDAO { private Connection con; public DepartamentoDAO()…