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
-
-1
votes1
answer24
viewsCheck for Firebase node
Good afternoon, I am checking if there is a node in Firebase, if it exists I will just increment the value on that node, but when it does not exist I will create the node, but Else is not working.…
-
-1
votes1
answer63
viewsLimit the number of decimals - JAVA
Hello! I just started programming and I’m learning java. I’m trying to make my first app, which calculates the rule of three. I managed to make it work, but I had to transform the result of the…
-
-1
votes1
answer25
viewsValue returns only true in JUNIT4
I’m trying to do a shooting sport procedure, at the time I will test, every time changing "posso_shoot.setIdentificar_target(1);", when the value and 1 returns true, that’s what I want, but when I…
-
-1
votes1
answer21
viewsReading from java csv
Well I need to do a college job, where I have to read a csv and print your data on the screen. I am using the split method to store the line information in a String vector, and then Seto all the…
javaasked 3 years, 11 months ago vitor sousa 1 -
-1
votes1
answer19
viewsArraylist of another class does not print elements
I have a main class and another class, basically I have to read a CSV file in which the first line will have the materials of a student (matematica, portugues etc). The number of materials is N can…
-
-1
votes1
answer49
viewsDoubt in Try-catch & vector JAVA
I have the following question: 2. Declare a vector of four positions of the whole data type, the software must remain asking the user to enter a value, until it enters four valid values, the valid…
-
-1
votes2
answers361
viewsMaven POM.xml file starting with Eclipse error
Hello, I’m new to the Java world and have been facing several problems to create a Maven project with the eclipse. Below I’ll put the bug, followed by my Maven file and the description of the…
-
-1
votes1
answer14
viewsClassnotfoundexception in Java mockite testing
Hello, When testing a class using Mockito, I came across the "Classnotfoundexception" error. Unfortunately I cannot resolve this error. All my dependencies are installed, but the error persists.…
-
-1
votes1
answer28
viewsSpring: how Jackson can format a composite Json response into objects
Well, I’m doing a Spring project along with Spring-cloud-openFeign for integration with a Fipe api to access car values. See the class: @Service @FeignClient(name = "FipeService", url =…
-
-1
votes1
answer35
viewsTable does not display data
The table doesn’t show the data, but I’ve been going over it for four hours and I don’t think anything’s wrong package dao; import Connection.Conexao; import java.sql.Connection; import…
-
-1
votes1
answer28
viewsProblems with Creating New Java Projects in Netbeans
The options for creating a new java project do not show the 'Java' option itself. The first option is Java Whith Maven as you can see. Among the available options or select Java Whith Maven the…
-
-1
votes1
answer23
viewsValueless results on variables, values added in Testemain class are not being used in Calculator class methods
public class Calculadora { public float valor1; public float valor2; public float valor3; public Calculadora(float valor1) { } public Calculadora(float valor1, float valor2){ } public…
-
-1
votes1
answer12
viewsError Inserting icon in Jmenu
Good Morning to all, I’m with a java project using Netbeans IDE 12.0, when trying to insert images as icon in the Item Menu and running the form introduces me to Exception nullpointerexception,…
-
-1
votes1
answer30
viewsPersist entity history (objects) using Mongodb
I have the following entity (decreased from the actual entity): @Entity @SequenceGenerator(name = "produtoSequence", sequenceName = "sequenceproduto") public class Produto { @Id…
-
-1
votes3
answers106
viewsHow to pass a string to two whole types?
I’m doing an exercise where the program receives as input a "String" with two values , and in the end I need to put these two values into integer variables and carry out the sum of them. I…
javaasked 3 years, 10 months ago CESAR AUGUSTO CARDOSO 13 -
-1
votes1
answer33
viewsHow to remove field to field from a String starting from left and bounded by a size desired by the user
package teste; public class RemoverStringAEsquerda { public static String removerCampoAEsquerda(String value, int tamanhoMaximoString) { int i = 0; while (value.length() >= tamanhoMaximoString){…
-
-1
votes1
answer24
viewsHow to show a message when no jradiobutton is selected?
I am doing a java swing exercise that contains the following screen with Jradiobuttons: When "java swing" is selected it should show a message by clicking on Jbutton and vice versa with the second…
-
-1
votes1
answer41
viewsHTML in Spring Boot does not find files
I’m trying to load an audio file into an html, like this When I open html in the browser it loads normally However when I do the same I start the spring application, html does not load the file and…
-
-1
votes1
answer27
viewsGet a list of objects with custom message (Spring Boot)
At the moment I can return the list of objects (products). I would like to show the information of each object with a formatted text, for example: O produto (nome_produto) tem o preço…
-
-1
votes1
answer34
viewsManual Spring Boot Paging with Criteria
Hello, I am maintaining a code that should make a pagination using criteria put in the parameters of the method informs that pageable has never been used and I do not know how to implement it.…
-
-1
votes1
answer91
viewsHow to validate Date type with Springboot validation bean?
Gentlemen, I would like to know from you, how are you validating Date type fields in Spring-boot with Bean Validation? I used the note @DateTimeFormat but I did not get the expected return, and the…
-
-1
votes1
answer12
viewsTake the object from the list or make a new select in the database?
I have a Controller that the first thing he does is bring a list of objects from the bank. After clicking on one of the buttons, the customer will use one of the items in the list. My question is…
-
-1
votes1
answer42
viewsHow do I add a value that I calculated from an informed data that appears in a new Textview?
I need to calculate the maximum heart rate from the age informed by the user (fcm = 220 - age). I created the fields to capture the name and age, but I can’t make the calculated fcm appear on the…
-
-1
votes1
answer28
viewsExclusion of related tables
Good morning, I am trying to delete my user class but am having the following error "Cannot delete or update a Parent Row: a Foreign key Constraint fails (pitangdb.phone, CONSTRAINT…
-
-1
votes1
answer16
viewsError using Gradle distribution
I’m starting out in the groovy world with Grails. Running the command 'dbm-update' (to update with bd on my machine and the Migration etc) causes this build error. I know almost nothing of java. (…
-
-1
votes1
answer71
viewsRead a txt file and add to a double-chained java list
I’m very beginner in programming and I’m coding this program for a college job. I need to read the data of a txt file with the following fields (title, style, actor, producer, synopsis, path) and…
-
-1
votes1
answer23
viewsHow to save a photo by creating a file with another name instead of replacing the previous file?
Hello, good afternoon! I’m having trouble saving the photo, because when you save it replaces, instead of creating another with another name: package com.pesquisa.pesquisacenso.view; import…
-
-1
votes1
answer29
viewsHow do I take a Long value in an Edittext and insert it into Firebase?(Android Studio)
I need to take a long value and insert it into Firebase and then show it in a Listview. I created a Pessoa class and with the other attributes I was able to insert and show it in a good one. Only…
-
-1
votes2
answers70
viewsError "cannot find Symbol" when creating an object
I’m trying to instantiate a new "Pen" object in the main class, but it’s giving an error: "Cannot find Symbol". Main class(Aula02): //pasta em que o código está inserido package aula02; //a classe…
javaasked 3 years, 8 months ago David Freitas 11 -
-1
votes0
answers24
viewsUpdate Mysql Java Problem | Error: Exception in thread "AWT-Eventqueue-0" java.lang.Nullpointerexception
Hello, I am Java developer, I am developing a program with mysql and java swing. And in my update code, is showing the following error: Exception in thread "AWT-Eventqueue-0"…
-
-1
votes2
answers42
viewsProblem searching for BD - JSF specific columns
When I return all the values of the bank, it works. However, I look only at the columns id, celular, cpf, nome, status to list in the table, returns error. Would be the type of return that is wrong?…
-
-1
votes0
answers26
viewsHow to resize swing and javafx "blocks" sizes in Intellij?
Hello, I’m learning Java and there are some classes that ask for swing and javafx, until then ok. But on the teacher’s screen, videos on Youtube that I saw, they add a button for example, and manage…
-
-1
votes0
answers18
viewsError HTTP 404 - The requested Resource is not available How to resolve?
Hello, guys, sorry to bother you, but I’ve searched a lot about this problem in forums and videos, including in English, but I couldn’t solve it. I followed the steps of this tutorial:…
-
-1
votes0
answers13
viewsShared Preferences does not work
I’m making an application where in the database makes a summation, along with an innerjoin After running this selection, I want it to save the values in a Shared preferences. But always when I try…
-
-1
votes0
answers25
viewsEquality Operator error != in Java
Good morning, I was training in Java and was building a form so I made a way that if the person enters an invalid data will run a do while with the same question (I don’t know if this is the right…
-
-1
votes1
answer22
viewsJavascript Does not execute . click correctly with JSF
The script works partially, it updates the page after 5 sec., however it does not perform the click on the button: <script> $(document).ready(function() { setInterval(function() {…
-
-1
votes0
answers42
viewsJAVA I created a vector union algorithm, but it is returning the values of its union = 0
package EstruturaDeDados; import java.util.Arrays; import java.util.Scanner; public class testes { public static void main(String[] args) { Scanner ler = new Scanner(System.in); String repetir =…
-
-1
votes0
answers10
viewsLogin AD Java 8
I am trying to log on to the ad, but soon on the Admim user already error 502e. But user and password are correct, which may be wrong here @PostMapping("loginJndi") public logonModel…
-
-1
votes0
answers31
viewsDoubt on how to return an object from a method and use it in another class
I’m doubting how to generate an object in a way. I wanted to return the values that are inside the red box, to fill an array with each object of this method. The exit would stay inside the main: My…
-
-1
votes0
answers37
viewsHow to encrypt String in C# and decrypt in Java
I am working on an embedded system where messages are encrypted with C# and need to be decrypted in a system made in Java. Code in C#: public static string Encrypt(string input) { byte[]…
-
-1
votes3
answers25
viewsHow to create a button to add one more to the editText value?
I’d like a little support from you... I’m trying to add a button to subtract and include the amount of items... Look at my code... I’ve tried some ways, but without success. It has to be through…
-
-1
votes0
answers12
viewsJava Dao class showing the following error:The Resource type Connection does not implement java.lang.Autocloseable
The error is being presented where I perform Try try (Connection connection = getConnection(); And consequently, my Preparedstatement says that the Connection type is not visible in that line:…
-
-1
votes0
answers4
viewsFilter between dates shows no result in Jtable
Good night, I’m trying to make a filter between dates Being: txtDataFinal and txtDataFinal doesn’t show anything to jtable anyone could help me, please. private void…
javaasked 3 years, 7 months ago Adailton Cardoso 1 -
-1
votes0
answers12
viewsCamera and Gallery image not saved
I wrote a code in Android Studio java, SQLITE with image gallery and camera using the SAMSUNG A5 2017 as emulator. When running all fields were saved normally. I switched to the GALAXY S20 FE. When…
-
-1
votes1
answer37
viewsI need to check that the item does not exist before adding it to Arraylist
switch (menuCad) { case 1: do { System.out.print("Digite o nome: "); String nomeProd = Stringentrada.nextLine(); System.out.print("Digite o preço: "); double precoProd = entrada.nextDouble();…
-
-1
votes0
answers21
viewsI am conducting a CRUD project, with JAVA, Spring boot, Thymeleaf and JPA technologies. What happens
I am conducting a CRUD project, with JAVA, Spring boot, Thymeleaf and JPA technologies. What happens here is that I am trying to get information from the bank to perform an update/edition on people…
-
-1
votes0
answers17
viewsError sending Java android notification
I’m trying to send notification on an android app. However, when I click the button to call the method, nothing happens, no error. Follows code: PERMISSION IN THE MANIFESTO: <uses-permission…
-
-1
votes0
answers17
viewsUnknown class file Constant tag <18> in Constant pool
I am running a. java file (in Eclipse) that loads some .class. When I tried, this error occurred: Exception while reading file:…
-
-1
votes0
answers14
viewsJackson XML serialization with the root tag for an abstract class
I have an application and need to serialize an XML with different tags at the root. I implemented a test case with the following password, through the same input I can insert two types of XML…
-
-1
votes0
answers9
viewshow to load database data on jsp jstl screen
ola have a jsp and jstl screen on the java system, on this screen loads database data by select, screen codico: <%@ page language="java" contentType="text/html; charset=ISO-8859-1"…