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
-
1
votes0
answers347
viewsError generating billet using Stella Boleto
I’m having trouble generating a ticket for Bradesco Bank. I’m using Stella from Caelum and IDE Intellij, only the basic code for testing that follows: public class BradescoBoleto { public static…
-
1
votes1
answer60
viewsconvert java projects to Maven
I have some java projects and would like to convert them pro Maven. Is there any command maven for conversion of existing java projects? If I just add the pom.xml it will become a Maven project? I…
-
1
votes0
answers10
viewsHow to use a webview loadData but keep previous data on screen?
Is there any way to do that? I’m making a chatbot app, but every time I use the loadData the data that appears overwrite the previous ones, I’d like to leave everyone on the screen...
-
1
votes1
answer34
viewsHow do I for my application gets in the options to open a txt file
I would like to know how I do so that my application comes to is in the list which options to open text file, my application is small only to read and edit txt file for me to train programming, user…
-
1
votes1
answer34
viewsHow do I read a particular java file position, and get the values from it?
My code is as follows: BufferedReader leitor = new BufferedReader (new FileReader("CARTEIRA\\Chart of accounts\\PlanConCxToReceive.txt")); String texto = leitor.readLine(); String[] palavras =…
javaasked 4 years, 7 months ago user211071 21 -
1
votes1
answer145
viewsHow to position Jtabbedpane in the lower half of the screen?
I would like to have my canvas divided into at least two parts, at the top I will add some fields, and at the bottom, a JTabbedPane with a few tabs. The problem is that I don’t know how to do this,…
-
1
votes0
answers607
viewsCopy and Paste function
I wanted to copy and paste a string into a Listview, the function I’m using is just copying follows the function: // Função Copiar private void copiarTarefa(Context context, String text) { if…
-
1
votes1
answer79
viewsWrong timezone in JAVA
I’m making an application where I need to show in a graph the real time of the capture of a certain data I tested that code: SimpleDateFormat format = new SimpleDateFormat("hh:mm:ss");…
-
1
votes1
answer112
viewsHow NOT to round up figures?
I need an exact value but my code always rounds down: float percentageUsed = 6050492416 / 8258998272; System.out.println(String.format("Porcentagem: %.2f", percentageUsed)); In case I had to return…
-
1
votes1
answer201
viewsHow to implement my java program to be Multithread?
My program is not running properly, I can start the server but does nothing else. I want to be able to write a message in the program and have the same message as a response. This is the client…
-
1
votes1
answer165
viewsDoubts with DAO method
I have a question on the issue of a generic DAO, being used in a test project with Vraptor. This dao, works normal in my requests, more when being used in a unit test the same as the following…
-
1
votes1
answer57
viewsDoubt with logical treatment of two strings
I am with a basic java problem, I have been researching on logical treatment of strings within an IF condition, but I did not find the answer to my problem: if (!"y".equals(resposta) ||…
javaasked 4 years, 6 months ago Davi Ribeiro 27 -
1
votes1
answer587
viewsSend Image to Server
When I send a byte[] converted to String to the server on the server comes empty or breaks. I don’t understand why. Bitmap photo = (Bitmap)data.getExtras().get("data"); photo =…
-
1
votes1
answer57
viewsTimeout configuration for a single call in Spring Boot
It is possible to set timeout for a single specific Controller class in Spring Boot, how can I do this? Because using the property spring.session.timeout it arrow the timeout for the application as…
-
1
votes1
answer88
viewsClose Dialog opened inside the Recyclerview Adapter
I made a headline for my RecyclerView which, when clicked, opens a dialog. Some time later, started to give this error: Activity com.mypkg.myP has leaked window…
-
1
votes0
answers29
viewsSwitch web application port with Kotlin in Intelij
I’m using Kotlin on Intelij along with Vertex and Jboss. I want to change the default port of my application. I have tried to put in the VM Options of the Inteli run Configurations a different port,…
-
1
votes1
answer33
viewsScroll through a list to get the current element and the next
How can I implement two for(Teste teste : lista) {} to go through the same list? And the second foreach would always have to look at the next item on this list? I tried that way but he always…
-
1
votes2
answers56
viewsSearch string inside Java list
I have an array with information from several movies, and I need to get the name of the films regardless of whether they are Uppercase or Lowercase, and I need for example, when fetching the name…
-
1
votes1
answer1615
viewsAjax Request for Controller Spring
I am developing a system with back-end in Spring (Spring Boot) and front-end with HTML, CSS(Bootstrap) and Javascript(Jquery). I’m having trouble putting together an ajax request. Follow the Spring…
-
1
votes1
answer194
viewsHow to pass more than one parameter in a Paint() method in Java?
I was developing a project where I need to overwrite the Paint() method, but the Paint() method only receives a Graphics object as a parameter. What I need to do is create a Paint method that takes…
-
1
votes1
answer300
viewsAndroid - String and varchar comparison
I’m having trouble comparing strings. A retreat of a Edittext and the other of an SQL table. The app is a game like "Who wants to be a millionare?" When it comes to the if cycle of comparison…
-
1
votes1
answer55
viewsJakartaee vs Spring vs Java SE with JPA
Speak for me, baby? Reading the Oracle documentation I found the following excerpt: @Persistencecontext protected Entitymanager entityManager; Hence the EJB container will inject a standard Unit…
-
1
votes1
answer196
viewsHow do I get a line back on my jTable?
I’d like to know how to retrieve information from a line of mine JTable, follows the code line of the same. Usuarios operacao = new Usuarios(); DefaultTableModel tabela = new DefaultTableModel();…
-
1
votes2
answers633
viewsToast is not displayed
I’m having a problem Toast doesn’t show up when I make a request on for my web service, the whole method stays inside my thread, I did a test putting a message out of the thread then it shows up,…
-
1
votes0
answers89
viewsNo column name in jTable
I created a Jscrollpane and in it a jTable, all this inside a Jinternalframe, but when I run my Jframe and open this Jinternalframe, it only shows the data in rows that are in my database, but does…
-
1
votes1
answer1097
viewsSpring Boot Application Not Initiating in Heroku
I have the following open source application: people-on-map-site. And I have a Heroku account and this project integrated with the Github repository. However when doing Deploy appears these messages…
-
1
votes1
answer332
viewsNullpointerexception when removing stack element
I am trying to implement a stack structure in Java, but when I try to remove an element I get the following error: > Exception in thread "main" java.lang.NullPointerException at…
-
1
votes1
answer421
viewsReturn to main() after using start()
After executing the command gerenciador.start(), my program does not return to the function main, and does not print the message is over. It simply executes the command I have spoken. Does anyone…
-
1
votes1
answer59
viewsIs there anything like the ". format" Python method in Java?
I have been studying the Java language and realized that I am using many concatenation signals (+). And I remembered that in the Python language, there’s the method format, where keys can be used to…
-
1
votes1
answer104
viewsClick Jpanel does not work
I am creating an interface for a system and would like that when the user clicks on a JPanel, open another window. The program is compiled normally, but at the moment I click on JPanel, does not…
-
1
votes0
answers22
viewsGraphical Interface with Javafx
I’m starting to study Javafx in the java-free course I took at Udemy. Since I am new to java, I would like to understand the advantage of working with this library compared to developing a web…
-
1
votes2
answers758
viewsAsk the user if he really wants to quit
I have the following code: public boolean onNavigationItemSelected(MenuItem item) { // Handle navigation view item clicks here. int id = item.getItemId(); if (id == R.id.nav_camera) { // Handle the…
-
1
votes0
answers51
viewsIntegration between Springsecurity and Springdata to use Spel
Good afternoon I am creating a routine where I need to use Spel to access data from the logged-in user (Authetication) directly in Springdata @Query, I followed the Springdata tutorial to perform…
-
1
votes2
answers599
viewsUpdate primefaces table
Hello, I’m having trouble updating the table after removing some item from it, the item just removed from the table definitely when looking for another type. The table updates as the value of…
-
1
votes2
answers1070
viewsHow to fill Textview setText from an Arraylist?
I get a array with items of interest and I must set them on setText of a particular TextView. I want all the items in this array to appear on the screen, horizontally. In my layout xml, I only put 1…
-
1
votes1
answer149
viewsConfiguration file
I have an app web (war) legacy where various environment settings are arranged in XML files, e.g.: the BD path is in the context.xml <Context path="/Base" reloadable="true"…
-
1
votes1
answer232
viewsGoogle Chart Geochart does not work in Java
Hello, I have a problem running a Google Chart Geochart map in Java... If it’s in a normal . html file, it works, but inside my xhtml project it doesn’t work. Code in html: <html> <head>…
-
1
votes0
answers235
viewsConvert to JSON class objects that recur reference
I am trying to convert to JSON two lists of dististe classes. public class CustomerItem implements Parcelable { //... private List<ProductItem> mProductList = new ArrayList<>(); ... }…
-
1
votes0
answers24
viewsJsfExceptionHandler ConstraintViolationImp messageTemplate
I have the mapping in the user class: @NotNull(message = "Contato não pode ser vázio.") @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER) @JoinColumn(name = "contact_id") @Getter…
-
1
votes1
answer41
views -
1
votes1
answer95
viewsAlternative to obsolete methods onCreateDialog() and showDialog() from Activity?
I would like to know but the funny thing is that I ran here and it worked even saying that it is obsolete. What should I do? private Button botao; static final int DATE_DIALOG_ID = 0; @Override…
-
1
votes0
answers17
viewsHow to prevent different users from seeing the same information?
I made a form in which the user informs a client code and makes a search in a database, which returns the information of this client in the same html page of the form. However, if another user…
-
1
votes1
answer86
viewsSSL configuration in Microsoft Azure for Java projects running on Tomcat
I need to make an HTTPS configuration in a java project on Azure. In the project I use spring security and Tomcat. I searched on many sites how to make the configuration but found different…
-
1
votes0
answers41
viewsDouble-chained list with a graphical interface to browse the list
I’m new to programming, I’m having a hard time. I implemented a doubly chained list I need to navigate the sorted data of the list by a graphical interface, both next and previous, only I do not…
-
1
votes2
answers98
viewsHow to print a double value with zero in java?
I would like to print a double array value in Java, example: 8,00 <- I’d like the exit to be 08,00. How can I do that? public class Main { public static void main(String[] args) { double[]…
javaasked 3 years, 11 months ago LucasSolac 29 -
1
votes2
answers61
viewsWhat is the static method of that returns an object instance in Java
I believe this method serves to "circumvent" the nay possibility of a method builder static. But what is the function of this? public static MinhaClasse of(OutraClasse outraClasse, Departamento…
-
1
votes3
answers174
viewsJava Strings Comparison Error
I have the following situation. I get a string that is in the application’s localStorage in a javascript variable. <script> var sendForm = localStorage.getItem('f'); </script> This same…
-
1
votes1
answer123
viewsIncorrect date arriving
I have the following problem here: I have a request that I make by ajax, and send a date for it, the java receives and saves in the bank, but the date that arrives in java is different from the one…
-
1
votes1
answer67
viewsError: Cannot find Symbol getRootElement
I’m trying to read a file .xml using the code below public static String lerArquivoXML(String string){ SAXBuilder builder = new SAXBuilder(); File xmlFile = new File("c:\\teste.xml"); try { Document…
-
1
votes1
answer71
viewsgetelementsbytagname returning zero
I am using the following code to read a file .xml try { File fXmlFile = new File("C:\\res\\teste.xml"); // C:/.../teste.xml DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();…