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
-
2
votes3
answers446
viewsSum of component numbers
I’m trying to solve the following problem using DESVIO CONDICIONAL COMPOSTO. I can’t imagine how I calculate the numbers that make up the digit Request an integer value from the user between 100 and…
-
2
votes1
answer193
viewsInstantiate a Map object only when necessary based on a regex
I have a Factory what instance the PARSER responsible for extracting information from a particular invoice format. To determine the invoice format I use regex. I loop every regex added to Map and…
-
2
votes1
answer2791
viewsCheck if date is between two dates in the 30 min range
I have a service that before saving some value in the bank, it is necessary to be checked if it is within some period already saved in the bank. Each period consists of half an hour. ex: 10:00 10:30…
-
2
votes1
answer214
viewsHow to delete a node in a chained list in Java?
I have the following java code but it’s not working properly. I need to delete a node from a chained list. Someone help me? /* Delete Node at a given position in a linked list head pointer input…
-
2
votes2
answers1331
viewsHow to change the vertical grid line size of a Jtable?
How do I change the size of the vertical grid lines of a Jtable? Ex: jTable.setRowHeight(30); This method above changes the line width. Have some other similar to this which changes the vertical…
-
2
votes1
answer1361
viewsRepository not found when starting Springboot
I am running my spring boot project with mysql connection and is giving the following failure: Description: Field er in com.eventoapp.controllers.Eventocontroller required a bean of type…
-
2
votes1
answer201
viewsError while deleting data in Mysql by Java
In the database I have three tables, where one of them keeps the foreign keys. Error made: Error: com.mysql.jdbc.exceptions.jdbc4.Mysqlintegrityconstraintviolationexception: Cannot delete or update…
-
2
votes1
answer343
viewsFile reading in the IDE works and at the time it generates the . jar does not work
I have an application that reads a text file that is in the same folder where the application is. When I run the program in netbeans it reads the normal file: But when I Gero the JAR it does not…
-
2
votes1
answer67
viewsUnstacking can’t return an empty element?
Code taken from a Data Structure booklet. public class PilhaContig { private Item [] info; private int topo; public PilhaContig(int qte){ this.topo = 0; this.info = new Item [qte]; } public Item…
-
2
votes0
answers94
viewsA help with Spring Boot Annotations
A help with Annotations ... Today my tests are like this : @ConfigA @ConfigB @ConfigC @ConfigD public class MeuTesteA {} @ConfigA @ConfigB @ConfigC @ConfigD public class MeuTesteB {} See, I have to…
-
2
votes0
answers70
viewsHow to change the @Generatedvalue used by Spring through Spring’s Abstractpersistable class?
I’d like to use the @GeneratedValue(strategy = GenerationType.SEQUENCE, ... ... when extending the class AbstractPersistable, but I don’t know if that’s possible. From what I saw in the…
-
2
votes1
answer967
viewsJava socket that sends and receives
I’m doing a college project and I’m using an ESP8266 microcontroller. At first, I wanted to create a Socketserver and a Socketclient in Java, which would be able to both receive messages and send to…
-
2
votes1
answer163
viewsHow to configure the Auditor using Spring Boot 2.0.2
Here’s a class I used with spring framework version 4.3.4.RELEASE (I still didn’t use spring boot) and that worked: import org.springframework.data.domain.AuditorAware; import…
-
2
votes1
answer779
viewsJAVA - Creating an instance of an object in a class?
So, I have a class called "Geraform" that I need to return a HTML-style string with some information contained in an annotation. I got the code to work when I pass a certain class to it, but I would…
-
2
votes1
answer305
viewsHow to convert Object to byte[] and the reverse?
I need to send a file over an udp connection to a college paper. I created a package class that contains the header and part of the file to be sent. I did the following method to convert the object…
javaasked 6 years, 6 months ago Rodrigo Lima 21 -
2
votes1
answer865
viewsMethod to Invert a Single Chained List
How to make the method ImprimirLista() print the inverted list. Exemplo [1][2][3] Imprimir [3][2][1] Edit 1 I can’t use Collections public class ListaEncadeada { No primeiro,ultimo; int totalNos;…
-
2
votes2
answers1214
viewsUse of A1 digital certificate installed on the server
I work with the development of a Java web application for managing electronic medical records, in which it is necessary to sign XML documents digitally. This application is used by more than 200…
-
2
votes1
answer60
viewsYou’re not creating with "persist"
SEVERE: Servlet.service() for servlet [Spring MVC Dispatcher Servlet] in context with path [/cq] threw exception [Request processing failed; nested exception is…
-
2
votes1
answer1226
viewsDoubt about Recursiveness in a Power Method
I didn’t understand how recursion works in the method that performs potentiation. public class calculaPotencia { static Scanner scan = new Scanner(System.in); public static void main(String[] args)…
-
2
votes1
answer1864
viewsDownload multiple Amazon S3 files
Situation I have hundreds (and even thousands) of small files (~50KB) on Amazon S3 separated into Buckets per day. Problem I need to download through my Java application delivering to the front end…
-
2
votes1
answer63
viewsAccess data from a class
I’m developing a graph generator to monitor the navigation of a robot. The coordinates the robot passes through are stored in a txt file, with each line having a latitude and a longitude, as…
-
2
votes1
answer1893
viewsDoubt to create and work with JAVA class array
I have a program with 2 classes. The player class contains only the name attribute: public class player { String name; } And I have the Main Class that has the function below and the call of the…
-
2
votes1
answer131
viewsSpringboot does not render image (only if restarting)
I have an entity called Product that has only Title, Price and wayImage, the latter guards the way in which the product image is saved. Upon receiving this form data my service executes this code:…
-
2
votes1
answer210
viewsError Converting Image to String to Save in Database
I’m trying to save an image in my form at the bank, but I’m having difficulties in solving the error: Field error in object 'usuario' on field 'foto': rejected value…
-
2
votes0
answers362
viewsReceived fatal Alert: handshake_failure when class is run by Schedule - JDK7
I have a class that integrates with Woocommerce, when I run the class when I raise the project not httpCliente error ( 4.5.3) I get Httpresponse 200 ok, I have two registered api, 1°…
-
2
votes0
answers81
viewsHow to paste an excel list to android studio and get organized with break lines?
List in excel Relacionar o item Cidade Relacionar o item Afonso Bezerra Alexandria Alexandria Almino Afonso Alto do Rodrigues Angicos Angicos Apodi Apodi How to do this in xml? Because as a long…
-
2
votes1
answer74
viewsIs there a correct way to write this code?
package linguagem; import java.util.*; public class Linguagem { public static void main(String[] args) { Locale locale = new Locale("PORTUGUESE", "PT"); System.out.println("Linguagem: " +…
javaasked 6 years, 5 months ago user116018 -
2
votes1
answer145
viewsInitialize and change static variable in a thead safe way. Does this code make sense? Intellij IDEA doesn’t think
Hello! I’m looking for a safe way to boot and change a static variable that will be shared by different threads that will be accessing its value. The idea is that, at some point, I will verify that…
-
2
votes1
answer1024
viewsPut Maven Local Project as Dependency on Gradle Project
I have this Maven project that has all the application domain classes and logic. Then I created an external Gradle test project where I do system testing with Selenium Webdriver. In order not to…
-
2
votes1
answer103
viewsReinf - Problems assigning content in the Reference URI tag
Has anyone experienced this? Error assigning content in the signature tag: Signature -> Reference -> URI When assigning content in the Reference URI Signature tag I am receiving a EXCEPTION,…
-
2
votes1
answer71
viewsDoubt Socket Server
I have a question in the behavior of the chunk of a code that is creating a socket server, follows the server code: public class Server { public static void main(String args[]){ try { ServerSocket…
-
2
votes2
answers1499
viewsJava DTO with Spring Boot 2
I am trying to implement DTO and am having a no size headache. I would like a help. Follow my project, with spring boot 2. I have 3 tables @Entity as follows. Abstract Client with only 1 attribute,…
-
2
votes1
answer204
viewsRecursion in Java Queue
My teacher says it’s bad programming practice, passing the variable that interests us as a parameter of a recursive method, e.g.: int getMaior(Celula i, int maiorV) He says it’s best to do the…
javaasked 6 years, 5 months ago Igor Sabarense 21 -
2
votes1
answer816
viewsJava CSV file splitting
I have a problem very grade in the use of CSV file in Java, I’m doing a job and for days I can not have a functional idea for this part, next, I have to create a routine that receives a csv…
-
2
votes0
answers22
viewsError @Databasefield + Abstract Class Ormlite (java.lang.Illegalargumentexception: No Fields have a Databasefield Annotation in class ***.Object)
I have a class that extends from the object class (abstract) from which I need to save the fields in the database, but the ormlite asks that the object class has some field with the @Databasefield…
-
2
votes1
answer64
viewsIllegalargumentexception when adding components to Jframe
I’m doing a project of the game Sokoban, and I got to the part where I created 2 Jbuttons to select the level. Now when I try to run a program, it’s a mistake. I created both buttons and action in a…
-
2
votes1
answer145
viewsJcombobox popup is visible until you click the arrow
I have a JComboBox populated with Jcheckbox’s working normally, but when I click on an item, the Jcombobox popup closes. To see if Jcheckbox has actually been marked, it is necessary to open again.…
-
2
votes1
answer476
viewsHow to open a PDF file, which is in the Assets of my APP, in a PDF reader already installed on mobile phone?
I have an APP that needs to open some PDF files (laws) that should come along with the application. The idea is to call a Intent to open these PDF files by the PDF reader itself already installed on…
-
2
votes1
answer159
viewsJava Spring - Null returns repository
This is my Apikey class: @Entity @Table(name="API_KEYS", schema="DEMO_PIMS") @JsonIgnoreProperties(allowGetters=true) public class ApiKey implements Serializable{ private static final long…
-
2
votes1
answer64
viewsNullpointerexception when reading Jsonarray passing String
This is my code, which gets a JSON format string from the url https://servicodados.ibge.gov.br/api/v1/localidades/estados When extracting data according to this class/method public class…
-
2
votes1
answer755
viewsHow to run and display CMD log?
I have seen some examples of how to "execute" CMD commands, by the application, however, I am facing some difficulties. What I’m trying to do is give a cd in the oracle folder, and then run the…
-
2
votes0
answers82
viewsAssociate final variable to another reference in lambda expression
I was developing a code that uses lambda expressions, where variables outside the scope of the expression should be declared as final. Then the doubt arose: I can associate the variable declared as…
-
2
votes0
answers64
viewsChange drawer menu item color - Navigationdrawer
Hello, I wonder if it is possible to change the color of each item that comes in the drawer menu (Navigationdrawer) standard android. I know that choosing a project with this slider the android…
-
2
votes1
answer864
viewsSave Request Spring Boot
I’m a beginner at Spring Boot and I need a little help. I want to save an incoming and outgoing request by generating the automated id and saving the date and time, using Docker and Postgres (I…
-
2
votes0
answers274
viewsSend push notification with FCM direct from an Activity on android
Good night ! I’m having trouble adding the functionality of sending notifications to the users of the application, through the Firebase console these notifications are already sent and received,…
java android push-notification firebase-cloud-messagingasked 6 years, 4 months ago Eduardo Rafael Moraes 710 -
2
votes0
answers46
viewsError setting Spring
Could someone help me with this mistake: Invalid Namespacehandler class [org.springframework.data.jpa.Repository.config.Jparepositorynamespacehandler] for namespace…
-
2
votes0
answers88
viewsJPA - Cascadetype.REMOVE after entity is deleted by orphanRemoval=true
public class PrimeiroNivel { @OneToMany(mappedBy="primeiroNivel", orphanRemoval=true) private List<SegundoNivel> niveisSecundarios; } public class SegundoNivel {…
-
2
votes0
answers62
viewsAndroid Studio - Error using Bottomnavigationviewex methods
Good afternoon, I’m using the lib Bottomnavigationviewex to make a navigation bar for an Android app, but when will I use the methods "enableXXXX" and the "setTextVisibility" gives the error below.…
-
2
votes2
answers138
viewsImplement Paint in Javafx
I’m trying to implement a similar application to Paint with Javafx. I can draw a line from one point to another, but it only appears after I drop the boot at the end point. When I try to implement…
-
2
votes1
answer48
viewsConversion error when sending input to controller to save
Good evening guys, I’m having trouble solving this problem, I hope you can help me... When trying to save data from View only one field returns this error: Failed to Convert Property value of type…