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
answer116
viewsHow to access prop.getProperty from any Project Class
I created a class "Messages" and put the Method public Properties getProp() inside it, because I want to access the file config.properties from any other class of my project. /** * @author Alang *…
javaasked 7 years, 4 months ago Alan Goncalves 11 -
0
votes1
answer241
viewsTaglib - Condition test between JSP and MODEL
I am trying to make my JSP (index.jsp) execute a condition (if) with taglib, to decide which menu it will import, depending on an attribute (Boolean)) that is in the model (user.java). I have…
-
0
votes1
answer1097
viewsSet selected Combobox item as clicked on jTable
I am trying to fill in the form fields as per the item clicked on jTable. Text fields are normally filled in, but the combobox remains at the selected default value. //método que preenche a comboBox…
-
0
votes2
answers2265
viewsInsert data when creating Sqlite table
In my database I have a table State and Cities, I would like to enter this data once the app is installed, ie when creating the database these records are already inserted in the tables at once. I…
-
0
votes3
answers103
viewsWhy is this piece of code looping endlessly?
All variables are declared and Eclipse is pointing out no error in the entire code. What I need to do: The user can only choose between 1, 2 and 3. Any other input, including text (example: test)…
-
0
votes1
answer88
viewsOrderby does not work in java
I have the following structure: a contract, has several additives then I have my contract class and my additive class in contract class, I call it: @OneToMany(mappedBy = "contrato", fetch =…
-
0
votes1
answer489
viewsjava.lang.Runtimeexception: Parcel: Unable to marshal value
I have this error when I click on a Recyclerview item and pass an object through Intent, already implemented Serializable and it didn’t work @Override public void onBindViewHolder(final…
-
0
votes0
answers80
viewsUpload JPEG via JSON
I have a code that takes a photo from the gallery or makes you take a photo and would like help to send this image via JSON to my API, but I have no idea how to do this. My code: @Override public…
-
0
votes2
answers70
viewsSwitching from double parameters to Jasper report
I’m making a report that passes as parameters: Start date, end date and type (which may be: in, out or in and out). Everything works fine until I try to get the report that takes in and out... I’ve…
-
0
votes1
answer45
viewsmethod picking wrong value
Check it out, I got this boot on a datatable <p:commandButton id="prepDownloadAditivoNovo" style="float:left;" icon="ui-icon-arrowthickstop-1-s" value="Download" ajax="false"…
-
0
votes0
answers93
viewsCode to get the biggest number fucked up?
I created the code that is in the image to go through a double chained list and get the biggest token(No number), and sent the following entry(add at the end) : 12, 17, 14, 23, 8, 10. It should be…
javaasked 7 years, 4 months ago Carlos Alexandre 61 -
0
votes1
answer76
viewsIndexoutofbounds when filling an Abstracttablemodel
I have a AbstractTableModel who owns a List filled by a method that searches the data in the database. The method that fills the List has two overloads: one without any parameter (that searches all…
-
0
votes1
answer573
viewsAdding Financial Balance with Jtable
I’m trying to develop a sales control program in Java, but I have a problem when it comes to scheduling Jtable’s balance. As you can see in the image below, the balance is being updated per line.…
-
0
votes1
answer1381
viewsHow to print an Arraylist inside a Joptionpane?
Staff would like to know how to print an Arraylist inside a Joptionpane, I leave down the code I am using but not working: import java.util.ArrayList; import javax.swing.JOptionPane; public class…
-
0
votes1
answer623
viewsAlign JPANEL button
I want to align a single button to the Jpanel, but I’m not succeeding, using the default layout. public class Test extends JFrame { private JButton btn; private JPanel painel; private JScrollPane…
-
0
votes1
answer61
viewsnullException when setting database data as parameter
I am trying to bring the database data with this method of my DAO class: public List<Transacoes> listDBPF(){ Connection con = new ConnectionFactory().getConnection(); ResultSet res;…
-
0
votes1
answer1126
viewsHTTP Error Status 405 Servlet
I’ve been doing the "5.5 First Servlet" exercise of the Caelum FJ21 Java Web booklet, "http://localhost:8080/fj21-agenda/oi" to access the page occurs error: HTTP Status 405 - HTTP method GET is not…
-
0
votes1
answer345
viewsJava - Change XML and then read
I have an application that writes in an XML and one that reads, the two work well separately, but the problem is that when I write in XML, the other application keeps reading without updating the…
-
0
votes1
answer41
viewsError compiling code in eclipse
I have a small problem when compiling this code, after I compile the following error appears: Exception in thread "main" java.lang.Arrayindexoutofboundsexception: 10 I’ve searched elsewhere, and…
javaasked 7 years, 4 months ago italo vinicius 59 -
0
votes1
answer75
viewsScreen Registration - Repeat users
I have a post code, which makes the registration of my users, but they can repeat themselves, I would like help to realize a code so that users can not repeat, but I’m new to Android and do not know…
-
0
votes1
answer577
viewsWhy can’t I make the connection to Postgresql?
I’m very interested in programming but I’m new in the area and I need to give this work to the teacher. But I can’t solve this mistake. package dal; import java.sql.*; import…
-
0
votes1
answer1045
viewsConfigure Log4j appender to display in the log console from Error and save in logs file from Info
Good evening, everyone. I need to display in the console only logs from Error and write to file logs from Info. I’ve tried using the additivity property for false, but when using it the appender…
-
0
votes1
answer361
viewsJava - read XML from a URL
I have a function that reads XML and it works 100%, the problem is that when I try to read an XML that is online on my server I cannot. Follows code: public int lerXml() throws JDOMException,…
-
0
votes1
answer117
viewsWhich Demoiselle 3 dependency should be included in a Maven project for JSF use?
I have several applications built with Demoiselle 2.4.2+JSF+Primefaces+Hibernate and would like to advance to Demoiselle 3. On the portal dedicated to this version (http://demoiselle.io/) there is…
-
0
votes2
answers453
viewsInserting data using JPA
I need help saving the data of an application using JPA. I followed a tutorial that only helped in the implementation of login but did not show how to save the data. In this case, I am trying to…
-
0
votes1
answer64
viewsImage for Base64
I would like to turn an image to Base64, but it is not working properly, there is no error in logcat,anyone could help me? Code: private void galleryIntent() { Intent intent = new Intent();…
-
0
votes2
answers467
viewsCalculation of word similarity with Java
For two string A and B, we define the similarity of these strings is the length of the prefix that is common to both. For example, the similarity of strings abc and abd is 2, while the similarity of…
-
0
votes0
answers81
viewsListener for monetary mask and call method
I have a class to apply the monetary mask, I apply this class in editText Library. This being a field for discount I need him to do two things 1 - show the value formatted in our currency ex R$…
-
0
votes2
answers53
viewsHow is it possible to condition or check an item in a listview?
How to condition or check an item in a listview? I have an Array with some names, I would like to identify the name clicked so I could make a condition, for example I clicked on "Andrew Murray",…
-
0
votes1
answer349
viewsBuild List mapped with @Manytoone only with a few objects
It is possible to mount a list in a class with only a few objects? @NamedQuery(name = "Curso.Aprovados", query = "select cur from Classificacao cl JOIN cl.candidato ca JOIN ca.curso cur") public…
-
0
votes1
answer49
viewsHave more options in action_send dialog
I’m using the action_send, but it does not give me the options of Whatsapp, facebook, and other social networks. Only Gmail and Message. Code I’m using is: Intent share = new…
-
0
votes1
answer70
viewsGood practice passing arguments to a method when they come from another function
I came across a code similar to the following: private fazerAlgo(AlgumaCoisa algumaCoisa) { Utilidades.converter( formatador.formatarParaTal( algumaCoisa.a, algumaCoisa.b, algumaCoisa.c ) ) } At…
-
0
votes2
answers992
viewsCheck Internet Android
To check the internet connection I made the following method. public class ChecaInternet extends AsyncTask<Void, Void, Boolean> { @Override protected Boolean doInBackground(Void... params) {…
-
0
votes1
answer279
viewsHow to add an event to an icon?
I wanted to make it possible to open a screen, perform any action and so by clicking on an icon. I wanted to put different formats, so I don’t use one JButton. Because when passing the image to him,…
-
0
votes1
answer274
viewsHow to integrate CDI-Unit with Jersey Test Framework?
Hello. I am working on a Ws Rest with CDI and Jersey. I want to create a test unit with Junit and due to CDI ended up using the CDI-Unit Runner. I found CDI-Unit simpler than Weldjunit4runner. Now,…
-
0
votes0
answers143
viewsPosition of first element in Heap object
I’m in doubt about the priority line heap, with regard to inserting items in that list. Every heap starts by inserting from the element vetor[1]? Or you must insert from vetor[0]? 'Cause I got a…
-
0
votes1
answer241
viewsHow to share audio from raw internal directory?
I have several audios stored in the app’s raw directory and would like to share with other apps, such as Whatsapp, but I found very confusing the documentation on how to set up File Provider…
-
0
votes1
answer912
viewsHow to record a student’s grades using the List array
I need to add notes to certain students (each student has several grades and each grade belongs to a discipline), but as I am using Ist arrayand have little knowledge in java I am well lost in…
-
0
votes1
answer56
viewsJava Class and Variable Problem
I created a class, Inside it I need to call some methods but it has to be what is typed inside the Jtextpanel, someone knows how to do? This is my class Pick: public class Escolha { public static…
-
0
votes1
answer61
viewsSearch set of records by date
I am currently creating a Java/Mysql Desktop program. When inserting into the bank, the table is very simple: id - dataInserido - códigoProduto - qtd I would like, through an SQL, to group in…
-
0
votes1
answer40
viewsJsonexception error
My code makes a get via book ISBN : final Button btnBuscarCEP = (Button) findViewById(R.id.btnChamaBuscaCEP); final EditText editTextCep = (EditText) findViewById(R.id.edtCep);…
-
0
votes1
answer183
viewsHow to delete multiple lines in datatable
I am trying to delete several lines in my data table at once and get nullPointerException. I am sending the code Bean @Named @ViewScoped public class PesquisaFamiliasBean implements Serializable {…
-
0
votes1
answer462
viewsHow to store more than one value using Sharedpreferences?
I’m making an app where I created a checkbox to represent a favorite item. The problem I’m having is that when I put more than one item as a favorite, the last one replaces the first one, that is,…
-
0
votes2
answers1310
viewsSpring data JPA findOne() returns null
I am developing an application using Spring MVC, with spring data jpa in the persistence layer. When I try to do a search using the method findOne (or findById) returns always null. I already…
-
0
votes0
answers40
viewsWhy are you giving castException error?
The code below results in error Castexception. How can I fix this? private void popularTabela(){ ClienteDAO clidao = new ClienteDAO(); Cliente clienteFiltro = new Cliente(); Integer codigoPesq =…
javaasked 7 years, 4 months ago Henrique Rezende Bulla 1 -
0
votes1
answer460
viewsLabel update in loop
How do I update a label in a loop in the tab FXMLDocumentController? The Abels only update after it completes the entire loop and then plays the last info on the screen; package musicaisfx; import…
-
0
votes1
answer230
viewsHow to pass the name of Image Dynamically?
Hello, I’m learning now and I managed to make a Heads or Tails app with Success and decided to create another one based on it. This other app just click on the mainActivity button and it calls a…
-
0
votes0
answers102
viewsmy app stopped working from nothing this giving an error "Unfortunately app has stopped"
M app is working fine, then I turned on the pc and went to run it once more and this giving this error "Unfortunately app has stopped" I do not know what happened I will put the logcat here in case…
-
0
votes0
answers621
viewsSave current and end time to sqlite database
I am developing a project about home automation and at the moment when I click on the CONNECT button would realize the following functionalities: start device, start chronometer, save current time…
-
0
votes1
answer154
viewsApplication closes when I try to log in without filling in the fields
I’m developing an application, and I’m not getting the login screen to check if the fields are being filled in or if they have the wrong username and password. Follow the login code. It logs normal,…