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
answer198
viewsAngular 8 - Difficulty recovering headers
Save guys, I’m trying to get the header of the return of my http request to log in. In the header of this Response contains a key 'Authorization', but with the following code I am not able to get…
-
1
votes0
answers46
viewsValues of variables are not exchanged within the method
I do not understand why the program displays, in the last System.out.print, that: 2 5 2 4 6 8 10 Instead: 5 2 5 10 15 20 25 The first method, trocaB, should not change the values of the variables a…
javaasked 5 years, 10 months ago Rafael Barbosa 11 -
1
votes1
answer44
viewsHtmlunitdriver does not find field id - Selenium
I am using Selenium to automate the browser user action. I am using the HtmlUnitDriver, not to open the browser and not have to point a .exe. The page I am doing, will show the components according…
-
1
votes2
answers50
viewsHow to publish image files using Firebase Storage in offline mode?
Hello, I’m developing a code within Android Studio that allows data registration in a form with text fields and an image file offline (mobile with no internet connection). Works great with…
-
1
votes1
answer84
viewsProblem finding a solution in an array / list
I’m having a problem printing data from an array. I have 2 classes (Apartamento and Predio). Within my class Predio i have a method that adds my apartment to a floor: public void adicionarApto(int…
javaasked 5 years, 10 months ago Joao Spirit 101 -
1
votes1
answer620
viewsDirect Print to Non-standard Printer with Jasperprintmanager
In my system a txt file is imported read and printed on the standard printer, the report is done in ireport and I use the printPage method of Jasperprintmanager to print on the standard printer,…
-
1
votes2
answers111
viewsReturn initial condition after false
I’m doing a program that reads a name, and if "Thanos" is answered, a message is presented and the program ends there. However, if the answer is different, a message that "you are not welcome" is…
-
1
votes1
answer400
viewsI’m having trouble compiling a java code using Packages on linux
I don’t know exactly the command to compile a java file on linux that shares the same package. I tried to follow this tutorial:https://www.webucator.com/how-to/how-compile-packages-java.cfm but the…
-
1
votes1
answer104
viewsgetClass(). getResource() returns null
The following code normally functions: package com.lucasdaniel; package com.lucasdaniel; import java.net.URL; public class Main { public static void main(String[] args) { new Subclass(); } static…
-
1
votes1
answer238
viewsToast exhibition
I’m creating an app Android where I have some Switch which each one is linked to an image. I use a API to bring them and make your shipment with Image Loader. When I have an error loading the images…
-
1
votes1
answer92
viewsMagnetometer sensor works only on a few devices
I created an app just to test the tilt of the device’s X, Y and Z axes. In tests, some devices the sensors read the values, while others do not. I noticed that the TYPE_ACCELEROMETER sensor works on…
-
1
votes1
answer136
viewsSensor values accelerometer to decimal degrees
I need to take the slope and declination value of the cell phone in landscape mode, but the values I need are in decimal degrees, from -90 to 90 degrees. I tried to use the accelerometer, but the…
-
1
votes1
answer49
viewsHow to change the logging level of a dependency?
I’m trying to deal with the logging level of a dependency, where it’s showing INFO and I would not like her to show that level, because the information is not pertinent, in my case is the logging…
-
1
votes1
answer33
viewssetOnClickListener loses the default animation
When setting the setOnClickListener to set the action of an item in my listview, the default animation of the click in the list is lost. I’d like to keep up the excitement and run my routine.…
-
1
votes2
answers77
viewsIf an A class is an implementation of an X interface, will the subclasses of A also be?
With the interface Posicionavel: package projeto; public interface Posicionavel { public boolean mesmaPosicao(Posicionavel p); public boolean mesmaPosicao(int[] x); public int[] posicoes(); } And…
-
1
votes1
answer300
viewsArrays in JAVA
I want to make a school report in JAVA, a matrix with 4 lines that will be the number of students,and 4 columns that will be the 4 grades of each student I used a vector to pick up the average at…
javaasked 5 years, 9 months ago Torricelli 21 -
1
votes0
answers46
viewsresult in java code
I’m having a hard time in an exercise The goal of the exercise was to know what password would give as output . use this as original "jU5t_a_sna_3lpm17ga45_u_4_mbrf4c" and through the for-loops and…
javaasked 5 years, 9 months ago Bernardo Martins 11 -
1
votes0
answers141
viewsEntity Creation with Migration (JPA / Flyway) - Error Creating bean with name 'entityManagerFactory
Good evening! I am having difficulty in carrying out the relationship of the entities and getting the following error below. I have tried to use other relationships, but to no avail. User may have…
-
1
votes1
answer76
viewsHeader Datalength with Arduino
I need help sending a HEADER, produced in Arduino (C++), and sent to a server Zabbix. Header documentation https://www.zabbix.com/documentation/devel/manual/appendix/protocols/header_datalen My Code…
-
1
votes1
answer309
viewsError when using the @Slf4j annotation "log" using the Spring Boot tutorial
I am studying creating REST Apis with Spring Boot following the following tutorial: Building REST services with Spring. However when implementing to the class Loaddatabase from the tutorial I’m…
-
1
votes1
answer49
viewsSet voice value in an editText
When I press the button I speak the name for example might it put the autofocus in editText, but when it is with Focus in edittext should press the button and say the value to be written in that…
-
1
votes1
answer117
viewsHow to get user order data in Firebase database?
I have an Android app in Kotlin that orders pizza delivery where the company receives the data of the user’s order and I want the user to also receive the data of the order he made, some time ago I…
-
1
votes1
answer157
viewsCatch multiple occurrences of an expression in parentheses
I’m building a truth table, where I get an equation with several propositions (q, p, r, s) and connective (!, *, =). My equation comes in the following format: String equation = "!(q+p)*r=(s+r)";…
-
1
votes1
answer127
viewsError when adding side-by-side objects in an array
I need to add the methods get for a ArrayList, I tried with commas to separate, but it doesn’t work, I can only add if one is under the other, which is not good for me. I tried to create the…
-
1
votes1
answer76
viewsReturning only the last value of a table and filling a collection via JPQL
I have the following tables in the database: CLIENT ID | NAME | CPF BUYING ID | DESCRICAO_ | DATA | ID_CLIENTE the CLIENT table with the columns id, name and Cpf the PURCHASE table with the columns…
-
1
votes2
answers154
viewsRepeat loop while user choose option to continue
I am developing an application in Java and after calculating everything the user asked, I need it to inform the following message: "Deseja calcular novamente? S/N". I’m using the do/while but I’m…
javaasked 5 years, 8 months ago Luís Fillipe Magalhães 13 -
1
votes0
answers296
viewsCheck java coded word/Hangman game
Good evening, I’m new here in the forum and also in programming, I’m seeing java at the moment, I have a job that consists of a game of hangman in java, part of the class I’ve done (I hope you’re…
javaasked 5 years, 8 months ago Gabriel Oliveira 11 -
1
votes1
answer77
viewsHow do I "share" a request between threads?
I have a "problem" in the system I’m working on, it’s a Java api. Not long ago, they started deploying filters from the request parameters. For every request, it has a preHandle that filters this…
-
1
votes0
answers34
viewsMysql - Exception
all right? I’m studying Java and I’m having trouble connecting to a Mysql database, below the generated Exception: conectando ... nov 06, 2019 4:32:35 PM…
-
1
votes1
answer81
viewsJava competition, simple example, multi-threaded hash map not secure
I’m using a hash map to assign the voto at the id of a voter. But the class has several threads operating on top of the method addVote(...) and getVoteCount(...) , and the result returned is always…
-
1
votes1
answer402
viewsIllegal group Reference error
You’re making a mistake on a replace what I’m doing. The string in question is this: <table id='tablecritica' class='table table-bordered table-hover'> <tbody> <tr> <td>…
-
1
votes2
answers781
viewsHow to make an object inside a JSON object in Java?
I’m trying to build the following JSON: { "movies": { "filme": [ { "id":1, "titulo":"Os Arquivos JSON ", }, { "id":2, "titulo":"Sexta-feira 13: JSON vive", } ] } } I’m wearing the bible org.json.…
-
1
votes1
answer360
viewsHow to format minutes using Java Localdatetime
I am beginner in Java and my doubt is in class LocalDateTime. The time is recorded at a certain point in the program. When I have write on the screen, appears like this: And I need you to come up…
-
1
votes1
answer105
viewsRepository Application Startup Failure Not Found When Starting Springboot
I am trying to run my spring boot project with mysql connection and this giving the following failure Description: Error Starting Applicationcontext. To display the conditions report re-run your…
-
1
votes0
answers16
viewsJasperprint without ultilizar a Collection
Doubt in the use of Jasperprint without a Collection The following code should generate a PDF using only one Ready DTO object, but the problem is that the Jrbeancollectiondatasource instance:…
java spring-boot jasper-reports pdf-generation inputstreamasked 5 years, 7 months ago Eric Maycon Conceição Pessoa 11 -
1
votes1
answer35
viewsUse another class method to register in the database using DAO
I have to record data in a database, but one of these data is calculated by another class, I wanted to know how to take the database data and put it in the method calculation and then record the…
-
1
votes1
answer122
viewsJavafx - Initialize components only when the scene is requested
I’m trying to initialize some components, but I realized that the fxml controller initialize method is initialized before the scene is placed in Stage, this is the way I use to manage the scenes:…
-
1
votes1
answer84
viewsReceive String via Bluetooth and print in a text box
I have a Java code that I adapted to receive a string via bluetooth and when running it in Android Studio does not present errors. However, in the app by clicking the "Start" button to go to…
-
1
votes0
answers21
viewsErrors while reading files
I made a method to read the txt file that was created in another method. After long receiving the Numberformatexception, I managed to eliminate it but the method still does not send name and time to…
-
1
votes0
answers75
viewsCreate a dynamic Java screen
I created a software in Java to make comparisons, the idea is to register objects as cell phones and create criteria to define the best according to their weight. Problem: I want to register an…
-
1
votes0
answers17
viewsHow to Handle classes in a Thread within a Service
I am having a problem related to a Thread. I need to use 2 classes that are outside of it and is giving me the following error: E/Androidruntime: FATAL EXCEPTION: Thread-3 Process:…
-
1
votes0
answers25
viewsHow to pass an object (instance of a class) from Mainactivity to another activity (Mainactivity2) on Androidstudio
Superherofeatures is a class with all the attributes of a superhero, such as name, birthday, power and many other things. Now the heroSelected instance is working, but I can’t transmit it to the…
-
1
votes0
answers55
viewsHow do I manipulate Joptionpane.showConfirmDialog Java via keyboard?
I created a PDV system for a customer, only he did not like to use mouse when finishing sale, because it loses a lot of time. So I went after several tutorials and forums, but I couldn’t find…
-
1
votes2
answers40
viewsUsing Intunaryoperator Java Interface to return n functions
I am reading the documentation of this bookstore that is in the title. I want to implement a method that returns a composition of functions, if I not by arguments must return the identity function,…
-
1
votes0
answers1296
viewsjava.sql.Sqlrecoverableexception: ES error: Connection closed by the other end, Authentication lapse 0 ms
I have a simple Java application that makes a JDBC connection in an Oracle database, follow the source. public class Main { public static void main(String[] args) { try { Connection conn =…
-
1
votes1
answer58
viewsCreating an Uber Jar with Gradle is not working
I’m using the plugin johnrengelman / shadow to create a Uber with some local dependencies, but for some reason unknown is not working. build.Gradle /* * This file was generated by the Gradle 'init'…
-
1
votes1
answer225
viewsInheritance JPA Inheritance.JOINED does not work as it should
Hello, I have the following classes Person, Personal and Personal. The last two classes share the same primary key of the class Person, that is, the primary key and foreign key of the tables…
-
1
votes1
answer448
viewsHow to filter selected fields through Spring JPA using JPQL?
I would like to know how to proceed to filter selected fields using JPQL within the JPA/Hibernate implementation? The following scenario will be presented to facilitate understanding, following…
-
1
votes2
answers328
viewsSwap the first characters of a String for another
I’m creating a 'fake bank' and wanted to make a method in which partially shows the password. I created an array called senha2 and the first 4 characters are shown as *, for example: senha :…
-
1
votes1
answer705
viewsUnit Test Controller Spring with Mockito
I’m trying to test the method below my controller: @RequestMapping(value = "/listar", method = RequestMethod.GET) public ModelAndView iniciaTela(ModelAndView model, HttpServletRequest request){…