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
votes2
answers570
viewsOptimize Mysql table Insert - Java
I have a loop doing millions of rows sequential Insert in a single Mysql table. I would like to know if it is possible to parallelize Insert or use some resource that increases insertion…
-
3
votes1
answer1027
viewscannot be cast to java.lang.String autocomplete primefaces
I’ve had this problem for days, and I can’t fix it. I am using primefaces autocomplete to search for customers registered on my system. I have already done my converter, I followed a tutorial and…
-
3
votes4
answers3476
viewsWhen do I actually need to use the this operator in Java?
It’s just that sometimes I think there’s no need to use the this, but as I just started to learn Java, I want someone to answer me when it will really be necessary to use the operator this?…
-
3
votes2
answers1006
viewsHow to reload an Activity
I have the following problem, in my application I have a ListView in act 1, and register with the act 2, but when I finish the registration I also finalize the act 2, with this return to act 1, the…
-
3
votes1
answer770
viewsHow to change the appearance and behavior of the "Open" and "Cancel" Jfilechooser buttons?
Good people, I’m trying to use Jfilechooser to select directories and also files. What I’m using so far is public void buscaFile() { File[] diretorio = null; diretorio = selectDir(); if(diretorio !=…
-
3
votes1
answer3287
viewsAngularjs and Java backend
Hello, I am ceasing to use the JSF framework to start using Angularjs. I wonder if someone has an example of integration between Angularjs with Java Back-end, so I can see how the Front-end…
-
3
votes1
answer59
viewsOne tap for more than one event
I’m building a musical keyboard, and I’m having trouble making the next key sound if the user doesn’t take his finger off the screen. Can someone help me with that? botao1.setOnTouchListener(new…
-
3
votes2
answers148
viewsHow to write a JSP page using characters from other languages?
I’m writing a JSP page that uses Japanese characters and I’m using the get method, but when I switch to the post method it doesn’t work. I’ve tried to use charset = Shift_jis, but nothing!! Page…
-
3
votes1
answer1450
viewsStopwatch - Timer
I made a chronometer (better to say: a timer) that should be executed when a certain button is clicked. I managed to make the timer, but I can’t close it. After calling it he is timing "forever" rs.…
-
3
votes1
answer1266
viewsHow to plot a route using maps API
I’m making an app in Android Studio for an event and would like that: When opening a specific screen, the app would use the mobile gps to acquire the source coordinates and open the google maps app…
-
3
votes1
answer1080
viewsExact division (whole)
I need to make a division but that it always gives zero rest, exact division. I think I’m sinning in condition. Random Number; int Rnumber1; int Rnumber2; RandomValor1 = (TextView)…
-
3
votes1
answer166
viewsHow to map a column that does not exist in the bank?
I have a small problem when mapping (JPA) the columns of a class of my system. I have some procedures in bank that do a lot of things already and would not like to stop using them, but I do not know…
-
3
votes1
answer79
viewsDoubt about regex
Have this string and I need to go through it taking only the values that are inside the (). To string is : String estados = “(1, ‘AC', ‘Acre’), (2,’AL', ‘Alagoas’), (3, AM, ‘Amazonas’)… “ I rode the…
-
3
votes1
answer567
viewsWhat is the difference between RMI and JRMP?
I only know the MRI... JRMP is just a different way of calling the RMI or is another protocol? If JRMP is another protocol, what is the difference with the RMI?
-
3
votes1
answer60
viewsDoes Java’s Try-catch-Resources flush automatically?
When using an object of the type FileInputStream and FileOutputStream within a Try-catch-Resources java automatically uses the close-up() in the end, but, and the flush() is automatic or not? //…
javaasked 8 years, 1 month ago Vinicius Fernandes 1,727 -
3
votes1
answer64
viewsProblem with showing data in Arraylist
I have a problem to show the data in the arraylist, it always shows the duplicate result public static void main (String[]args){ Scanner ler=new Scanner(System.in); Pessoa p=new Pessoa();…
-
3
votes1
answer149
viewsHow to transform a String "Caiaaaque" to another String "Kayak"?
I’m developing a system where the user typed a wrong word, and I changed one or another letter of this word to correct, just for the purposes of studies anyway, and I have to go through the whole…
-
3
votes1
answer544
viewsError logging in with Facebook on Android
I have an application that can login with Facebook, but a few days ago this feature stopped working and now displays the following message that is in the image attached, deleted the application I…
-
3
votes1
answer2713
viewsConversion Error - Null Converter
I have an application where you have a client record with selection of plan, such plan comes from the bank. when submitting comes the following error: Erro de conversão ao definir o valor…
-
3
votes1
answer2417
viewsHow to insert an encrypted field into a table in Postgresql?
I wanted to know how to insert an encrypted field into a table in the database. To illustrate my doubt let’s assume that I have the following java class: package pessoa; public class Pessoa {…
-
3
votes2
answers1132
viewsWhat better way to analyze a very large json file in java?
I have a very large file in json, it has 5 gigas and it has 652339 lines, I was thinking of using the Gson library in java. I would like to know, what is the best way to analyze the file, since even…
-
3
votes3
answers318
viewsChange the format of a date(time) in a String
I have two strings that receive hours, in this case, Arrivaltime and Departuretime. The format that comes is HH:MM:SS. I would like to format this string to HH:MM how can I do this? Insert this text…
-
3
votes2
answers631
viewsProblem with Arraylist
I’m learning about Array and I’m racking my brain with this code, can someone explain to me why it’s not working? This error appears The type List is not Generic; it cannot be parameterized with…
-
3
votes2
answers110
viewsBuild error when sending to third party check
I am practicing Java in SPOJ and came a simple exercise: Keep typing a number and when 42 appears, stop printing. And so I did quietly here on my PC compiling in the expected way. The problem is…
javaasked 9 years, 1 month ago Vinícius Novelli 173 -
3
votes1
answer894
viewsArray without repetition
How to do not repeat data at each run? Each time I Run, he ends up repeating the dates at the time of execution, as I do for Him to draw the dates without repeating them, and when he finishes the…
-
3
votes2
answers129
viewsEvolve a basic class in Java
Hello, I have the following situation, I have an Animal object and I want to evolve it into a Puppy: public class Animal { private boolean alive = true; public boolean isAlive() { return alive; }…
-
3
votes1
answer1122
viewsHow to center the title of a Jframe?
I have a jFrame component and I want to center his title, would it be possible?…
-
3
votes1
answer216
viewsProblems with api restfull
I have an API Restfull on the local Apache server that returns a list of database users (localhost/api/users). I’m using the site Jsonlint to validate my JSON. When access via browser i take the…
-
3
votes2
answers1234
viewsCompare Two List
I have a list List<Comentarios> comentarios List<Comentarios> comentariosSP The first list I receive data from a webserver, the second from a Sharedpreferences. I tried to compare them…
-
3
votes1
answer338
viewsDynamically update a primefaces table
Hello, I am creating a java register with Primefaces. I have the following problem: I have a screen in xhtml and it carries the registered data, so far so good. The problem is when someone on…
-
3
votes2
answers2241
viewsExit loop when string is empty or when typing a specific word
I am making an algorithm that displays the total price of purchases. I enter the product, unit price and quantity. Again I have the possibility to enter with the product and so on. When you want to…
javaasked 9 years, 1 month ago André Nascimento 1,258 -
3
votes2
answers52
viewsI believe my mistake is in the matrices, or type conversions, but how to solve?
I’m new to java and I have to make a tetris. In this class in particular, I create 2 control matrices to manage the positions of the pieces on the screen, but it’s giving error. Does anyone have a…
-
3
votes1
answer1340
viewsRemove Accents - [ p{Incombiningdiacriticalmarks}] vs [ p{ASCII}]
I created a code in Java to remove accents as the following: private String removerAcentos(String texto) { texto = Normalizer.normalize(texto, Normalizer.Form.NFD); texto =…
-
3
votes1
answer7563
viewsLightweight and stable alternative to Android Studio
I need to do an Android project, but I don’t want to use Android Studio because it is very slow and full of bugs on my computer. Which IDE or alternative framework I could use? A basic requirement…
-
3
votes2
answers566
views400 (Bad Request) when sending array to Spring Controller using AJAX
POST http://localhost:7001/app/workflow/execute/ 400 (Bad Request) I’m getting this error when trying to send 2 array’s to my Spring controller, but I’m getting this error, tried some solutions I…
-
3
votes1
answer321
viewsError analysis and correction in DB connection test using Hibernate
Class to test bank connection with Hibernate. package br.drogaria.main; public class HibernatUtilTeste { public static void main(String[] args) { //abre sessão…
-
3
votes2
answers187
viewsDoubt with use of Optional
I am trying to use this optional class to get the data with null, but returns error. In the main class, I use the for with this method. Profession and composition of persons. for(Pessoa p : pessoas)…
-
3
votes1
answer577
viewsHow to install a java application with a Mysql database?
I am developing a java desktop application, with java swing and Mysql database. But I need to install this application on several machines and I would like to know an easier way to do this, without…
-
3
votes2
answers2053
viewsTime comparison
Please, I’m trying to compare hours (like Open Now / Closed Now). But I’m not getting it. To save the current time, I’m using: object.put("h11", h11.getText().toString()); object.put("h22",…
-
3
votes2
answers188
viewsReceive 2 parameters when entering a key parameter
I have a code that is related to 2 values, for example: 1253 (code), São Paulo (first value, in this case the state), and Osasco (second value, in this case, the city). I wonder if there is some way…
-
3
votes1
answer839
viewsWhat is this? private List<Map<String, Object>> expenses;
A list of maps? Seriously I was scared of this. I’ve never seen this in my life... private List<Map<String, Object>> listarGastos() { gastos = new ArrayList<Map<String,…
-
3
votes1
answer109
viewsRetrieve spatial data via an HTTP request via Google Maps URL
Good morning guys. I’m looking to retrieve some geographic information using latitude and longitude as parameters. To recover such information I am trying to make a request via URL through this…
-
3
votes2
answers612
viewsJSP - Using request in a method
I am trying to use a request within a method as follows: <%! public void method() { RequestDispatcher disp = request.getRequestDispatcher("t2.jsp"); disp.forward(request, response); }; %> But…
-
3
votes1
answer838
viewsInterface defining the signature in a generic way of the methods to be implemented
I own three classes: Repositoriosolicitant Repositoriomotorist Repositorioviagem All have the following methods with the exception of Repositorioviagem which does not have "Change". The Object can…
-
3
votes2
answers8022
viewsConvert String to Date
I’m a beginner in java and I’m having doubts about converting String to Date. I already spent hours searching the internet to see if I could find a solution and I came across very few solutions but…
-
3
votes2
answers796
viewsUpdate Combobox receiving a list from another panel
I have a screen where I register a film, and I play for a ArrayList with a Movie class, which contains some attributes such as title, year, nothing else so far. So I want in my other screen where I…
-
3
votes1
answer610
viewshow to style the selected text Jtextpane?
what I want is to take the selected text from Jtextpane and edit it, for example: change the font color, size and family. The problem is that after I change the selected text once, it doesn’t change…
-
3
votes0
answers366
viewsGoogle login does not work after posting to the Play Store
My code is all right. When I use the application from an emulator, or generating APK and installing on the devices the login with the google account is performed perfectly. The problem arose when I…
-
3
votes2
answers1501
viewsPut files inside a. zip file
I have a class where I compress some files: public class CompactarArquivo { //Constante static final int TAMANHO_BUFFER = 4096; // 4kb //método para compactar arquivo public static void…
-
3
votes1
answer226
viewsMapping an enumeration
I have a problem with Ibernate: When I try to give wakeup on the server, it gives me the following error message: Use of @Onetomany or @Manytomany Targeting an unmapped class. Saying that I am…