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
votes1
answer333
viewsWhat is the difference between the java.util.Timer and javax.swing.Timer classes?
Java has the homonymous classes javax.swing.Timer and java.util.Timer. I understand that the first may have some kind of specific functioning for the swing API, and I thought that it extended the…
javaasked 7 years ago user28595 -
1
votes2
answers471
viewsTake programmatically generated Edittext values
I have an APP, which preencho a quantidade de jogadores that will have the championship and I click on a botão to create the championship. This button plays for a activity that takes the amount that…
-
1
votes1
answer415
viewsHow to hide and block the last line of a Jtable?
It is possible to hide and lock the last line of a DefaulTableModel? I have this difficulty and I am not able to solve it. If it is not at least possible to hide this line? import…
-
1
votes1
answer895
viewsDelete last line - Java
I’m reading a CSV using Bufferedreader by reading line by converting the result into a .txt. At the end of my txt is generating a line break after the last item. I’m trying to find a way to remove…
-
1
votes1
answer65
viewsConvert a custom Object to JSON in Totalcross
It is possible to serialize a Custom Object for JSON without having to insert field-by-field, for example: JSONObject jsonObject = new JSONObject(); jsonObject.put("id", meuObjeto.id);…
-
1
votes2
answers72
viewsWhen I put b on Pattern.Compiler it returns find as false
When I put b in pattern.compiler he returns the matcher.find as false, because he can’t even find a pattern precisely because of the b. Following the code I use: final Pattern py =…
-
1
votes1
answer121
viewsmark/reset not supported error while running file. wav
I created a button that, when pressed, played a sound, but I’m having problems because it throws this exception: "mark/reset not supported", I have no idea what it can be or how to fix it, someone…
-
1
votes1
answer7190
viewsHow to Manipulate Arraylist of Java Objects
The program consists of adding students and for each student adding subjects and for each discipline adding grades. In the end the program must return all the students and their disciplines, and for…
javaasked 7 years ago Diego Soares 403 -
1
votes0
answers491
viewsQuestions about Abstract Classes and Interface (java)
Before I express my doubt it is valid to make clear that in a certain way I understand the difference between the two. I know that a abstract class can have implemented methods, attributes,…
-
1
votes4
answers1081
viewsGet the contents of the last line of a Java file
I need to recover a file always the last line written. I know one way to do this would be: import java.io.FileInputStream; import java.io.InputStreamReader; import java.io.LineNumberReader; public…
-
1
votes0
answers84
viewsNotification via email with springboot
I’m trying to create a notification via email when a user fills in a form, but I’m not very lucky: Mail server Connection failed; nested Exception is javax.mail.Messagingexception: Could not Convert…
-
1
votes1
answer1683
viewsThe difference between the Classpath environment variable and the . classpath files of JAR projects
when we install JDK, we create an environment variable called CLASSPATH, which has as its value the JAVA_HOME variable, which in turn has the address of jdk, which contains all libraries for Java…
-
1
votes2
answers521
viewsConnecting Elephantsql with java
I’m trying to make a connection with the Elephantsql (postgres) through java. With the same code I was able to connect to the local postgres (just changing the url, user, password). I’m trying to do…
-
1
votes1
answer1585
viewsAlphabetically Sort an Arraylist
I have an Arraylist called Test with the fields: public class Teste { private String dctitle; private String rdfabout; private String dbid; private String depto; private String sigla; private String…
-
1
votes1
answer276
viewsHow to put icon in tooltip?
I’m trying to print a text on a tooltip, and at the end, put an icon, however I’m not getting it, I tried to do with html. The problem is that the image comes "broken", does not appear. What would…
-
1
votes1
answer825
viewsSimplify java buttons Change+Save
I have an app with 6 buttons on each screen, save, change, new, delete, exit, cancel. I would like help to join two save and change buttons in one, to clear my screen a little. Make a button only…
javaasked 7 years ago Dhouglas Silva Gomes 75 -
1
votes1
answer3489
viewsError "could not be Parsed" when converting string to Datetime type
I get a Date String like this: 2017-10-11 10:39:04.217923 I take that number off after the point, and I use the LocalDateTime.parse(): private final String PATTERN_DATA_HORA = "dd/MM/yyyy HH:mm:ss";…
-
1
votes1
answer1345
viewsTraffic Light Problems (Producer/Consumer)
Hello! I am trying to solve the Producer/Consumer Problem using semaphores, but I am struggling. I’m using one thread for producer and one for consumer, but I think the program is initiating the…
-
1
votes0
answers113
viewsMake "Enter" trigger an action
I have a login screen to a system and I want that when the user has a selected button, when pressing "Enter" on the keyboard, the button triggers its action. Ex.: if the confirm button is selected…
-
1
votes1
answer66
viewsWhen you click, I want to define the phrase through the indexes
As you can see in the code, when I click I’m randomly defining the phrase, but when I click, I want the phrase that I myself define through the indexes, how do I do this? Public class MainActivity…
-
1
votes0
answers18
viewsDisplay array during debug with android NDK
On android, when debugging my program I can see the vector and content of it: I have to pass this vector from android (java) to C++ and I’m using NDK. public native void testeVetor(double[]…
-
1
votes2
answers276
viewsRemove characters from a string between two specific java characters
I have a String which contains the file path, and I need to remove the characters that come after the last "/" to the end of the string. Can anyone help me with this? ... Example: String comando =…
-
1
votes1
answer52
viewsFix writing on txt
I have an excerpt of code that writes in TXT, it works but excludes what was written before, how do I make it nay replace what was already written? Follow the excerpt of the code I’m using: public…
-
1
votes1
answer996
viewsHow to call a method that is in another java file?
Here’s the first class: public class algoritmo { public static void main(String[] args){ opcoes(); } public static void opcoes(){ Scanner input = new Scanner(System.in); int num;…
-
1
votes0
answers221
viewsPrimefaces graphics with transparent background
I am developing a Javaweb application using the Primefaces framework. On one of my screens I have a p:Chart but I need this graphic to have its transparent background. I tried to change the…
-
1
votes2
answers61
viewsProcedure sql server 2012 + java
I want to structure an INSERT using JAVA in the same way that INSERT is structured in VB .NET. It follows how the code is in VB . NET: Const _spName = "dbo.MEJT_SP_CAD_PRODUTOS" Public Function…
-
1
votes2
answers698
viewsJava/SQL Login and Password Validation Issue
I have a problem in the validation of Login and Password, the code is only taken the values of the first line of the database, but when I try to put the values of the other lines it gives error, I…
-
1
votes0
answers37
viewsDúvida Criteria
I can do a criteria with an entity that is not mapped in another entity? Or I have to use native query to do this query? I have a user entity and another product but I have no product relationship…
-
1
votes2
answers540
viewsWhere to store profile images that the user uploaded?
I have a JAVA application that needs to store profile images that the user sent. //no meu LOCALHOST eu uso esse caminho e funciona perfeitamente: File arquivo = novo…
-
1
votes1
answer29
viewsOpen a website through a button in the app
I’m making an application similar to a schedule and need to put a button to open a registered site, I’ve done with a long click on the table and it worked however, on a button I can not use the same…
-
1
votes1
answer66
viewsNullpointerexception at return of method
I am making a method to search the user logged in to the database. I’m having a NullPointerException in the return of this method @RequestMapping(value = "/usuarioLogado", consumes =…
-
1
votes0
answers328
viewsProblem using spring with Rest
I am conducting a course that I downloaded from the net (Spring with Rest and angular) to develop a personal project, but I am facing some problems that I cannot solve and I did not find a solution…
-
1
votes1
answer476
viewsMock of a class that has parameters in the constructor
public class ParseProcessoTest { private final String PATTERN_DATA_HORA = "yyyy-MM-dd HH:mm:ss"; JSONObject jsonObject; @Mock ParseProcesso parseProcesso; @Before public void init(){ jsonObject =…
-
1
votes0
answers336
viewsCalling a Genexus processor stub in the Java environment
How to call stub a Genexus 15 precedent in a Java application? Stub no Genexus: stub salvadados(in:&StringTeste, out:&StringRetorno) &StringRetorno = "ola " + &StringTeste endstub…
-
1
votes1
answer79
viewsHow to use the Balloontip library?
I would like to use tooltips as in the library balloontip, but I haven’t found a way to use it, it seems to be different from toolTips conventional methods that use the method to be applied…
-
1
votes3
answers692
viewsFinancial calculation with decimal large numbers
I had created the code below for financing calculation. I converted mathematics to Java code, I used variables of the type double. But the result was Infinity, I’m trying to use the BigDecimal, I am…
javaasked 6 years, 11 months ago Weriky Alphazero 37 -
1
votes1
answer41
viewsButtons are not displayed correctly
I am trying to add 2 Jbuttons to a program, I do all the process to add, but shows only one. package ldegraphic; import java.awt.Graphics; import javax.swing.*; public class LDEGraphic extends…
-
1
votes1
answer229
viewsPosition components vertically with Gridbaglayout
I created code in java to position objects in the type window JComboBox and JTextField and I want them to be below each other. The code I tried is this: /*Biblioteca */ import java.awt.*; import…
-
1
votes1
answer54
viewsHow to prevent a Checkbox from receiving click events?
I want to create a list where each item has a purely informative checkbox, so that when the user accesses this item, the checkbox will be marked. But after a test implementation, I noticed that when…
-
1
votes1
answer227
viewsHow to add Firebase data to a Recycleview and show on Android screen with Kotlin?
How to bring this fire list to the cel screen? val store = Shop("Fique Linda", "Temos o melhor!", R.drawable.storefiquelinda) val dataBase = FirebaseDatabase.getInstance() val myRef =…
-
1
votes1
answer181
viewsMockito - Function that receives jsonObject return false
public class ParseProcessoTest { private final String PATTERN_DATA_HORA = "yyyy-MM-dd HH:mm:ss"; JSONObject jsonObject = new JSONObject("json qualquer"); JSONObject jsonMov = new JSONObject("json…
-
1
votes1
answer310
viewsError while trying to delete with DELETE method using web service Rest in Java
I created a Web Service REST in Java. All operations are working except that of DELETE which returns the following error: HTTP DELETE method: @DELETE @Path("excluir/{idpromocao}") public void…
-
1
votes1
answer249
viewsServlet giving error 404
I’m trying to create a posting application, I started studying the Java Web now and every time I run Servlet on Apache 8 it appears a 404 error page. my life package app.web4.servlets; import…
-
1
votes1
answer100
views -
1
votes1
answer293
viewsDatasource Postgresql Widlfly
I’m trying to set up a DataSourcewith PostgreSQL, but you’re throwing this Exception 23:36:46,381 ERROR [org.jboss.as.controller.management-operation] (management-handler-thread - 2) WFLYCTL0013:…
-
1
votes2
answers70
viewsMaintenance problem with JPA query
I have the following packages and classes. When I’m going to do this JPA consultation, I need to go through the whole full Qualified name of the Class (as in the example) because JPA cannot find it…
-
1
votes1
answer904
viewsEnable button event by entering an Edit
I created a "register" screen where the user informs the name/nickname and where there is a Continue button that goes to another screen. I would like this new screen to open when the user presses…
-
1
votes0
answers31
viewsJAVA Commons Simpleemail
My code does not launch any Exception ,but it also does not send the email ,I have tried several possibilities ,I think there may be some logic error : <form method="POST"…
javaasked 6 years, 11 months ago Alan Cesar 11 -
1
votes0
answers45
views -
1
votes0
answers20
viewsWhile problem in java (simple exercise)
Context: I’m making an algorithm that stores random strings typed by the user in a string array until the user type "stop". problem: when typing stop, the eclipse continues the loop in while, and in…