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
votes0
answers17
viewsOpen Browser By pressing a button in Activity
How to open a website by pressing a button on Activity?
-
0
votes2
answers101
viewsFunction Screenshot on android
I’m putting the screenshot function in the calendar, however the photo is not going as it should. But using native android function comes out correct Follows excerpt from the code: View v1 =…
-
0
votes4
answers327
viewsDoubt about how to generate random numbers
I’m doing an exercise in java. I managed to generate 6 random numbers, now sometimes the number is repeating. Someone could help me? Follows the code: public class MegaSenna { public static void…
javaasked 6 years, 11 months ago dayson rodrigues 9 -
0
votes1
answer128
viewsGoogle Maps Direction API only works the first time
I have the following code that creates a route using the Google Maps Directions API: public class MapsActivity extends FragmentActivity implements GoogleApiClient.ConnectionCallbacks,…
-
0
votes2
answers954
viewsCompound interest with switch and [preferably] no break in each case
Hello. I have the table below, which calculates interest on interest [0.5% per month, cumulative] and I would like to do it with switch and [preferably] without break in each case. I also wanted the…
-
0
votes0
answers79
viewsDoubt: FATAL EXCEPTION
I have 2 Activity the contact cadstro and the contacts, the registration the code is like this: package com.example.marcio.agendacontatos; import android.database.SQLException; import…
-
0
votes1
answer88
viewsError in the data update method next to the database
I’m using the MySQL and Java in netbeans, but the SQL string code doesn’t update. I don’t know what might be wrong, because I’ve already checked sql and apparently it’s ok. I have in my class DAO,…
-
0
votes0
answers57
viewsHow can I change the DNS server of a device via application?
I’m making an application to change the DNS server, both on Wifi and mobile network, to android but I still can’t figure out how to do it. I’ve searched several places, including the documentation,…
-
0
votes1
answer138
viewsNumberformatexception in GUI
I have a program that simulates a pizzeria system, where the prices of the products are stored in enums as double. The JLabel from the window take these price values and present it on the screen in…
-
0
votes1
answer215
viewsProblem calling method from a newly loaded class
I made a code that dynamically compiles a java file, and through . class generated can load this class, create an instance and invoke its methods using the method getDeclaredMethod(). So far so…
-
0
votes1
answer252
viewsError while trying to place Jcheckbox in a Jtable column
I’m trying to add a column to a DefaultTableModel, but seems to be giving some problems. Follows code! JCheckBox jcheck; DefaultTableModel modelo = new DefaultTableModel(null, new String[]{"Data",…
-
0
votes1
answer73
viewsChange pattern behavior of element p:confirmDialog
I need to change the default behavior of the p:confirmDialog element. By clicking yes, he must complete the request by passing a value and clicking no, he must complete the request by passing…
-
0
votes0
answers738
viewsHow to make a simple timer using Timeunit.Sleep
I am beginner in Java and was trying to make a mathematical game whose theme was to add the random numbers of the buttons (of course the person would have the help of the numbers 1, 2 and 5) until…
-
0
votes2
answers5485
viewshow to put monetary mask for Edittext in an Android app?
how to put monetary mask for Edittext in an Android application only with numerical values without the R$, ie print in Edittext 2.99? If you have an example.…
-
0
votes1
answer420
viewsHow do I add a pane inside another pane via code like javafx?
I already know how to do that when it comes to a AnchorPane, is something like this: AnchorPane ap = new AnchoPane(); Label lbl = new Label("Qualquer"); ap.getChildren().add(lbl); But when it comes…
-
0
votes1
answer53
viewsHow to update Jtextarea automatically
I created a program that has a for, this for generates different values, what I need is to print the values in a JTextArea as 8 values are generated. I did the following: int tp=2; int pop[][] = new…
-
0
votes0
answers318
viewsAndroid Studio. How to instantiate a method with a view in another class
I have a method in Mainactivity2: public void addfoto(View view) { // meu código bla bla bla bla } And I want to call this method on Mainactivity. I’m trying this way but it gets the code wrong:…
-
0
votes1
answer116
viewsUnexpected result when triggering equal calculator knob
I created a calculator by netbeans, which is working if only one operation is performed. But if the user clicks again on =(equal button) the result adds the first entered value. Example: I typed 1+2…
-
0
votes1
answer700
viewsjava.lang.Arrayindexoutofboundsexception: length=0; index=0
I am developing an application that will consume the mail price and term calculation service, however I have a problem in the service response, it returns me the following message:…
-
0
votes1
answer82
viewsHow do I work with object as attribute in registering another object using JSP?
I have a Schedule class. In this class I have a Task object. My question is, when creating the screen to record the scheduling, I will have a field to record the Task of this scheduling. Assuming…
-
0
votes1
answer113
views -
0
votes1
answer228
viewsSpring-boot web security, I can’t tell if you’re authenticating or not
I am trying to implement spring-boot web security in my webapp, but when I enter with login and password, it is simply reloading the page, and I cannot understand if it is authentication failure, or…
-
0
votes2
answers634
viewsJSP how to include a select within a checkbox
I am developing a web application, with java spring mvc, and need to list items in a dynamic checkboxList and include a select option in each item. Something that in html would be similar to the…
-
0
votes2
answers896
viewsSoftware to create documentation without using source code
I’m developing an API, very big, and I want to create the documentation, but most of the programs I found just take the documentation from the comments of the code-source, what I really want to do…
-
0
votes1
answer79
viewsError: make a query(query) in dao which is an alias
This query normally functions in postgresql: select nome as "pessoas?" from pessoa But in java I did a dao which has a method called find: sql = "select nome as 'teste?' from pessoa where id=?";…
-
0
votes1
answer453
viewsUpdate a selectOneMenu (bean method)
Well I’m trying to get a selectOneMenu to fill another selectOneMenu and update a field, but I still don’t quite understand how to do. classes: package model; import java.io.Serializable; import…
-
0
votes1
answer24
viewsHow to associate an Imageview to a Class?
Although it is something generic, to try to clarify my doubt, I will give an example. For example, I have a HashMap<Integer, Piece> with size 64, in which Integer would position and Piece,…
-
0
votes1
answer106
viewsError while trying to add everything together through a Java class
I’m doing a small project on expense control, I’m with a class called Expense which is an abstract class, and other classes called Transport,Feeding and Daily will inherit from it the total value of…
-
0
votes0
answers229
viewsAdd Jcomponents to a Jdialog/Jframe
So I have three JLabel and JTextField to add in one panel, and two JButton and a JTable to add in another panel, so that one stays below the other. I create a more generic panel (pnlPrincipal) to…
-
0
votes1
answer706
viewsHow to convert an array of bytes to a bitmap image?
Hello, I am trying to return to an Imageview an image stored in the database that is saved as an array of bytes in a field of type BLOB, what would be the alternatives to this?
-
0
votes1
answer41
viewsSequence of execution of tasks
I have a question about the execution sequence. For example, in the code below, because it prints y=2.0 and not y=4.0 and because it prints w=0.5 and not w=2.2. y=2.0 understands that it looks for…
-
0
votes1
answer1076
viewsHow to make a regular expression to validate JSF password
I need a regular expression to validate password as below: The password must be in the default: Ipe@1234 (letters, special characters and numbers) I’m using this below, only it does not validate,…
-
0
votes1
answer190
viewsShow in Autocomplete the attribute of a specific user
I’m trying to make an autocomplete to show only the names of registered teachers. I believe the problem is in the search for the attribute, since to get the attribute I have to do the following way:…
-
0
votes0
answers73
viewsHow to create table with java swing?
I have a button, when I click on it I want a table with two columns, one will be a counter and the other an empty field. The number of rows will be according to a variable to be passed to the table.…
-
0
votes0
answers62
viewsApplet asks for main method when executing, but does not have this method
I packaged the project in a jar that is an applet and I want this applet to run here in the old firefox browser linux, however, it asks to select a main method, but Applet has no main method. How to…
-
0
votes1
answer156
viewsDifferences in Jenkins build?
I set up Jenkins to "build" a project from a git repository, I’m using Maven: Warning: JAVA_HOME Environment variable is not set. Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06;…
-
0
votes0
answers1488
viewsHow to format date in UTC format for yyyy-mm-dd
I am working with the XML of an NF-e where the date fields are in UTC format (YYYY-MM-Ddthh:mm:ssTZD) and need to insert them into the database in yyyyyy-mm-dd format. I’m using Simpledateformat to…
-
0
votes0
answers54
viewsI’m having problems with my method of updating in the java application,
public Boolean alterar(Exemplo exemplor){ Boolean retorno = false; String qry = "update funcionario set nome = ?,rg = ?,orgaoExped = ?,dataExped = ?,dataDeNascimento = ?,email = ?,estadoCivil =…
-
0
votes2
answers66
viewsSize of arrays
If the theory says that the size of an array cannot be changed, only the elements. Because when I print the size of a the value is 10 and not 5 or 15? int[] a; a = new int[5]; a = new int[10];…
-
0
votes1
answer63
viewsrender button according to status
I am using the following code to render my button to only appear with the status Waiting for approval but does not occur. <a4j:commandButton value="Enviar Solicitação"…
-
0
votes1
answer265
viewsby checking whether the date of an Edittext is greater than the date of another Edittext
I have two Edittext in my application and select the date using a Datepicker need to make the user not enter a date less than the one given in the first Edittext.
-
0
votes1
answer125
viewsHow to verify that all elements of a vector are between - 4 and 4?
I want to compare whether all elements of an array are between -4 and 4, if so, the algorithm will execute the method. for(int i=0; i< j; i++){ if(vet[i] > -4 && vet[i] <4)…
-
0
votes1
answer203
viewsHow to use Rxandroid?
I’m trying to use Rxandroid but I’m not getting it. Actually, I wanted to be able to use methods inside an Observable, to access the Firebasefirestore and recover the data inside the Realm. So the…
-
0
votes0
answers127
viewsjava.lang.Nullpointerexception when passing to Servlet
Good morning I’m having a hard time passing the data of a jsp to Servlet that will insert the data in the database, I made three forms for scheduling and in the third it will send to Servlet but it…
-
0
votes1
answer284
viewsHow to hide div with cookies after a second user visit
Hello friends already searched a lot and did not find how to do I thank for the help since now. I want to hide a div with cookies after a second user visit Follows my code:…
-
0
votes1
answer203
viewsProduction Application, how to recover data from firebase in recyclerview?
Good morning guys I’m developing an app and I’m on the employee listing and production("this listing in a single line in recyclerview referring to the would work")but I’m in trouble because I don’t…
-
0
votes1
answer151
viewsController error in another file - Angularjs
I have a web project that I’m trying to take the data from the database and put, through the angle, into a table. The way I found it was to use a jsp file and put the data through java. It was…
-
0
votes0
answers53
viewsError while running JSF
I have a JSF error that I can’t figure out. It looks like it’s with my DAO product or Product. This was happening when I was recording a product, now the project doesn’t even open anymore.…
-
0
votes1
answer146
viewsHow to keep Mainactivity "feeding" map Activity?
I have this code and at the moment I need to pass a latitude and longitude to receive on the map and show the current position the user is in, the problem is that when passing to the Intent of the…
-
0
votes1
answer459
viewsConvert Imageicon to Image or Imageicon to Bufferedimage
I’m having trouble finding ways to convert ImageIcon for Image or if possible ImageIcon for BufferedImage in order to be able to save it in the database. I did some research on the internet but the…