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
answer285
viewsHow to separate HTML from Java code from connection to the database?
I have a database and an html code that I finally managed to make connection but the code is kind of messy because it mixes html with java and mysql... Following example: <%@page…
-
1
votes0
answers35
viewsplayer.setDataSource(URL); giving error
I have the code below that opens a URL of Streaming of a web radio and plays/pauses her. Got and bugs in this código I don’t think so and I ask for your help. package carcleo.com.player; import…
-
1
votes0
answers85
viewsMedia|Player in the notification area
Well, I’m making one app that has a plugin MediaPlayer to play web radio. I would like to add, when the player was clicked, a prediction of it in the notification area (I think that’s the name) also…
-
1
votes1
answer1060
viewsUsing Seekbar in a simple way
I am, for study purposes, developing a player in the Android Studio. The player is ready. Now I wish to control it. Researching, I discovered the component SeekBar. But I’m not finding a way to tell…
-
1
votes1
answer51
viewsConsumption WS Rest returns null
I am consuming a WS to get data from vehicles, the API that I was passed returns a JSON: { "success": true, "message": "", "result": [ { "Codigo": "1013", "Placa": "ABC1234", "Ano": 2016, "Uf":…
-
1
votes1
answer560
viewsMap returning repeated values
I’m making a foreach in a hashmap on the basis of the following arquivo.txt: chaveA;6 chaveA;4 chaveB;3 chaveB;7 chaveC;1 chaveC;1 chaveD;5 For now my code is like this: Scanner scanArquivo = new…
-
1
votes2
answers89
viewsAccess child node in Firebase
I have 2 users. Twelve user and thirteen user. Each user has created a project, as you can see in the image. How do I make the twelve user access only the projects he created, and the thirteen only…
-
1
votes1
answer76
viewsHow to change the structure of a static method at runtime?
I am building a Java application that consumes a REST Web Service. I sought to use the new Httpclient of Java 11. However, the same request in this target application sometimes gets a post,…
-
1
votes1
answer957
viewsExpand Apache POI Excel column
I created this class with the code necessary to simulate what I need. The need is to generate an Excel file with some data and, that the cell ( the size of the ballot) is enough to accommodate the…
-
1
votes1
answer115
viewsJava.lang.Nullpointerexception because of a list
Well, I’m studying java and I was seeing composition, so I decided to do some things: Overview of the system : You want to make a system of bank account registration, and each account has the name…
javaasked 5 years, 9 months ago Kevin Ricci 165 -
1
votes1
answer260
viewsUpcasting and Downcasting
I know that Upcasting is to convert a subclass object to the superclass and Downcasting is to convert a superclass object to the subclass. But in relation to the loss of values and the like, as it…
-
1
votes3
answers227
viewsWhat is the pattern represented by this class called?
I wonder what kind of class this is DaoDeAutenticacao, whose skeleton I wrote down. Despite the name I don’t think it’s a DAO (Data Access Object), however it is defined, and yes something else (a…
-
1
votes1
answer43
viewsAdd Beforeclick and Afterclick events to a button
I created a new class that inherits the Button component. I’ll call this class "Novobutton". This Novobutton will work as the traditional Button, but the onClick event needs to run 2 more new…
-
1
votes0
answers474
viewsProblem with the encoding of accents
I am developing an application in Java Web, and I have an encoding problem. On my page already contains the following Tags: <%@ page language="java" contentType="text/html; charset=UTF-8"…
-
1
votes3
answers4406
viewsError Full Authentication is required to access this Resource
Hello, I have a backend made with Spring and I Gero a file . jar and 'raise' it via Vscode to the front made in Angular. When I try to access my page (everything is localhost), I get this return:…
-
1
votes1
answer47
viewsHow to place successive matrices in vector
I have the following matrices of 100 elements: int [][]matriz1 = { {0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0},…
-
1
votes0
answers49
viewsFunction in Mainactivity waiting for an asynchronous return of a function that is in an Asynctask, there being intermediate classes between both
The application has a Class with functions that perform actions in an internal BD and another Class that does almost the same for a BD by an external API. I’ve reviewed the case soen in English and…
-
1
votes1
answer237
viewsJava: Error while recovering data from Resultset, even though query is correct
My problem is this: I am making a Java application integrated with the H2 database. I do a query via PreparedStatement and saved in a ResultSet. So far so good, no Exception is generated. In the…
-
1
votes0
answers103
viewsjava.lang.Illegalstateexception in Broadcastreceiver
I’m getting the following error on the console of my android app, this error shows the warning that the App stopped even not using it: Caused by: java.lang.IllegalStateException: at…
-
1
votes1
answer923
viewsHow to make a query by passing parameters with spring boot and redis using Jparepository?
I have the model: @Data @RedisHash("customer") public class Customer { @Id private String id; @NotNull private String firstName; ... I have the following interface: @EnableRedisRepositories public…
-
1
votes0
answers308
viewsLocaldatetime advancing two hours when submitting form
When I will submit a form with the class Localdatetime managing the time and date fields, it advances two hours. I noticed this advance with the time of my computer. Code: package…
-
1
votes0
answers118
viewsGet BLOB image from the database using Spring MVC + Thymeleaf
I have problems trying to present an image on the frontend using Spring MVC and Hibernate to return the image stored in BLOB in the database. Entity: @Lob @Column(length = 100000) private byte[]…
-
1
votes1
answer189
viewsfunction equals of object is not called during unit test
I’m developing unit test of a class with Junit and Mockite, and to facilitate the creation of a spy of this class I created a function that builds and returns this spy. The problem that is occurring…
-
1
votes0
answers106
views -
1
votes0
answers37
viewsAndroid open only certain links in Webview
I have the following code: @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { if (url.contains("https://m.sendspace.com/") ||…
-
1
votes1
answer337
viewsConvert String to Offsetdatetime (dd 'from' MMMM 'from' yyyy 'to' HH:mm:ss)
I got this String : 17 October 2008 at 11:35:04 And that Pattern: dd 'de' MMMM 'de' yyyy 'às' HH:mm:ss And that code: private OffsetDateTime getData(){ return…
-
1
votes0
answers82
viewsIs there any problem in persisting an image in postgres and it is of type bytea?
I have an application that was using spring framework version 4 (application that generated a .War full of settings...), it worked plausibly. However, I decided to upgrade to version 5 (using spring…
-
1
votes0
answers57
viewsDelay in scroll impende to click on a component using Selenium in Chrome
I have some components on my screen in a Section that has a scroll. When I try to click on a component where it is necessary to use the scroll to find the component. But apparently the scroll has a…
-
1
votes2
answers182
viewsGenerate random number in a user-given range - Java/Android
I’m trying to generate a random number in a user-given range. Android Studio does not point error, however the app does not generate any value. What may be wrong? Thanks in advance! public class…
-
1
votes0
answers170
viewsPrint image on LX300+II matrix ESC/P printer using Java / Android
I’m plugging in a printer LX300+II via cable USB directly on a mobile device Android, I can print text normally, as I already have a little bit of printer experience ESC/POS, I tried to adapt a part…
-
1
votes1
answer241
viewsRemove comments from HTML
I have a TXT taken from an HTML file. It is full of comments that I need to remove and so I thought to use the method replaceAll class String, doing the following: public static void main(String[]…
-
1
votes1
answer94
viewsWhile() loop validation bug?
I’m trying to set the total of some values I capture in the Sqlite database, so far so good because the values passed in my Arrayadpter is set on the screen without major problems. The problem is…
-
1
votes0
answers745
viewsDemoiselle Signer error when signing Crlrepositoryexception certificate
I am developing a project using the Demoiselle Signer framework Demoiselle Signer. However I am unable to sign the document with the generated certificate. It always generates the following error:…
-
1
votes1
answer50
viewsLagrange interpolation - ERROR in [do while]
I’m creating a method to catch n values, adding them in an array, and from these values apply the Lagrange interpolation method to find a polynomial. Soon after, find an estimated value of x for the…
javaasked 5 years, 8 months ago Gustavo Queiroz 45 -
1
votes0
answers31
viewsValor Autocomplete
Good afternoon, I would like to know how to use the value entered in the autocomplete field in my Controller, even if it is null and not a vehicle registered in the BD. <p:outputLabel…
-
1
votes1
answer408
viewsError passing a Thymeleaf object to the Spring Boot controller (post)
I have this controller: @PostMapping("/salvar") public String salvar(@Valid OrdemServico ordemServico, BindingResult result, RedirectAttributes attr) { if (result.hasErrors()){ return…
-
1
votes1
answer469
viewsNo such Column Android Sqlite
I need to accomplish the following select on Sqlite on Android SELECT p.codigo, p.nome, p.preco_padrao, (coalesce((select sum(i.qtd) qtd from tbl_item_compra i inner join tbl_compra c on (c.codigo =…
-
1
votes1
answer126
viewsput Thread.Leep in the Retrofit Call method without locking the Thread UI (main)
Good from what I understand the method call.enqueue(new Callback<Void>() { initiates a thread to communicate with webservice. So I thought I’d slow down the method by putting one…
-
1
votes2
answers177
viewsWhy is the code not running the for loop, even though the compiler is not showing an error?
I was doing an exercise on vectors, where the goal was to build a program that received a number n for input that would define the size of the vector, and then receive, also by input, others n…
-
1
votes2
answers104
viewsSet final variable inside a lambda gives error, but if it is not final, gives another error
public UserEntity findByEmail(String email) { final UserEntity result; getDatabase().forEach((Long id, UserEntity user) -> { boolean isName = user.getEmail().equals(email); if (isName) { result =…
-
1
votes2
answers3235
viewsFormat Localdate and pass as Parameter
I have a Method: private void tratarIFMandato(String [] d){ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd/MM/yyyy"); LocalDate dt1 = LocalDate.parse(d[0].trim(), formatter);…
-
1
votes1
answer75
viewsHow to prevent an object from being instantiated with a certain property?
I want to prevent an object from being instantiated with a certain value (for example, prevent a "battery" object from having a negative value or above 100). How can I prevent the instance from…
-
1
votes1
answer134
viewsHow to take a JSON String and display in recyclerview without repeating?
I have a json with a list of users, photos posted by this user. The idea is to have a recyclerview with the name of the users, and when clicked, it will display the photos of that user. The…
-
1
votes0
answers39
viewsThread inside an Adapter (music player list)
Have Recyclerview that has a list of audios, each line has an audio. When I run, I need seekbar to start the progress that refers to the specific line. For that I understand that I need a thread to…
-
1
votes0
answers48
viewsHow to connect images via arrows on androidStudio
Good night. I have a content.xml where I have 3 imageView, I would like to know which command I can use to connect these 3 images by means of arrows as if it were a flowchart. The app starts with…
-
1
votes0
answers56
viewsPick up current location after connecting GPS - android
I am new to Android and am in need of any help. I’m making an app that when opening, I want to be displayed the map with the current location of the user. The problem is that when the GPS is turned…
-
1
votes4
answers153
viewsPublic Static Void Does Not Work Properly - NETBEANS
I wrote a code taken from a book but understood that it is the first method to be put, but as there was no example given, I tried to insert it several times in different points. As in this example I…
javaasked 5 years, 7 months ago Thiago Felipe Navarro 11 -
1
votes1
answer179
viewsRemove method does not work, nor returns error
My method remove does not delete the record on BD. And, worst, returns no error, nor executes the query (except for Select, I think it’s normal). I used the prints to know if the object was arriving…
-
1
votes0
answers38
views -
1
votes0
answers249
viewsExample Configuration in Swagger Secutiry with Spring Boot
I am making a documented API in Swagger, when I enter the url of my api, it appears to make an authentication, because it has a Websecurityconfig class that does this for me, but I wanted to make an…