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
answer93
viewsCapture image from gstreamer Pipeline
I have an IP camera that uses protocol RTSP to transmit images, the code below uses the gstreamer to connect, grab these images and show on swing (works just right). I want to get the camera frames…
-
2
votes1
answer146
viewsReturn Connection as Boolean?
It would be possible to modify the class so that it returns to jFrame the result of the connection as Boolean? public class ConectarDB { private static Connection con = null; public static…
-
2
votes1
answer2649
viewsHow to calculate 2 n and (2 n)+1 in java?
I am doing a work in which I have to do some calculations with batteries and I need to do tests for powers of two and powers of two plus one, namely 1, 2, 3, 5, 8, 9, 16, 17, etc. The power of two…
-
2
votes1
answer66
viewsWhat is the java class stack growth policy?
I am doing a work on different Tacks and what I am studying increases its size to double when we introduce the (2 n+)1 element. But what is the growth policy of java.util.Stack and…
-
2
votes1
answer685
viewsClear a Bean variable from the JSF page
I have a page with some iteration loops inside my page JSF and then I’d like to know how I do to after each loop clear that attribute from the page. To be clear, I know that when rendering a page…
-
2
votes1
answer366
viewsJava: Problems with Wait() and notify()
Good evening, I’m doing a java project where I make connections between the client and a server. This client sends Messages to another recipient. It is up to the Server to handle this message by…
-
2
votes2
answers888
viewsWorking Hours Calculation - Java
How to calculate the working hours worked, for example, in the company if it works 540 minutes per day, in the system of orders of services I need to compute the hours of service executed, in this…
-
2
votes1
answer247
viewsAutocompletetextview with accented words
I’m having some difficulty using Autocompletetextview with accented words. For example: I’m running names of banking agencies, typing only ita the Itaú bank is finding, as the image below: However,…
-
2
votes1
answer540
viewsHow to exchange the Joptionpane background with an image?
You can use that "ImageIcon" as background of a JOptionPane? Follow the code I tried: public static void main(String args []){ UIManager UI = new UIManager(); ImageIcon icon = new…
-
2
votes1
answer42
viewsJava problems calling an array
Hello, could someone tell me why the program is not finding the array I (I will signal in the code below : Error: error: cannot find Symbol R+= I[P0]; Symbol: variable I Location: class matematica 1…
javaasked 8 years, 11 months ago Vinicius Clemente 365 -
2
votes1
answer298
viewsRead Json in PHP?
I have the following code in my PHP: <?php $url = "https://api.cartolafc.globo.com/mercado/destaques"; $response = file_get_contents($url); $jogadores = json_decode($response,true); It should…
-
2
votes1
answer177
viewsHow do you pause Chronometer and pick up where you left off?
On Android has the view Chronometer, automatically initializes when you enter the ativity. To reset the timer from the 0 use the following code: chronometer.setBase(SystemClock.elapsedRealtime());…
-
2
votes1
answer48
viewsNullpointerexception when connecting the server
I am making a program in Java server/client. When I start the server class I see the error Exception in thread "Thread-0" java.lang.Nullpointerexception I leave the code below so you can help me…
-
2
votes2
answers3247
viewsSeparating strings from an Arraylist with comma
I don’t have much knowledge of Java, I would like to separate the string from my List, with ", ". List<String> nomes = Arrays.asList("Paulo", "Ana", "Zeno", "Beno"); for(int i=0;…
-
2
votes2
answers4781
viewsHow to store data from a. txt file in an object - Java
I am beginner in programming and am making a small application that should register products, delete, edit, organize, control inventory, cost price, selling price, profit margin, etc. So far I have…
-
2
votes1
answer455
viewsRecover Cookies in Spring Security Authentication
How can I recover cookies when the user logs in through Spring Security and with the implementation of the interface AuthenticationProvider? If I recover an instance of HttpServletRequest from a…
java spring cookies spring-security requestasked 8 years, 11 months ago Giancarlo Abel Giulian 3,999 -
2
votes3
answers531
viewsUsing Activity Methods in a Fragment
I am trying to use some methods of an Activity in a Fragment, however I am not succeeding, someone can tell me if it is possible? public class updateMarker extends Activity { TextView uid; //URL to…
-
2
votes2
answers2062
viewsHow to exclude white spaces
Example String str = " texto com espaços em branco "; Upshot "text with white spaces"
-
2
votes1
answer74
viewsAccess a method that is outside the thread
I have a video running in my application and a Thread running a Socket(server), all within the same class, but I need this Thread to access a method that is outside of it. To be more exact I want to…
-
2
votes1
answer343
viewsIssues in netbeans with connection to Postgres
I have a bank called BANCO_DE_TESTES in Postgres that has some random tables. In netbeans when I try to use the Master Sample Form/Detail to use JPA to create a simple crud it doesn’t work saying…
-
2
votes1
answer99
viewsRadio Button does not change text
I created a simple project, and I realized that the RadioButton does not change the text when rotating the screen. I created 2 functions a call setText() and the other setText2() with different…
-
2
votes1
answer3603
viewsSpring Boot application does not rise - org.springframework.Beans.factory.Unsatisfieddependencyexception
I created the application from SPRING INITIALIZR. I made the adjustments for the first operation and configured the application.properties however I continue to receive the same exception:…
-
2
votes4
answers119
viewsData deletion via Hibernate
In the database used by my application I have a table that I defined as temporary that I write some data but at the end of the process I no longer need the information recorded in that table, how to…
-
2
votes1
answer1598
viewsValidation of RNE (National Aliens Registry) or CIE (Alien Identity Card)
Does anyone know how I can validate the CIE (Foreign Identity Card) or RNE (National Aliens Registry) number? I believe there are two names. Language-independent.
-
2
votes2
answers1106
viewsHow do I work with a String with parameters?
The question seems to be simple and naive, but I never needed to use it, I own a String and inside I want to put parameters to be filled out later, as in php $string = "o meu nome é $nome"; or as in…
-
2
votes1
answer585
viewsDoubt when using Timertask
follows my example of class use TimerTask and my problem is this: I want to make sure that every day the 12 hours is done this routine automatically. Currently nothing is happening, is this missing…
-
2
votes3
answers523
viewsError in Hibernate
I am trying to make a small interaction with the Mysql database but when I run the test class appears the following error: Exception in thread "main" java.lang.Nosuchmethoderror:…
-
2
votes1
answer133
viewsJackson does not serialize Jsonobject object
I have a service like this: @Path("/test") public class TestEndPoint { @GET @Produces("application/json") public Response get(){ POJO pojo = new POJO(); pojo.setName("Rafael"); return…
-
2
votes1
answer38
viewsTablerow added via program is not bringing all fields!
I’m trying to make a ScrollView - TableLayout - TableRow via program, but using an XML Layout as the internal database of Tablerows. It turns out that whenever I try to add the text of the last…
-
2
votes0
answers126
viewsHow I seek information from this autocomplete
<?xml version='1.0' encoding='UTF-8' ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html…
-
2
votes2
answers675
viewsError while trying to start another Activity via a button
My program runs, but when I click on the q button I should open a new Activity, the program closes saying there is an error. FATAL EXCEPTION: main Process: com.example.Raissa.calencon, PID: 2142…
-
2
votes3
answers867
viewsDoes not parse the bootstrap datepicker for dd/mm/yyyy - 400 Bad Request (POST)
I have a web application, basically pure wheel with JSP + Angularjs. The template that I use bootstrap, didn’t have datepicker with Angularjs, so I’m using with jQuery. I have on my screen, a modal…
java angularjs twitter-bootstrap spring-mvc datepickerasked 8 years, 10 months ago Leonardo Leonardo 283 -
2
votes1
answer654
viewsHow to keep your screen always on even when you close the app
I’m developing a app and I’m looking to implement a method that makes your screen never erase. I did some research on the Internet and I was able to do this inside the app. However, I would like…
-
2
votes2
answers255
viewsMask in Textedit
I have a form fuel intake and I needed a liter mask that had 3 fields after the comma. Example: 002.555 liters I needed the field to be filled with "000.000" and that, were filled back to front as…
-
2
votes1
answer65
viewsJava Perspective Message
The message is being presented every time I run Eclipse and create a new Project, someone can explain to me the reason for the message?…
-
2
votes1
answer77
viewsBasic doubt in Linkedlist - Java
If I have a Linkedlist called List that has size equal to 0, I can add an element at position 4 of it, for example?
-
2
votes2
answers253
viewsRegex - Regular Expression
I wonder why the regular expressions I’ve written aren’t giving match (marrying) correctly. The expressions are as follows:: User name that must be unique and cannot contain special characters…
-
2
votes1
answer173
viewsArraylist Comparator JSP Object
I’m having trouble implementing the Comparator method, to sort the Object Arraylist. I have an Enterprise class. Where I then create an Arraylist, which is filled from a content manager system. I…
-
2
votes1
answer690
viewsClass to generate CPF does not print on console
I cannot print the generated Cpfs on the console. I am studying this code and do not understand the problem, can anyone help me understand and learn to use this code, please? package geraCPF; import…
javaasked 8 years, 10 months ago Paulo Roberto 1,988 -
2
votes1
answer260
viewsBcrypt in java and php does not match
I have an application in Php that makes a record of a person and when the person puts the password, the password is stored in the database in hash form, with the following code…
-
2
votes1
answer1207
viewsHow to save an html page in java
I have a project that I need to make a report for each code. And save it on disk in PDF format. After generating the report, I don’t know how to pass the page (generated) to Servlet and save it in…
-
2
votes0
answers27
viewsWhen deleting gallery photo the file still exists in the gallery without image
I’m trying to delete a photo gallery via code by android studio. After the execution of the code the photo file still remains there without the image containing an exclamation as image. The name,…
-
2
votes1
answer721
viewsSingleton - What is your function and definition?
I did some research on, I even saw some videos but, I did not understand very well the function or even how it works within Java programming. I am working on a project and a friend advised me to…
-
2
votes1
answer1003
viewsDestroying Session and Session Objects in JSF
I’m using session.invalidate(); to invalidate the session, but when I access the Tomcat mailer it shows me that the session still exists. The following code shows me that even after using the…
-
2
votes0
answers160
viewsGet URI of a full size photo by Camera on Onactivityresult
I’m using the Android camera to take picture and save it from a Webservice. I managed to do this, but using the method of taking a thumbnail. My intention is to take the image in full size. I…
-
2
votes1
answer317
viewsonClick on Android
I made a EditText with the attribute text = 100, but when I use my function onClick(), which aims to make the following calculation text - 50, when I click the button and runs the routine my…
-
2
votes1
answer529
views -
2
votes1
answer942
viewsHow to save a localdate to a mysql table?
I have a table book that has a column like "Date" and in my java code I have a field like "localdate". I need to save the data from the "Localdate" field in the table but I’m finding it difficult to…
-
2
votes1
answer466
viewsRMI equivalence (Java) in C#
What is the equivalence of RMI (Remote Method Invocation - Java) in C#?
-
2
votes2
answers840
viewsNumbers located in odd positions
I should present only the numbers present in the odd vector positions, but I’m stuck: package pag1; import java.util.Scanner; import java.util.Arrays; public class ex1 { public static void main…