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
-
3
votes1
answer131
viewsJSON with value - Null App List
I am creating an App, where it will present some information from an external database using a JSON file so that I can present this information in the App. However when I run the code, the list in…
-
3
votes0
answers136
viewsMultithreading Crawler problem using jsoup
Hello, I’m developing a multithreaded Crawler, each job (thread) deals with X sites to analyze certain content with the jsoup lib. The sites are all accessible. The problem is that the final results…
-
3
votes1
answer788
viewsAccuracy error in account with Bigdecimal
I have the class below, which shows a different value when I use the calculator. I researched about BigDecimal, but I must be missing something when it comes to presenting the result. What I have to…
-
3
votes2
answers195
viewsHow to convert a string with minutes/month/year to Timestamp?
I am making a code for testing only. In it, I have the following String: String tempo = "1s"; //1 segundo This string is modified all the time: String tempo = "30d"; //30 dias So I want to convert…
-
3
votes1
answer188
viewsCreating Function Postgresql
I’m having a problem creating a Function. I am pulling its parameters from my java application, the problem occurs when pulling the parameters ( variavel1, and variavel2) because they are coming…
-
3
votes0
answers138
viewsJava equivalent C# encryption
I have the method below in C# and I need to do something equivalent in JAVA, but I’m not getting it. Could you help me? private const string chave = "eMbARaLhaDo"; public static string…
-
3
votes1
answer44
viewsSnapshot generated by Selenium is very large
Good afternoon, everyone. I am using Firefoxdriver in version 2.53.0 and when taking snapshot of a site is being generated an image with very large dimensions (111159x17555). Does anyone know a way…
-
3
votes1
answer1191
viewsReading XLS in Java
I have a class to read an xls in java, and I need to know how to print a column next to each other as well as in xls itself. So far I’ve only been able to print in a race or single line. NOTE: I am…
-
3
votes1
answer342
viewsFile upload inside webapp folder
I have a Rest API with Jersey where I upload files. If I set the path to anywhere else, ex: C:\\uploads works, but would like to save these files inside a webapp directory: Currently I do so: @POST…
-
3
votes1
answer282
viewsBetter definition of Entitymanager
I’m studying on JPA along with the Dependency Injection and read some points on the EntityManager: If we use the following method: public EntityManager getEntityManager() { EntityManagerFactory…
-
3
votes2
answers162
viewsHow to make an object in Listview have an absolute position?
I have a listview with several items, I also have right up a searchView to perform a filter on these items, being they "clickable", starting another Activity. The problem is that the numbering of…
-
3
votes1
answer133
viewsError when building project with bilbioteca Commons-Email-1.4
In my project I needed to add the option of sending emails I added the library commons-email-1.4 I wrote all the code and tested it. So far everything perfect but when cleaning and building the file…
-
3
votes1
answer1021
viewsI would like to understand the use of an DTO with an Entity
I wonder if my reasoning is correct regarding the use of a DTO Following this logic, I am correct in using a DTO? @Controller @RequestMapping("/") public class CadastroController { private final…
-
3
votes2
answers276
viewsHelp with Java Exercise
I’m having a little problem in a JAVA exercise, I can’t fix it, although I’m pretty sure it’s pretty simple. It’s a simple crud: Below is the main code import java.util.Scanner; public class Crud{…
-
3
votes0
answers454
viewsHTTP Status 500 - Request Processing failed; nested Exception is java.lang.Illegalargumentexception: Datasource must not be null
When making a query in a dao class, the following error appears: my spring-context.xml is: <mvc:interceptors> <bean…
-
3
votes1
answer1371
viewsHow to uncheck a Checkbox when dialing another?
I wish that couldn’t happen. The user clicking on the other CheckBox, disable the one previously marked. Mainactivity.java package genesysgeneration.umouoto; import…
-
3
votes1
answer328
viewsHow do Admob banner fill full width?
Hello zeroes padding of XML and put wrap_content, but the banner of AdMob does not fill all width is spaces as solve? Code: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout…
-
3
votes1
answer70
viewsNo string in an array with Bufferedreader
I am developing an application that allows the user to enter two cities and then check an array with the existing "Cities", if those that the user enters exist. The problem is when I try to read the…
-
3
votes1
answer1558
viewsDisplay dialog box on screen in the foreground even if window is in the background
I am developing an application where it works with schedules, the user will leave the problem running and will continue using the pc normally and when a certain time will play a sound (already being…
-
3
votes2
answers1315
viewsHow to remove specific markers from a Googlemap
So, this app works like this: the user inserts a journey that goes from point C (collection) to point E (delivery). These points are shown on the map, in the form of markers, as in the figure below.…
-
3
votes2
answers1971
viewsHow to capture string between square brackets
I need to capture strings between brackets within a string. I found a solution that doesn’t solve my problem completely: \\[(.*?)\\] Use like this: Matcher mat =…
-
3
votes3
answers2785
viewsHow to have a full-screen Webview?
My specific question: How to open a WebView in full screen at Android Studio? Change Theme in Manifest? Change Theme in XML? Force a JAVA script? Change view margins? Change code in Style? All these…
-
3
votes2
answers1212
viewsManipulating an Object class
I have the following very complex situation (at least for me). I have a class Person (The data are fictitious for better understanding, but the idea is the same) like this: public class Pessoa {…
-
3
votes2
answers118
views -
3
votes1
answer208
viewsProblem calling Drivemanager.getConnection?
I am studying Java with database and I am doing some examples. On the PC with Windows I used a code and it worked, no problem occurred, now I returned to use Linux and the same code is giving error…
-
3
votes2
answers83
viewsDatabase connection problem
I am building an application from Netbeans IDE 8.1 and accessing the database developed in Sql server further when running the application this generates error: Connection error The port number…
-
3
votes1
answer197
viewsWhy isn’t this method adding up?
I’m trying to put two numbers together by Swing and JOptionPane, but is appearing error below. Someone to help me solve this ? Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException:…
-
3
votes1
answer46
viewsError Parameter 5
When I try to change the already performed record, issues the No value specified for parameter 5. The code: private void alterar() { String sql = "UPDATE tbusuarios SET usuario = ?, telefone = ?,…
-
3
votes1
answer197
viewsOrganize groups
I couldn’t find the logic to implement this. So I’ll explain it another way for better understanding: The algorithm combines 10 numbers in sets of 6, which gives a total of 210 flywheels. Being…
-
3
votes2
answers1280
viewsRecyclerview Error: No layout manager Attached
I couldn’t find the mistake. my Activity: private AdapterPacientes adapterPacientes; private static MVP.Presenter presenter; @Override protected void onCreate(Bundle savedInstanceState) {…
-
3
votes1
answer901
viewsHow do I make a left Join with criteria with an n-to-n table not mapped in java?
I tried to do it this way, but it’s coming back null in the query. Does anyone have any idea how I can solve this? public List<Pessoa> filtrar(Pessoa pessoa) { Session session =…
-
3
votes1
answer552
viewsUpdate command does not work
I have three tables in a database, and I have a method called alteraLinhaTabela where I try to update one of the three tables at a time by identifying it by the variable tabela. I also pass two more…
-
3
votes1
answer175
viewsAlertdialog Android "comment" Popupmenu
How do I get this result the 3 dots on this image have already been pressed. My layout <android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"…
-
3
votes1
answer100
viewsSimple login Firebase
I already have a main login with Firebase auth. But I need to implement another login within that system, because the client can add other administrators. The login will be simple even, just check…
-
3
votes3
answers377
viewsHibernate works OK, but does not finish the process
I don’t know if this is normal, but Hibernate starts the process, inserts the object into the database, but its java process is open. What I have to do to make this process automatically end after…
-
3
votes1
answer127
viewsUsing Middleware in System Integration
In the company where I work, we need to integrate our desktop system, which has a local database with a system that will be running on a cloud server. Our scenario is 2000 clients performing an…
-
3
votes4
answers806
viewsOrganizing positions of a vector
I need to create two vectors, with 3 elements each and real numbers Then copy these values to a new vector with 6 elements The first 3 values must be of the vector with the highest summation value…
-
3
votes2
answers172
viewsIs it possible to copy directory names without copying their contents?
Some time ago I did this question about recursive search in folders, and now I need to adapt to a different condition. I need to copy only the names of the subfolders from a higher folder to a third…
-
3
votes3
answers504
viewsJavac command with more than one packaged class
I have 3 classes in the package com\scja\exam\planetas. I also have a class with method main in the package com\scja\exam\teste, responsible print the name of the planets. I need to compile this…
javaasked 7 years, 9 months ago Marcia Lima 31 -
3
votes1
answer2879
viewsConsume wsdl webservice in java
I need to consume a wsdl webservice but I do not know how to load a method and pass the parameters inside that webservice to return me the desired value. This is the webservice: This XML file does…
-
3
votes1
answer299
viewsPrinciples of Encapsulation
I am studying for the Java Programmer SE 7 I certification exam. I use Selftest Kaplan (recommended by Oracle itself). I came across the following question: (I will leave everything in English on…
-
3
votes1
answer112
viewsRepeating structure
I’m studying repetition structure in Java here. And I came across the will to do the following: public class Teste { public static void main(String[] args) throws IOException { for (int i = 1; i…
-
3
votes1
answer203
viewsImplement a "result counter"
I have a search/query register screen and when I do the query, for example, from all countries, a label "arrow" how many countries found, (eg 19 countries found). However, if within these results I…
-
3
votes1
answer165
viewsProblems with Rowfilter output
I’m working with Documentlistener and Rowfilter, and I realized that my filter is taking the data that I type, and searching for correspondence in all the columns of my table. I would like to know,…
-
3
votes1
answer251
viewsJava Text Streams
Each previously instantiated student type object must be inserted into a Student type object array. For this exercise you can assume that the vector has a maximum of 5 positions. To create an object…
-
3
votes2
answers4675
viewsException Treatment REST Spring Services
In a REST service application with Spring, where should the exception handling/release take place? In the Controller or Service? Example 1 - Handle in Controller (In this case I’m only returning a…
-
3
votes2
answers6310
viewsSearching for an object inside an Arraylist
I created a class Conta and defined its attributes. Elsewhere in the code, I set values for its attributes and added it to a ArrayList, now I need to select it and print the value of one of its…
-
3
votes1
answer1434
viewsHow to compare two shades of color and give the percentage of similarity (Java)?
How to take images with the same dimensions (images of two equal squares) and analyze their tones to tell how similar they are (return a percentage of the similarity between the two tones of the…
-
3
votes2
answers928
viewsClose entityManager after operations? How to manage?
I have been doing some courses and all the material I have read so far exemplifies the use of JPA/Hibernate in small examples, however, when we are developing something more concrete as a project,…
-
3
votes2
answers173
viewsCreate a Resource string or a class of counters?
I have an application where I use data persistence with SharedPreference. From the beginning when I started creating applications, I always created a class, for example, with name Consts to store…