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
answer659
viewsHow to finish an Activity from another class?
I need to close an Activity if it has opened, when a certain timer has finished, how do I do it ? because to use Finish I need context. I tried to cast a cast, but to no avail: if…
-
0
votes1
answer195
viewsJenkins does not compile Maven tests but Netbeans does
I’m having a difficult problem to solve. When I run Netbeans’s "clean install" of Maven, it ends the process successfully. When running Jenkins, the process fails when trying to run the tests,…
-
0
votes0
answers35
viewsHow to invoke an event treatment?
The idea is simple: I have an object like Node and would like to invoke the treatment of the event Keyevent. The treatment is not I who create, so I see no alternative but to make the invocation. I…
-
0
votes1
answer894
viewsRegistration confirmation email with Firebase
I’m trying to use the method sendEmailVerification() of Firebase after registration of the user through the Login by e-mail. My problem is that I do not have the option to use this method after…
-
0
votes1
answer577
viewsJava - Swing - Timeunit.Leep time counter
I’m using Swing in Netbeans, creating a simple math game (thought more feasible than a calculator) whose goal is to add up the random numbers of the buttons until it equals a number between 1 and…
-
0
votes1
answer60
viewsOptions menu with setOnItemClickListener
I have a listview, and with setOnItemClickListener and/or setOnItemLongClickListener do the deletion from the record. I’d like to know how to open a janela (like a modal, which opens the window and…
-
0
votes1
answer283
viewsProblems creating Child in Firebase
I’m trying to add dishes to my firebase database but I’m having some problems so far I don’t know why it doesn’t work. and makes this mistake: Process: meals.com.meals, PID: 1585…
-
0
votes1
answer77
viewsDo fragments work as an Activity?
I saw that to continue using a Navigation Drawer, I have to use Fragments, or I can use Activity ? or there is no difference between the two ?
-
0
votes0
answers530
viewsSlow problems generating a Jasper report
I am with a problem , every time q I will generate a report for the first time it takes to generate, apart from the second time it goes very fast , I’m sending the code that generates the report if…
-
0
votes0
answers72
viewsNull Field Error - Java Web
In the project I am studying is based on the book "Java Programming for Web" where a strange error occurs, then the error arises after filling the entire form, where it appears in the log that the…
-
0
votes1
answer1054
viewsSeparate strings by semicolon but also store the semicolon
I am using the split to separate strings by space, enter and semicolon, but when it is the semicolon I need to store it in an array position as well. How to do this? Current Code: String[]…
-
0
votes1
answer169
viewsJava-Full screen in 16bit
How can I put a Jframe in full screen and change the screen resolution using: device.setDisplayMode(new DisplayMode(Width,Height,16,DisplayMode.REFRESH_RATE_UNKNOWN)); I must use a new library?…
-
0
votes1
answer1132
viewsHow do I grab each JSON object, add it to a list, and show it in Activity?
I have to develop an Ecommerce app and I have a question about lists. I’m getting a JSON with some product data from an API and I’m trying to take each object of that JSON, put it in a list and show…
-
0
votes1
answer521
viewsHow do you make two apps use the same database in firebase?
good afternoon! I’m starting in the world of mobile development. I would like to develop two apps. Where the A app records and reads certain data and this data is viewed (read only) by the B app.…
-
0
votes1
answer242
viewsCheck if a variable exists in a class
People I am trying to verify if a variable exists in a class. For this I am using the code: try{ clazz.getDeclaredField("id"); } catch(Exception e){ System.out.println(e.getMessage()); } With that I…
-
0
votes0
answers242
viewsJava library Linker error (Netbeans)
I’m having trouble with a library that I imported. What I did was simply extract the zip file from the library and then in Libraries I used Add Jar/Folder to import the bibliotca to the project. The…
-
0
votes1
answer235
viewsWhat command do I use to update my code every 2 seconds?
I’m developing an App in Android Studio that takes the location of the device and returns me in latitude and longitude, I use it later to make a marker. However, if I install the application on my…
-
0
votes1
answer78
viewsSend user to an email app
I want to send the user to an email application, but I just want to set the recipient, the rest the user himself will fill in the application he chose and then send Has as?
-
0
votes1
answer74
viewsWhere is my mistake?
I’m playing a little game on Android very simple, but I’m having problems with the interface. I created the xml interface, and I set the java class corresponding to it (setContentView...), until…
-
0
votes1
answer296
viewsText break by delimiter
I have the following text:: Texto|Texto|Texto| I want to display it in a Textview, but every "|" (pipe) it breaks the line. In this way: String texto = this.textoQuebrado; String[] array =…
-
0
votes1
answer100
viewsCode error when compiling
I created this code in Java and is giving error when compiling via CMD: import java.io.*; import jxl.*; import java.util.*; import jxl.Workbook; import jxl.write.DateFormat; import jxl.write.Number;…
-
0
votes1
answer69
viewsHow do I put a list in Undeserving with Recyclerview in Android Studio
I need to put the list in disbelief, ie the list starts from the java image that should be the first image. This is a Recyclerview…
-
0
votes3
answers569
viewsImport a. java into another . java
I have 2 codes: Code 1: class Principal { public static void main(String[] args){ Pessoas pessoa1 = new Pessoas(); pessoa1.idade = 1; pessoa1.nascimento = 2; pessoa1.altura = 0.5; pessoa1.nome =…
-
0
votes0
answers80
viewsAdd boats dynamically to the board
I’m developing an MRI application that simulates the game of naval battle. My code for now dynamically generating the board and automatically positioning the ships on the board, my doubt is how do I…
-
0
votes1
answer161
viewsCustom mask
I have an Edittext that has a mask #######.# I need this Edittext to be filled in the same way as a unit value field, for example: Ao digitar 1, o EditText deve ficar: "0000000.1" Ao digitar 2, o…
-
0
votes1
answer1048
viewsEncapsulation and Get and Set methods
I am continuing my studies in object-oriented Java programming. I am currently studying encapsulation and methods get and set and I came across the following exercise: Encapsulate the value…
-
0
votes2
answers923
viewsjava.lang.Nullpointerexception: Attempt to read from field 'java.lang.String
I am trying to implement a stack(database),the problem is that I am not able to send my data to the other Activitys of my application, so when I open another Activity to check if the data is…
-
0
votes2
answers203
viewsSwagger2 with Springboot. How to separate documentation from source code?
Good afternoon, you guys. I’m documenting the Apis of a Spring Boot project using Swagger2. There are two ways to document: using a text file (JSON or YML) or using annotations. The problem of using…
-
0
votes1
answer1113
viewsSwap the contents of a panel in Jframe
In my app, I have a main screen with a menu. The contents of each menu screen should appear within a main screen panel, do not want to open a new screen for each thing. What I need then is to change…
-
0
votes0
answers105
viewsJSF - Abort method when closing browser
I have a report that depending on the filter applied can take a long time to finish. In some occasions the user gives up waiting and close the browser, it happens that the query is still running on…
-
0
votes1
answer178
viewsSocket Error in get https request
I use Java 6. I was doing the integration with IBPT and I used this code: URL url = new URL("http://iws.ibpt.org.br/api/deolhonoimposto/Produtos?"); InputStream input = url.openStream(); It worked…
-
0
votes1
answer96
viewsWorking with Tomcat + Eclipse + Sublimetext (Frontend)
We are creating a web project using Eclipse (IDE) and Springmvc. The development team has two people, separated into Front-end and Back-end (we’re using GIT for versioning). For the Front-end we…
-
0
votes1
answer63
viewsTable mounted by input select
My problem here is that I mount a table through an array received by Ajax,have 2 problems: first Every time I select an item in select the Table should reset and take the new data, the way I did it…
-
0
votes0
answers44
viewsSoftware design with rich classes and CDI
Good night. I’ve read a lot about software architecture using rich classes, dependency injection and such. According to what I have read, the ideal is to receive in the constructor the information…
-
0
votes1
answer1002
viewsCalling Jbuton from one Jframe to another
I’m a beginner in this area, and I’m having a little bit of a problem, so if you could help me.. I have two Frames one is main (P) and the other (B) I call through a button. On the main screen I…
-
0
votes2
answers554
viewsWhat are the applications of day-to-day arrays? (examples of their usability)
I did a search on the internet about the use of arrays and found many results aimed at creating games just... But aside from this example, where I use more arrays (matrices) in everyday life…
-
0
votes1
answer1247
viewsHow to make an asterisk triangle in java
I want to get the following output: n:4 + ++ +++ ++++ That is, I insert an "n" and I will get a kind of triangle in which the base corresponds to a number of asterisks that is requested by input. I…
-
0
votes1
answer542
viewsIntellij IDEA Community and database usage
Guys, I’m thinking of using Intellij IDEA Community to develop in Java, but I saw that this version has no database tools. I saw it on the website but it wasn’t clear. Does anyone work with this…
-
0
votes1
answer111
viewsJPA + JSP - Error trying to enter information into database
I have a problem that I’m not able to solve. I’m trying to enter the information in the bank and I’m not getting it. the browser is returning the following error when registering. Served at:…
-
0
votes1
answer169
viewsInternationalization with Enums Labels
Hello I’m trying to do internationalization with Labels from an Enum: public enum WeekDay { MONDAY("msg.week_monday", "mon"), TUESDAY("msg.week_tuesday", "tue"), WEDNESDAY("msg.week_wednesday",…
-
0
votes1
answer208
viewsBigdecimal takes the value of a string
I have the following question, how to accomplish the sum of a BigDecimal with a String. String a = "8"; BigDecimal b = new BigDecimal(2); It would look something like this? b.add(a); Note: I need…
javaasked 6 years, 11 months ago Weriky Alphazero 37 -
0
votes1
answer560
viewsBigdecimal - Numberformatexception Error
If an editText is not filled in the APK stops working and returns the error: 10-31 15:06:54.340 4152-4152/com.wms.www.calccred E/AndroidRuntime: FATAL EXCEPTION: main Process: com.wms.www.calccred,…
-
0
votes2
answers322
viewsConsume webservice of addresses queries of a given city
I am developing a web project to feed all the addresses of the streets and neighborhoods of the city where I live, and after performing a particular service by the user, link it to an address. Not…
-
0
votes1
answer2918
viewsHow do I use Optional.ofNullable() in this example?
In this example, how can I use this feature to avoid NullPointerException us get? public Pessoa parse() { Pessoa pessoa = new Pessoa(); RespostaPessoaEncontrada pessoaEncontrada =…
-
0
votes0
answers41
viewsFailure to perform Sqlite Insert
When executing this code snippet, returns the error below. What can be the cause? public class LivroDaVendaDAO { // sqlite private ConexaoSQLite sqliteDataBase; // nome da tabela de livrosDaVenda…
-
0
votes1
answer394
viewsResultset is not positioned correctly, you may need to call next
I am developing a web application using JSP and Servlet and that registers the product data in the database and present the data in a table, but when trying to see the image registered by the…
-
0
votes1
answer82
viewsHibernate/SQL Average of a table with multiple relationships
I have the following tables TABLE 1 id value table 2 TABELA2 id Tabela3 TABELA3 id And with this, I would like to average TABLE 1, with WHERE in the parameters TABLE 3 with Hibernate/persistence,…
-
0
votes1
answer979
viewsOpen report in another tab
I need the report, when the user clicks a button, to run in another tab. I am using: <p:commandButton oncomplete="history.go(0)" onclick="target = '_blank'" style="width: 200px;margin-top:…
-
0
votes1
answer154
viewsHow to leave values in report with iReport(or TIBCO) only with 2 decimal places
I wanted to make sure my real values were only 2 decimal places in my report, but I don’t know where to declare it. On my application I declared all floa type…
-
0
votes1
answer56
viewsHow to copy content from web page with Java?
I need to copy the contents of a web page, that according to the Dropdown selected displays the content, are n dropdowns my need would be to copy all content from that page. That’s possible?…