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
-
2
votes1
answer31
viewsClass variable in Java have the same behavior as in Ruby?
In Ruby a class variable that is modified by an object ends up modifying the value of all other objects instead of making a copy of that value. This also occurs in Java?
-
2
votes2
answers236
viewsDatatable does not populate object? JSF
I have the following problem: I have a DataTable which is populated with entities of the type Login that belongs to Usuario as a relationship. A button called Add Login calls the method addLogin()…
-
2
votes1
answer1348
viewsPass a List as parameter in Restful Java web services
Could someone explain to me how to receive a List as a parameter in a Restful Java webservices ? I’ve searched a lot of places, but I still can’t figure it out. Thank you in advance ! The code below…
-
2
votes1
answer290
viewsHelp to fill jTable
I’m filling out a jtable with the birthday kids who are registered in a database. public void jTablePop() { javax.swing.table.DefaultTableModel dtm2 =…
-
2
votes2
answers1661
viewsRedeem values from an XML contained in a String
I have a String, which contains an XML with a structure similar to this: <TAG0> <TAG1> <TAG2>valor1</TAG2> </TAG1> <TAG1> <TAG2>valor2</TAG2>…
javaasked 9 years, 1 month ago Chico Luiz 23 -
2
votes2
answers319
viewsProblem Converting String to Date
I have a project to do and I’m not able to convert String for Date. I want to compare the current date with the date of the query that is in textField Date, and if the current date has passed the…
-
2
votes1
answer49
viewsDoes Firebase Analytics need to be initiated in all activities?
I am in an uncomfortable impasse. I am creating the habit of using Firebase in my project, but I do not understand how to use it. I need to put the Firebase Analytics code on all activities or in…
-
2
votes1
answer1025
viewsCalling an Arraylist from one Jframe to another
I need to call a ArrayList raised in a JFrame to another JFrame. In this case, the user would make a registration in one of the Jframes, called Registration, and from this would create the User…
-
2
votes2
answers71
viewsProblem with user inputs
I have the following code: public class FlagApplication { private Scanner keyboard; .... private void insertNewRegistry(){ System.out.println("insira os dados de pessoa: nome, peso, altura, idade,…
-
2
votes1
answer2622
viewsHow to group similar objects
I’ve hit my head and I couldn’t find the logic to do it. Well, I have a list of objects (Police): List and these objects have several properties, for example: organization, year, context and others.…
-
2
votes1
answer155
viewsHow to log in with slf4j from inside a jboss module?
How can I log into the console / server.log from within a jboss module? Let’s say I have a class: public class MyClass { private static final Logger logger = LoggerFactory.getLogger(MyClass.class);…
-
2
votes1
answer42
viewsError using Lock Screen
I am trying to Block the Screen with the following code: protected void onBloquear(View view) { DevicePolicyManager mDPM = null; mDPM.lockNow(); } Source:…
-
2
votes1
answer46
viewsHow to use Realmobject class
I am working on an Android project and while trying to use the class Realmobject it is not recognized, even importing the package io.realm.Realmobject. This class is no longer available?…
-
2
votes2
answers1818
viewsSearching for a matrix within another matrix in Java
I need to compare two two-dimensional matrices (int[][]) of different sizes, the two being formed by integer values (1 or 0), to verify if there is the smaller matrix within the larger matrix.…
-
2
votes0
answers484
viewsRead sqlite3 database in Assets folder
Most examples and tutorials of Android applications out there assume that you want to create and populate your database at runtime and will not use an independent database with your application. I…
-
2
votes0
answers163
viewsProblem in jwplayer + Chrome combination
Hello, I am using jwplayer in a web application and am finding a problem with Chrome to execute the commands of the tool. The problem occurs when it is clicked on "play" for the second time. When…
-
2
votes1
answer74
viewsMongodb stops inserting documents
I am entering some records, but after a while, it does not let insert more. It follows the console error: java.lang.IllegalStateException: Failed to execute CommandLineRunner at…
-
2
votes0
answers558
viewsjava.lang.Nosuchmethoderror: org.jboss.logging.Logger.debugf. Glassfish 4.1, Hibernate 5.2, Spring 4.3
I cannot upload an application to Glassfish 4.1. It seems to me that the problem is dependency org.jboss.logging I already added it to the project in version 3.3.0 but the error persists. The…
-
2
votes1
answer90
viewsSearch in mysql database
I have to do a search in a table, I have to pass up to 3 parameters to filter my search, this is my method: public List<Motores> pesquisaMotores(String serie, String marca, String modelo) {…
-
2
votes1
answer1896
viewsAndroid: getApplicationContext()
I’m trying to do Database db = new Database(this.getApplicationContext()); Where Database is a class I have with all the methods related to Database and I’m calling to fill an Expandablelist.…
-
2
votes2
answers1174
viewsFormat result of integer division
I have the following code in JAVA: private int metros = 1500, minutos = 60; System.out.println("Distância em km = "+(metros/1000)); System.out.println("Tempo em horas = "+(minutoa/60)); However what…
-
2
votes1
answer2069
views -
2
votes3
answers924
viewsFormat String
I have the following example code: String _randomTag = "pvp"; String _randomTag2 = "otherName"; String _format = "{tag} {player} {" + _randomTag + "} {" + _randomTag + "} > {msg}" String _result…
-
2
votes1
answer112
viewsCollect all the Extras from an Intent
Is there any way to find out what all the Extras of an Intent are! CONTEXT: I have an app that gets url’s shared by other apps: if (Intent.ACTION_SEND.equals(action)) { final String url_ =…
-
2
votes3
answers1031
viewsHow to insert markers (Marker) into a map in another Fragment?
I’m developing a app Android where you insert a courier task list (pick something up on the dot A and bring to the point B) and these dots are shown on a map. The App has two fragments:…
-
2
votes2
answers1576
viewsBring QR Code data to my fields
I am reading a QR Code as code below: // Botão para abrir câmera e usar o QR Code (Irá abrir a Store para baixar um app nativo) btnQR = (Button) findViewById(R.id.btnQR);…
-
2
votes1
answer50
viewsDoubt parameter passage in Java
Personal talk, I am doubtful in the following method: /** * Metodo x */ public Exit Method(String n) { final Ent y = new Ent(); y.setn(n); Exit res = OpUtil.Envia(new Job() { @Override public Exit…
javaasked 9 years ago Canatto Filipe 391 -
2
votes1
answer74
viewsInitialized but Null Vector
I’m going crazy with a simple piece of code. My application, serves to give information to use on a route. I add several cities, and then try to add to the vector, but in the end the vector is…
-
2
votes1
answer2311
viewsJasper Reports - Error picking bean value
I’ve been looking for three days now and I can’t solve this problem. Let’s get the explanation: I’m creating a report in Jaspersoft studio and linking with my database, in the preview of my report…
-
2
votes1
answer53
viewsConnect by clicking a button
I would like to know how to make that when clicking on a button, a Telephonic call to the number. As I did, he calls Activity Action_diall with the number already written, so the person must click…
-
2
votes2
answers775
viewsHow to save user session by logging in using Java +Angularjs
I was doing a search of how to save the user’s session after he was logged in to the system, I found several examples with cookies, however I am using java + Angularjs, and in the examples I found…
-
2
votes1
answer244
viewsCould someone tell me what happens in this method?
I have a method that does some things that I would like to know what is...just explain me please please briefly? private static byte[] readFully(InputStream in) throws IOException {…
-
2
votes1
answer96
viewswhat does it mean to clear a Calendar variable?
I want to know when I should use clear() and why to use. SimpleDateFormat simpleDateFormart = new SimpleDateFormat("dd/MM/yyyy"); Date data1 = simpleDateFormart.parse("18/12/1986"); Date data2 =…
-
2
votes1
answer324
viewsHow to integrate spring batch+spring boot+Quartz
Good morning. Currently in my project I am using spring boot and spring batch. Creating the batch was easy, even running it when starting the application with Tomcat embebed from spring boot but…
-
2
votes1
answer467
viewsMedia Player, stop sound before playing another
Good morning, I’m with a project so that when a button is pressed it will perform a predetermined sound however if I press a dps button on the other, it gets both sounds ringing, I tried to if in…
-
2
votes3
answers953
viewsRead txt line and include ";"
I have a txt file whose lines have the following data: 0 02 020 0201 020110 Z DEMONSTRAR COMPETÊNCIAS PESSOAIS 1 Primar pela correção de atitudes This way I can not import the data either to excel,…
-
2
votes1
answer210
viewsCustomize error page to connect timed out in Spring
I’m trying to create a friendly error page in case LDAP is off the air, but unfortunately the only answer I have is j_spring_security_check. I tried to map the exception in web.xml, but I was…
-
2
votes2
answers3011
viewsWrite to.txt file
I am developing an application that needs to record data in the database and go saving these same data in a arquivo.txt in the device’s memory. The bank part is ok, now in the file part I have not…
-
2
votes1
answer111
viewsDifference of Session in Java
What’s the difference of javax.enterprise.context.SessionScoped and javax.faces.bean.SessionScoped? Can anyone explain?
-
2
votes1
answer327
viewsWhat types of storage for desktop applications?
Well, I’m developing a Java application to manage my bank statement, to separate the releases by categories and date, to generate charts in the future. What are the means to save, modify and query…
-
2
votes1
answer320
viewsUsing Jexcel for reading and writing
I am making a simple algorithm, to read an excel spreadsheet, insert some records and save the altered spreadsheet. To write my code, I based on the example of writing made available with the Jexcel…
javaasked 9 years ago Victor Felipe 53 -
2
votes1
answer54
viewsDelete function from list
I have this function to delete from the list chained by value: public void deletar(Object valor) { Node temp = head; while(temp != null) { if(temp.getNext().getValor().equals(valor)) {…
-
2
votes3
answers972
viewsOperation of the switch case
It is possible to make comparisons with variable values in the instruction switch case or the case just checks the value of a variable and makes an action? It is better to make this kind of…
-
2
votes2
answers189
viewsWhat is class to draw circle on Android?
I know the Class Rect for rectangle and circle private Rect retangulo = new Rect(); What class to draw circle on Android?
-
2
votes1
answer32
viewsBooleanbinding of multiple properties
I made the following structure so that when I make one of the components invisible, the others follow the same configuration. A.visibleProperty().bindBidirectional(B.visibleProperty());…
-
2
votes1
answer344
viewsPrimefaces - Select Datatable line via Jquery, Javascript or PF
How do I select a line from a Datatable, using Jquery, pure Javascript or the PF javascript command?
-
2
votes0
answers695
viewsHow to make a download available on a web page having the files on my computer, outside of my web project?
I need to make a web application that the user uploads PDF files and can download them later. The upload part is done, save the files to a folder on my PC /home/william/web. To save the files on my…
-
2
votes1
answer624
views -
2
votes5
answers3766
viewsJava - simple program (finding cousins) - does not run
I’m starting to learn java, I’m using the Java book to Beguinners Guide and this little problem appeared to find the primes of 1 - 100 and print on the screen. I made the following code. class…
-
2
votes1
answer326
viewsConvert java.time.Ser to java.time.Localdate
Hello., I’m reading Caelum’s booklet about java tests jsf web services design Patterns. The problem is that I can’t read the date (I replace the Calendar for LocalDate in class Negociacao) for…
javaasked 9 years ago lucas daniel 430