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
answer1019
viewsHow to put Scroll in a layout already made in Android Studio?
I have this layout already done, but in smaller cell phones the buttons are inaccessible, I would like to implement Scrolls both vertically and horizontally when necessary This is the xml of my…
-
0
votes1
answer109
viewsI’m running a program to compare and search specific files
I am performing a task consisting of listing all data contained in a folder. After listing, I need to check if inside the folders there are files with a specific extension (eg. txt. Besides checking…
javaasked 5 years, 3 months ago Matheus Paulo Brasileiro 11 -
0
votes0
answers163
viewsQuery JPA using Paging is taking longer as the page number increases, and generating timeout
I’m running a query with JPA on a cloud server of the google app engine, this query should bring me millions of records, and so I’m using Pageable on it, to avoid bank timeout, the problem is that…
-
0
votes0
answers52
viewsPOST Requestbody and Multipart in retrofit2
How to send an image and jsonObject to the webservice in a single request in retrofit2? Interface @Multipart @POST("url") Call<Mensagens> setChatMessage(@HeaderMap Map<String,String>…
-
0
votes0
answers226
viewsSpring - class path Resource cannot be opened because it does not exist
I’m trying to upload a simple HTML page on Tomcat with spring and Thymeleaf, but when access gives the error: An error happened During template Parsing (template: "class path Resource ..…
-
0
votes1
answer317
viewsEclipse does not update class changes
I’m a beginner in Java and using the Eclipse IDE, it was working normally when the changes I made to the classes stopped appearing on the console. For example: if previously the program was written…
-
0
votes1
answer136
viewsEntity relationship error 1:N using orphanRemoval
I am trying to update a record in the database through a REST service with the help of Postman, however is returning me an error: "A collection with cascade=\"all-delete-orphan\" was no longer…
-
0
votes1
answer368
viewsSpring Boot + JPA + Websecurity - How to save User + Profile?
Hello, it’s been a few days that I’m breaking my head to be able to register a user and its role. The information should be recorded in different entities and I can’t make that relationship. I can…
-
0
votes1
answer170
viewsHow to customize the authentication failure error to return a message in Body from the reply?
When an authentication failure occurs in Spring Security, it returns an error in the response header. I would like to customize the error and return a message in the reply Body. Below is the code…
-
0
votes1
answer146
viewsMigration from Java 8 to 13
Someone can help me what needs to be done to migrate a ready-made project developed with Java 8 and spring boot to Java 13. My POM code is this below <?xml version="1.0" encoding="UTF-8"?>…
-
0
votes0
answers42
viewsWhat are these error messages that appear in Logcat?
Hello, I am having these messages below, in my Logcat of a Mainactivity of Android Studio. How to interpret and solve them? 01-16 11:27:34.088 15846-15846/? W/Glide: Load failed for…
-
0
votes1
answer64
viewsSoftware Modeling
A software that has the option of registering projects and that each project has its specific working days (working days), which by default is Monday to Friday, but can be changed by project…
-
0
votes2
answers102
viewsFormat a double of a variable with two houses
I have a number in Double coming from an object (think) and will be displayed in a table abstractTable. I would like it to be displayed with only two houses after the point. My code below: public…
-
0
votes0
answers37
viewsCompare a letter in a String array in java?
I’m doing an exercise in Java, on String, basically I have to enter a sentence with a maximum of 50 words separated by single space, after this check if all words start with the same letter, and the…
-
0
votes0
answers182
viewsTransactional Spring is not rollback when some Excpetion is released
I am using springboot 2.2.4 and mysql, as an example I have two classes: Client and Dependent: import javax.persistence.*; @Entity public class Cliente { @Id @GeneratedValue(strategy =…
-
0
votes1
answer315
viewsNo suitable driver found for jdbc Sqlstate: 08001 Vendorerror: 0
public static void main(String[] args){ private String DRIVER = "com.mysql.jdbc.Driver"; Connection con= null; try { con =…
-
0
votes1
answer96
viewsProblem to pass a variable from one form to another
beauty? I have a problem with a login of a system that I am creating, in which according to the type of user of the client, it will open the next form with some visible components or not. When I…
-
0
votes1
answer68
viewsWhat Spring annotation I need to use with Mqttcallback messageArrived
I am new to Spring and am trying to insert in my Mysql database from the message received from MQTT. I created my application as follows: public static void main(String[] args) throws…
-
0
votes0
answers89
viewsConsumption given in the Firebase Database
I’m having a doubt that’s making me nervous, and I couldn’t find the answer. On Android, when we’re making an app, usually there are several calls to collect "the same" data from Firebase. For…
-
0
votes1
answer82
viewsissue when connecting mysql to java using jdbc
LoginDAO.java: public class LoginDAO { private static String sql = "select * from login where login=? and senha=?"; private static String url = "jdbc:mysql://localhost:3306/escola"; private static…
-
0
votes2
answers142
viewsError with.mysql.jdbc.exceptions.jdbc4.Mysqlintegrityconstraintviolationexception: Cannot add or update a Child Row: a Foreign key Constraint fails
Good people, I have this mistake and I can’t see the solution. I’m working on my first post-college project and I’m in need of some guidance. I have tables: Client, Ordemdeservico, Budget, Service…
-
0
votes1
answer121
viewsHow to query within a Java array?
The problem calls for the creation of a program that reads the name, Cpf, email and phone of 10 people. Then provide 4 query options (1-By name, 2-By CPF, 3-By email and 4-By phone). For example, if…
-
0
votes1
answer249
viewsHelp with VBA and web to populate web form fields with cell data and trigger report output button
I have the code below that accesses the site, log in it, enter the management menu. In the managerial menu screen I have form fields where I insert initial, end date, turn and the generate reports…
-
0
votes2
answers263
viewsFailed to convert value from property of type 'java.lang.String'
I am trying to submit a form that in one of the classes there is a relationship, I would like to know how to do this, because every time I try to submit I get the error of "Failed to Convert…
-
0
votes1
answer65
viewsSpring command not found
I installed the Spring CLI on my machine recently, and configured the file etc/profile, on it I had already configured my JAVA_HOME, and tried to set up the SPRING_HOME, the end of the file is like…
-
0
votes1
answer99
viewsJava Arraylist Equals - Do not allow element duplicity in Arraylist
Good evening, everyone! I’m having second thoughts about comparing the duplicate elements in ArrayList created, in the case of my code I would like that if it has already been realized the loan to a…
-
0
votes0
answers43
viewsHow to capture Httpentity on an Httpresponse more than once?
In my project, I created a Helper class called Httpresponsehelper to get the body of my Httpresponse. However, when executing the command HttpEntity httpEntity = httpResponse.getEntity() it only…
-
0
votes1
answer35
viewsSprite exchange
Hello, I’m trying to animate the Sprite when it receives damage (changing to a white Sprite), but I’m not getting it, according to the eclipse itself says the error is in ''{'' but in my view they…
-
0
votes0
answers56
viewsMethod inheritance Generic class comparet
I’m implementing a Node class where I wanted the equals and compareTo method to be inherited from type T, but I’m not getting it. If you make a statement like this public class Node<T extends…
-
0
votes0
answers58
viewsImplement checkbox in Recyclerview?
By clicking on the checkbox I run the list click (opens an Activity). To check the checkbox you have to keep pressed. I understand it could be this one click conflict over another. How can I then…
java android android-studio checkbox android-recyclerviewasked 5 years, 2 months ago Lucas Fernandes 1 -
0
votes1
answer105
viewsClear memory unused object
I have a set that contains millions of Strings and uses a lot of memory, the problem is that after I use it inside a foreach the memory used is not released, resulting in some executions of the…
-
0
votes1
answer35
viewsVariable synchronization in multiple Java Threads
Hello. My question is how to use the block Synchronized, my class Fileadapter has a method write who receives the Inputstream from the result of an HTTP connection I’m using to download a file,…
-
0
votes0
answers30
viewsDoubt about Javaee with Wildfly 18
I would like to know what this log is about. [org.jboss.as.ejb3.deployment] (MSC service thread 1-5) WFLYEJB0473: JNDI bindings for session bean named 'ContaService' in deployment unit 'deployment…
-
0
votes2
answers221
viewsJAVA - Skips the input of one of the variables and terminates the code
I’m making a simple read code for product registration. When I am entering the information in each variable, a variable with primitive type double or int, it skips the other that would be a stringe…
javaasked 5 years, 1 month ago En.Fabiano 1 -
0
votes0
answers75
viewsHow to initialize persistence.xml at the beginning of the program?
I’m making a insert within a Postgresql database, however, as I have to test what connection to the database I will make, I end up having to configure the access based on each environment. The…
-
0
votes0
answers483
viewsI started using intellij I want to know how to run my console application
hello I started the java program a short time ago, and a friend who is more experienced recommended me to use the Intellij as you see, I have already set up the ide in a basic way, javac for CMD,…
-
0
votes1
answer620
viewsImplement queue (FIFO) using an array
I have a fixed size 20 list, I need the user to add registrations, however, when I click on "show" option, it presents me only the first element I added in all positions. For example, if you type…
-
0
votes0
answers75
views -
0
votes1
answer212
viewsSetting Image on a Button using Netbeans 8.2
I am trying to insert an image . png in a jbutton, I put the image in a package and I am searching them with: btnCalcBanco.setBackground(new java.awt.Color(255, 255, 255)); btnCalcBanco.setIcon(new…
-
0
votes1
answer92
viewsI need to initialize the variable with the value 0, why?
import java.util.Scanner; public class Main { public static void main(String[] args) { int codigo, quantidade; double preco; Scanner sc = new Scanner(System.in); codigo = sc.nextInt(); quantidade =…
-
0
votes0
answers16
viewsJava - Interface
I was studying interface and I came up with a question in the code below: public class TesteGerente { public static void main(String[] args) { Autenticavel referencia = new Cliente(); Gerente g1 =…
-
0
votes1
answer44
viewsProvenance of calculation
I cannot understand why you are giving 0.00 for the calculation, and if I change the order of the calculation of the expected value, the calculation has only division and multiplication. import…
-
0
votes1
answer224
viewsHow do I save an array to a . txt file in Java the same way it appears in the console?
I made a code that generates a square matrix N x N with random numbers. So far ok. I made a method to record this matrix in a file .txt, only that the matrix simply comes out with random values,…
-
0
votes1
answer69
viewsprint Map Object results with JSTL/JSP
Good evening everyone, I would like to know how to print the values of the Map Return Object with jstl? I tried to do with foreach, but the values does not return anything. Follow my implementation:…
-
0
votes1
answer97
viewsHow do I make a program to invert a password by ignoring the # and _?
I have an exercise to do with this theme but I can’t reverse the second part after a special character. Example: teste_baixo#123 would be traded for etset_oxiab#321. import java.util.Scanner; public…
-
0
votes0
answers13
viewsJava POO, problems running the program
Exception in thread "main" java.lang.NullPointerException at Estudante.Estudantes.<init>(Estudantes.java:17) at…
javaasked 5 years, 1 month ago Ernesto Eugenio Nhatsave 1 -
0
votes1
answer102
viewsHow to pause a thread and run another thread?
Hello, I need to understand how to get a thread to pause its execution and another thread to start running? I have the following code snippet: import java.util.concurrent.Semaphore; public class…
-
0
votes1
answer437
viewsLog Implementation in spring boot
I implemented the LOG in my Spring Boot application but it generates entire files of several days would you like to partition per day as ? To make the configuration I am using in my Properties the…
-
0
votes1
answer98
viewsHow do I set up a column to be composed in Mysql with Hibernate (Java)?
I’m doing a CRUD and in creating my model I’ve reached a point where I can’t get out. I have a table "Plan" and each plan can have several "Modalities", as well as several "Extras", but I do not…
-
0
votes1
answer52
viewsSequential requests using asynchronous Retrofit methods
Hello. I am developing an application where it is necessary to synchronize the data at certain times. I am using Retrofit to connect to the api and send/receive the data, but each request needs to…