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
votes2
answers378
viewsSocket between 2 devices
I would like to send data between different machines, between two computers, between a computer and a Android for example. I did the example internally, on the same computer, but when I separate…
-
0
votes0
answers36
viewsCode in android studio closes before finishing
The code in android studio closes before finishing. I’m a beginner, so I don’t know where the problem is, but the program must be to multiply one value entered by the percentage of another chosen.…
-
0
votes3
answers985
viewsStore multiple numbers in a variable and then print and show the sum
I need to do a show that does the following : • Start with an integer N • If N is even, divide by 2; • If N is odd, multiply by 3 and add 1; • Repeat this new process with the new value of N, if N…
javaasked 6 years, 8 months ago João Eduardo 9 -
0
votes1
answer497
viewsHow to get the value of a Jspinner inside a loop?
I am mounting a screen where products are displayed from a database: product title, price, button and a spinner. I try to give a jspinner getValue, but it does not return the value that the user…
-
0
votes1
answer523
viewsSearching in depth using a stack
I’m trying to do an in-depth search using a stack, but it’s making a mistake on a if and I don’t know why. package Grafos; import java.io.*; import java.util.*; public class Grafo {…
-
0
votes1
answer51
viewsAsynctask in infinite loop when using Wallpapermananger
My app strangely runs around in an infinite loop uncontrollably. It’s a simple code to download an image and apply as wallpaper. But when removing this line of code, the loop goes away, that is to…
-
0
votes0
answers172
viewsConduct research in jTable
I’m conducting a survey in my jTable, but when performing the research, the jTable displayed only content similar to my search. I would like to conduct a search on jTable without inhibiting all…
-
0
votes1
answer544
viewsSimple Chained List
I’m having trouble removing an item at the end of the list Defining the knot: class Node { Node proximo; int chave; Node(int chave) { this.chave = chave; } } Simple Chained List: class ListaLigada {…
-
0
votes1
answer39
viewsjavax.net.ssl.Sslexception when sending mail using Javamail
Good morning. I’m having trouble sending an email using Javamail. Returns the following exception: (javax.mail.SendFailedException)javax.mail.SendFailedException: Sending failed; nested exception…
-
0
votes1
answer298
viewsHow does it work to put dynamic content by making an Android app natively?
Guys, I’m seeing a little bit of mobile development (Android), and I saw that the design is done using XML, and from what I saw, it seems to have no loop tag, to repeat similar structures, and…
-
0
votes3
answers70
viewsError Code: 401() when sending FCM notification using a server
I’m having trouble sending notification using Firebase Cloud Messaging on Android. I’m using the method below: public void enviaNotificacao(String mensagem, Pedido pedido, String token) { Sender…
-
0
votes1
answer232
viewsWhat does the addViewControllers method of the Webmvcconfigurer Spring boot class do?
I am using Thymeleaf on the front end of the application and have the following configuration class, with the addViewControllers method in question : @Configuration public class WebConfig implements…
-
0
votes0
answers21
viewsI would like to display a div or entire site without the search bar within the app
I would like to display a div or entire site without the search bar within the app. I found no answer on any site. This code opens the site, but opens with bars with everything. My Code is like…
-
0
votes0
answers57
viewsErrors using Vert. X
C:\Unky\Web\BloodStrikeServer-master>java -cp classpath/commons.jar;classpath/fl ex-com.jar;classpath/flex-cor.jar;classpath/junit.jar;classpath/link.jar;classpa…
-
0
votes1
answer41
viewsDisplay only results that satisfy the condition within the loop
I’m building a little algorithm that runs through a ArrayList and compares the value found with a value typed by the user. But I want to print on the screen only the value that satisfies the…
-
0
votes1
answer183
viewsProblem to add at the end of a Simple Chained List
I have a simple chained list and need to do a recursive function that adds at the end of the list an element, I already have the function without recursiveness, but the with recursiveness is giving…
-
0
votes0
answers81
viewsRead json with gson
I would like to read the JSON below with GSON, put each line in a POJO and add in one ArrayList. But I can’t read JSON.…
-
0
votes1
answer119
viewsHelp with foreach on jsp
I’m trying to make an if in a jsp file, but I can’t print out all the values that are in the products table. For some reason my code only prints the first product and in the table I have 3 products.…
-
0
votes1
answer122
viewsHow to count how many occurrences of an attribute in a list are equal to a value? JSF
I need to count how many status equals '1'. I used this to count how many objects I had in the list and it worked. Now I can’t count only those who have status equal to 1. <h:outputText…
-
0
votes1
answer167
viewsHow to get out of Joptionpane without closing the Main window?
I’m trying to create a program in Java Agenda, but when I leave the JOptionPane configuring the Agenda Owner name, called from the main window, the entire application is closed. String nome = "";…
-
0
votes1
answer51
viewsProblem Related to graphs
I’m making this issue in the URI Online Judge. I’m trying with DFS, but until now I got nothing. I put a variable to mark up to the level she goes and when she gets to this level she comes back, but…
-
0
votes1
answer150
viewsGenerate file . jar in Eclipse with Maven, application connects to Mysql
I am using Eclipse and have an application made using Maven that connects to the Mysql database. I can generate the file .jar, but when I run, it simply hangs on the login screen, it doesn’t seem to…
-
0
votes1
answer219
viewsAndroid IMEI: all android versions
The methods below are not effective to capture the IMEI of all Android versions. private String getIMEINumber() { String IMEINumber = ""; if (ActivityCompat.checkSelfPermission(this,…
-
0
votes1
answer93
viewsCounter (Transaction) in firebase fatal error
Guys I’m trying to make an accountant, in fact I’ve used this idea to tell in firebase, which is a correct and safe way to make a counter for firebase. MutableData mData; //Contador +1 ao Firebase…
-
0
votes0
answers299
viewsHelp with Fraction with java
I want to make the following algorithm: 300/15 + 350/14 - 400/13 + 450/12 - ..... That is, when the denominator is odd it adds up to the next result, if it is even it decreases. Here’s my code, but…
javaasked 6 years, 8 months ago Vitor Giovanny 109 -
0
votes2
answers152
viewsHow to recover the second text in a validation with Assertequals
I have that code: And I’m trying to retrieve the text "Test Automation". then I made the following code. WebElement idMenu = navegador.findElement(By.id("dropdown-menu-profile")); String…
-
0
votes1
answer149
viewsDoesn’t show the right way out
I believe I may be the result of my ordination that is influencing the output, eg if it was 6 8 10 should show RECTANGULAR TRIANGLE but is showing ACUTANGULO TRIANGLE. The code I made at the end of…
javaasked 6 years, 8 months ago Andre Viana 15 -
0
votes1
answer80
viewsNormal and long click only work after a first click on Imageview
I am with a problem that when I click on the image, the first time nothing happens, only after the first click it works simple click function and long click. XML code: <ImageView…
-
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
answer157
viewsSum result redirect in JSP Servlet
I need to show the result of a sum on a redirected page, I tried a "setAttribute" after "Redirect" but it doesn’t work. The sum value would have to go to an "input" on the next page, or on an…
-
0
votes0
answers58
viewsI’m trying to list a client’s orders but there’s an error in the DAO that I can’t identify
Button calling the page listing requests: <p:commandButton value="Avançar" id="avancar" action="#{clienteMB.avancarPedido(pedido)}" styleClass="ui-priority-primary" ajax="false"/> Method…
-
0
votes0
answers48
viewsHow do I insert data into the database in real time?
I have an application that consumes data from a network server, follows my code: conn.setRequestMethod("GET"); conn.setRequestProperty("Authorization", "Basic " + asB64);…
-
0
votes0
answers322
viewsjavax.servlet.Servletexception
I’m doing a basic user registration with Servlet. When I click on the sign up button I get the following error page (everything has been revised and is in perfect working, I believe it is something…
-
0
votes0
answers36
viewsError deploying a java application with postgres
Expensive. I created a small web application using postgres. However, when I run the eclipse, it runs smoothly. But when I export the file. War and try to deploy on Tomcat server, it returns me the…
-
0
votes0
answers143
viewsI cannot get the image URL from a JSON file, although it is done in the same way as other data that is obtained correctly
I’m developing an app based on another app, in case the app is a map (provided by Google Maps Apis) where points are added map and can be clicked to display more information about the location, this…
-
0
votes1
answer151
viewsListview with JSON + PHP
I want you to appear in one ListView all the information of a select I gave. I can do only with txt by displaying information: public void sendjsonrequest() { JsonObjectRequest jsonObjectRequest =…
-
0
votes1
answer51
viewsJPQL Order by and LIMIT (JSF and JPA)
I’m having trouble solving a query with JPQL. Query I need to work: SELECT * from tab_historico WHERE idPolicial = 1 ORDER BY idhistorico DESC LIMIT 1 My DAO that is wrong, where I need to place the…
-
0
votes1
answer49
viewsAbout Activities in Android/Java
Good night. My doubt is simple. My app has a system where I open 5 activities for registration (first Activity 1, then 2 and so on. imagine it is something like a windows installation where you have…
-
0
votes1
answer43
viewsJasper Report Not Opening Report
I have a problem with a report generated by the Jasper Report. I created a screen with parameters of the report that when pressing the button calls the method below. public void imprimir() { try {…
-
0
votes1
answer36
viewsFile sent to firebase has 0Bytes
I have a problem, I can send the pdf to the Storage, but it is coming there with 0Bytes. there is the code, and does not generate error, I believe I am not sending any file, but within this…
-
0
votes0
answers676
viewsuses or overrides a deprecated API Recompile with -Xlint:deprecation for Details
C: Users Danil Androidstudioprojects Applicationthe main java src app Danilo cursoandroid with Welcomeactivity application.java: uses or overrides a deprecated API. Recompile with -Xlint:deprecation…
-
0
votes1
answer33
viewsList totaling error using Hash Map
I sort a list in a certain order, then create a Map to total that list by grouping by a key. What happens is that sometimes the values are ignored generating a difference in the total. And I can’t…
-
0
votes1
answer576
viewsCompare lines between. txt files
Good afternoon, I need to compare two files .txt and check that each character is equal to the other file and store which characters are equal... Type a template an archive prova.txt has the…
javaasked 6 years, 7 months ago Gabriel Ramos 1 -
0
votes1
answer102
viewsI cannot "recover" the Realtime Database (Firebase) value
I’m trying this, but it always appears that the app has stopped working. public class TesteActivity extends AppCompatActivity { private TextView la; @Override protected void onCreate(Bundle…
-
0
votes0
answers175
viewsError when creating tables with relation and JPA
Good morning, I’m trying to create two tables with flyway+Spring+Sqlserver+JPA, very simple thing just to pass the time and I’m having an error that I can’t understand because running the same…
-
0
votes0
answers37
viewsMusic information
I’m making a music player and appeared a difficulty to capture the information of the songs. I’m using a Contentresolver and a Cursor to search for songs in the device’s memory. The information such…
-
0
votes1
answer154
viewsAndroid - How to detect which is the current fragment?
Hello, I have an application that uses the fragments system and a Floatactionbutton, in one of the fragments I have an ad banner right under the Floatactionbutton, I did it the way below, but it…
-
0
votes1
answer178
viewsHow do I set the call timeout of an EJB function?
At the end of a service my project has a function that takes an EJB from another project that is installed on the same server, and accesses one of its functions. My function that takes the EJB and…
-
0
votes2
answers1529
viewsError - to create query for method public Abstract org.springframework.data.domain.Page
I’ve been line by line to find out what’s different between an object that’s worked and what’s going wrong and I can’t find the problem. This Student object is giving error. If I comment the get…
-
0
votes1
answer180
viewsTake parameters from a Recyclerview
I’m developing an APP where shows the user the activities to be done in a RecyclerView. If he wants details of the activity he can click and see more as description, name and etc. Now I have the…