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
answer54
viewsAndroid - Webview click Error Calling method on Npobject
I’m trying to perform an action in the Android app by clicking an html element in the webview. When clicking on the element, the event is activated but the following error occurs in the alert(err)…
-
0
votes1
answer4559
viewsError resolving template "Meutemplate", template Might not exist or Might not be accessible by any of the configured Template Resolvers SPRING
Performing an ajax request function buscarDisciplina(){ var codigoDisciplina = String($("#codigo").val()); $.ajax({ url: urlApplication+"/grade-curricular/buscar-disciplina/"+codigoDisciplina, type:…
-
0
votes2
answers293
viewsI am Inciante , and I have a problem with a question, on the part of instantiating the objects
Create a Client class, considering that it should have : Builder You must have the default constructor and a constructor that must only have the Client code as its parameter. Attributes • Client…
javaasked 7 years, 5 months ago italo vinicius 59 -
0
votes1
answer24
viewsupdate list view after audio
im trying to refresh my list of Songs when a record an audio, but is not Working, could you help me? public class MainActivity extends AppCompatActivity { private Button mRecordBtn; private Button…
-
0
votes0
answers74
viewsDifferences between using Typecast and wrapper class?
Hello, the activity proposal would show how old the user would be, I wrote my code first to then be able to compare with the teacher, it turns out that my first line came out much smaller than the…
javaasked 7 years, 5 months ago Douglas Venancio 117 -
0
votes1
answer330
viewsHeritage Java web Inheritance
I have the inheritance to do below and would like to know how it would look on main. Someone here could help? Could you tell me if you have any problems with the mapping I did and how mainTeste…
-
0
votes1
answer623
viewsAdd values from an array
I’m trying to make this code, which is basically a six-by-six two-dimensional array with the distance between six cities, then collect the route that the user did in a simple array [6], and…
-
0
votes1
answer29
viewsGet id Imageview on a Gridview
Images I want to put on Gridview private Integer[] imagens= { R.drawable.um, R.drawable.dois, R.drawable.tres, R.drawable.quatro, R.drawable.cinco, R.drawable.seis, R.drawable.sete, R.drawable.oito,…
-
0
votes2
answers350
viewsCalculate total sales of the Java store
I’m having trouble calculating the total sales of the store totalV, because I’m not sure how to store the total values of each product totalProd without a new product replacing the previous. public…
javaasked 7 years, 5 months ago Vivian Thomassin 1 -
0
votes0
answers79
viewsInvalid value: For input string:
Error while updating, the value of the field must be the FK code referring to a foreign key, in the form INPUT comes out the value br.com.tkcsapcd.model.bean.Projectionicio@7adacc20, no…
-
0
votes0
answers36
viewsHibernate documentation code not clear
My question is about a code that’s in the Hibernate documentation. I simply couldn’t understand the notation they used in the criteria.Where() part. Just notice how it was placed: Person_.name. Can…
-
0
votes1
answer156
viewsProblems with web.xml file
Warning: selected war files include a WEB-INF/web.xml which will be ignored (webxml attribute is missing from war task, or ignoreWebxml attribute is specified as 'true') I am using Netbeans to work…
-
0
votes0
answers188
viewsOrder of Listeners Events
I have a tableView with a Listener when selecting a new table view row, and I have a textfield that receives a value from one of the tableView columns; textfield has a listener when losing the focus…
-
0
votes1
answer84
viewsHow to write this xml bean using java?
<bean id="templateEngine" class="org.thymeleaf.spring4.SpringTemplateEngine"> ... <property name="additionalDialects"> <set> <!-- Note the package would change to…
-
0
votes2
answers470
viewsHow to read the a . csv file and write to a list?
I’m starting in Java and I’m having trouble reading from a file and publishing in a list. The list is of predefined type. List<Atleta> listaAtletas = new ArrayList<>(); The class Atleta…
-
0
votes1
answer69
viewsProblem with methods
I am making a program that calculates BMI, using methods without Return. Programme in question: package pct; import java.util.Scanner; public class Ex02Metodos { public static void main(String[]…
-
0
votes1
answer503
viewsHow to add scrollbar to a Scrollpane?
I have a panel, and I will have enough fields and buttons on it. I thought to use a JScrollPane not to make the screen so big. However, I’m not able to add this scroll bar. As I add a scroll bar…
-
0
votes2
answers257
viewsReturn 0 from HTTP
I’m having a bit of a strange problem.. I need to return the status of some web addresses to the application, so I used the code below: The algorithm, takes as a parameter a URL, then returns me the…
-
0
votes0
answers137
viewsRun method by JSF automatically
I have a JSF with a p:panelGrid with columns that together form a screen that we call telemetry (large screen with various information passing in real time), in each column I added a method in which…
-
0
votes0
answers96
viewsSearch using Thread
I am looking for files using threads, the code I developed looks for the right file , but it turns out that it does not finish the execution when it finds , or if it does not find it continues…
-
0
votes2
answers42
viewsOnlistitemclick not working on Listfragment
The Toast of the onListItemClick method never appears, someone knows what I did wrong? Code: public class TiposFragment extends ListFragment { private ArrayList<Tipo> tipos; private…
-
0
votes2
answers1088
viewsDelete in more than one table with an SQL?
I’m trying to apply a DELETE in more than one table, tables have a column (not of the same name) with the same attributes. I want to delete through ID. But I have the table usuario with column id…
-
0
votes1
answer268
viewsClose screen through Jmenuitem
I’m doing a simple system of enrollment of students and teachers and wanted to, when interacting with a JMenuItem called get out of, the program closed. I did the whole algorithm, but this with that…
-
0
votes1
answer1003
viewsMost suitable mapping of JSON to Java object
I need to work with a JSON that has recipe information. This JSON has an object (Recipe) with some object arrays (Ingredients, Steps). What would be more appropriate from the point of view of object…
-
0
votes0
answers53
viewsIncrement equal amount of service
I have a table with the service code, service, quantity, value and total. When I add an ITEM 1 in the table for example, the data of this service will be added in the table. But in case I add this…
-
0
votes3
answers4208
viewsRandom Numbers in Android Studio
This code is generating random numbers in 6 TextViews but I can’t make a code to prevent these numbers from repeating themselves. package com.example.kelvin.myapplication; import…
-
0
votes3
answers1211
viewsRemove last character from a string when the character is a blank
Good afternoon. I am programming in java and want to get the initials of a name, in case: "Jonas Barros Santos" Must appear : JS The code I use does this, but if the person puts the name with space…
-
0
votes1
answer59
viewsDoubt about the Initializer block
I’d like to know why the code compiles but does not execute? Follows the code: package exemploinicializador2; public class ExemploInicializador2 { private String nome = "Aurélio"; private String…
-
0
votes2
answers70
viewsProblems comparing objects coming from a list
I’m trying to compare an object coming from a list before entering it in the database only it returns the object address. Follows the code. Class DAO method public List<ServicoVO>…
-
0
votes1
answer103
viewsHelp with Subprocess and Thread
I made a code that each subprocess call is executed by a different Thread, but they execute the same method with same parameters. You could call these subprocesses using Thread but passing different…
-
0
votes0
answers56
viewsAndroid - Error while renaming package on android
I’m trying to change the name of the package with.app3 to with.gamePedraShow when I try to move up to google play console. I get the message that the name of com.app3 should be changed. Inside Xml.…
-
0
votes2
answers788
viewsHow to add text + icon to the label?
I’m in trouble, so I can add a JLabel with a word before an icon. I put the image in my package, and passed the way, the problem is that the label is concatenating with the String (the word I put…
-
0
votes1
answer693
viewsSerializing and deserializing attributes with names different from Json fields
I’m having the need to serialize and deserialize an attribute that your Json reference has a different name. For example, in the Json I’m receiving there is a field text and would like the value of…
-
0
votes1
answer858
viewsKeep login active on android app (firebase)
Good morning, I’m having a difficulty, I made an application using firebase Authentication and every time the application opens asks login, as I keep this login active after done and open the…
-
0
votes1
answer813
viewsComparing dates
My problem is that I am not sure how to compare two dates. I would like to compare a date that the user types, compared to the current date. If the date type is less than the current one, the…
-
0
votes1
answer2116
viewsPopular Jcombobox with Strings and Ids brought from the database
I need a popular JComboBox with the data brought from a table in my Mysql Database, but I don’t know how to leave an item attached to the corresponding ID. Example: ID 1 refers to the ADM profile…
-
0
votes1
answer599
viewsHow do I make a method in the Spring controller that does the same as this method of a Servlet?
This code returns a json for an html page that uses an ajax resource to load a Chart from the Google API I’d like to do the same but using a Spring controller! public void doGet(HttpServletRequest…
-
0
votes1
answer40
viewsWeb-service Architecture and Functionality
I have a question about Web-service. This is the following I have an application in Java EE JSP, where you should allow a conversation with another application on Android (Example: when registering…
-
0
votes3
answers312
viewsCheck for file on the web
Next, I have an Android app, this app wants to check the existence of an image on the web to be able to load by Picasso, if the image does not exist in an example address…
-
0
votes1
answer366
viewsHow to differentiate buttons within the same event?
I would like to know a method to differentiate a button that generated event, in my method that will treat the events. In the example below I add the same class that handles the events to 2 buttons,…
-
0
votes2
answers1013
viewsGenerate random numbers in java, store in a vector and sort them
I need to generate 100000 numbers, store them in an array and sort them using the Bubblesort algorithm, is appearing the error "Exception in thread "main" java.lang.Error: Unresolved Compilation…
-
0
votes1
answer37
viewsCan’t find file directory
I have a method that is part of a class to capture the client’s signature. But he’s giving trouble when it comes to opening the FileOutputStream, appears "No such file or directory" follow the…
-
0
votes1
answer142
viewsGlobal control for Executorservice
I run a software locally in Java SE, basically it is the synoptic of a equipment in the field, can be controlled by this software. The user has several functions within it, being able to call,…
-
0
votes2
answers104
viewsJPA - Java does not insert data into the database
Bean @Named("proprietarioMB") public class ProprietarioBean implements Serializable { private static final long serialVersionUID = 1L; @Inject private ProprietarioService proprietarioService;…
-
0
votes1
answer88
viewsadd to JAVA text file
in my code I wanted to add in the file but I’m not getting it, it always erases the content from before. package classejava; import java.io.BufferedWriter; import java.io.FileWriter; import…
javaasked 7 years, 5 months ago Sergio Souza Novak 513 -
0
votes1
answer34
viewsHow do I value a value passed by Set?
I wanted to know how do I add a new value to length and width through setLength and Setwidth, and this value goes through validation ((x > 0 && x < 20)? x : 0): public class Rectangle…
-
0
votes1
answer524
viewsE-mail with Javamail copy
I have a system that sends e-mail, works normally, I want to insert a field to send copies of email, a CC or Cco. follows below an excerpt of my code. Entity private String destino; private String…
-
0
votes1
answer29
viewsProblems with multicones in the android menu
I’m trying to create two buttons but it’s only working when I click one of the buttons. My Activity is as follows: <?xml version="1.0" encoding="utf-8"?> <menu…
-
0
votes2
answers300
viewsHow to add custom methods in all spring data services
I implemented methods into one Repository for all my children repositories have the same methods. Download the code of how I implemented a Repository Personalized This is the interface:…
-
0
votes1
answer944
viewsPass data to a listview in another Canvas Activity
I have a college exercise, I have to fill name field, age and Cpf when you click the "register" button it sends the data to another Activity screen where will be added the registration names in a…