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
-
3
votes1
answer171
viewsIs it possible to send all Java Exceptions by email?
I have a Java Web application, using Spring MVC, and would like to email all Exceptions released on the system. Is it possible to do that? Set up a default email to receive all Exceptions and…
-
3
votes1
answer1249
viewsWhy should E.printStackTrace be removed?
Use Try catch as follows: try{ //meu código } catch(Exception E) { E.printStackTrace(); } using the netbeans IDE, it shows a hint, called "Print Stack Tracking", when I click it, it says…
-
3
votes1
answer300
viewsHow do you make sure it’s another day?
I’m making an application where a feature is available until a condition is reached, after that I have to disable the functionality and only enable it the other day. How do I know it’s another day?…
-
3
votes2
answers1109
viewsChange the Label color of a chart in Primefaces
I have a chart and the labels which are on the x-axis are with a very dark color and I would like to change this color, I have tried to change the color property of the graph but only the title…
-
3
votes2
answers136
viewsRelease only the last line for writing
How do I allow the user to write only in the last line of a JTextArea, that is, without being able to make modifications on the upper lines? (as in CMD or Terminal, for example).
-
3
votes2
answers1288
viewsExecution cannot find 'org.junit.Assert' even if you have the Junit jar in classpath
I have a problem that I’ve done a lot of research on and I haven’t found the answer to yet. I have a test case I’m trying to run and send a message to the console. But even though he has Junit’s…
-
3
votes3
answers1552
viewsHow to set index when inserting item in Jcombobox?
I wonder if someone could help me. I’m trying to add items to a JComboBox: Pessoa carlos = new Pessoa(12, "Carlos" , 0.0f); jComboBoxF.addItem(carlos.getNome()); Pessoa maria = new Pessoa(23,…
-
3
votes1
answer159
viewsRelating entity to more than one entity
Hello, I have in my system the following entities Customer, Supplier and Financial. They all have a list of Contacts, as a bi-directional relationship would look in these molds. public class Client…
-
3
votes1
answer417
viewsJPA error Hibernate = foreign key is returning null
After a long time of research, without success, I decided to post my doubt. I am using JPA/Hibernate and I have two tables: a Pessoa and another Funcionário. The error occurs when I save my data,…
-
3
votes2
answers446
viewsJava Spring Extender @Scheduled to read a file
I have tasks to do as soon as I top up my application, they run over and over again that way: @Scheduled(fixedRate = 10000) public void scheduleFixedRateTask() { System.out.println("Fixed rate task…
-
3
votes1
answer153
viewsWhy is uploading images to my Digitalocean server so slow?
I’m running a Java application using Play! Framework on my Digitalocean droplet. However, when uploading images through the browser I realize that the request is very slow and uploading an image of…
-
3
votes1
answer659
viewsWeblogic and libs conflicts: how to know which versions Weblogic already has?
My question is of beginner, but I feel quite lost. I have been working with Java, but have always used Tomcat. I recently needed to make my "webapp" compatible with Weblogic. The problem is that I…
-
3
votes1
answer123
viewsIdentifying a person through rules (MI)
I need a system that identifies a person (exactly a person) through rules (in this case, such a person’s habits) but my knowledge of AI is very shallow. Is there any appropriate technique for this?…
-
3
votes1
answer113
viewsLife of threads in java
When an object, from a class that implements a thread, is destroyed (loses reference) the thread referring to that object will stop?
-
3
votes3
answers5014
viewsTesting a void method with mockito
How to test a void method with mockito? This is the basic syntax for a return method when(Classe.metodo()).thenReturn(variavelRetorno); However, how do I test a void method?…
-
3
votes1
answer549
viewsIntegration between R and Java
I’m working on a project and I have to integrate the language R with Java. You could help me by indicating a good library or a code (Hello World) make this integration?…
-
3
votes1
answer1493
viewsRecognize a Jsonobject or Jsonarray
I’m developing an app that consumes data from a Webservice, which can return one or more records at a time. Until the moment always received a Jsonarray, made the "conversion" of it: JSONArray…
-
3
votes2
answers284
viewsHow to implement classes with private method?
I am rewriting the code of an application seeking the best use of interfaces and I came across a problem: I have a class that needs to have a private method and I want to create an interface for it,…
-
3
votes1
answer542
viewsNo bean corresponds to CDI injection point
I’m looking to implement CDI. But when I use the @Inject annotation I’m notified with this warning "No bean corresponds to the injection point" Code line I’m notified of @Inject private…
-
3
votes1
answer554
viewsHow to configure the java version?
Following the step by step of the lesson 1.3 Introduction to Maven, we have the following code (replace square brackets for braquets): [modelVersion]4.0.0[/modelVersion]…
-
3
votes1
answer260
viewsIncorrect information when loading bigdecimal entity
I have a table, that one of your columns is a Numeric(25,10) that will be shown the rates. But there are records that will be zeroed ( 0.0000000000 ) In my entity you own that fee, as a Bigdecimal.…
-
3
votes0
answers109
viewsClassifying with colored cells and Date column
I have two problems to finalize my table: 1) I have one TableCellRenderer customized to paint an entire row based on the value of a column. It works, but when I click to sort, the colors of the…
-
3
votes1
answer440
viewsProblem generating report between dates
I have a field DATETIME with a date and time: 2015-08-06 08:50:28. I’m trying to generate a report by passing two parameters, Data_Inicial and Data_Final so that I can get all the bank dates that…
-
3
votes1
answer124
viewsWhen concateno String add a ENTER
When I concateno(+) strings adds one alone enter right after the concatenation. private static Dimension TOOLKIT = Toolkit.getDefaultToolkit().getScreenSize(); private static GraphicsEnvironment GE…
-
3
votes1
answer1243
viewsPass multiple parameters to an SQL query
Let’s say I have the following CPF's: 65568752877 86924355382 55317961378 82331493146 I would like to pass them as a parameter in a consultation SQL, I’m trying this way: Snippet ... " AND…
-
3
votes1
answer824
viewsSpringboot and Angularjs routes
I am trying to put url friendly to take the '#' of the angle url, I followed the following tutorial: /spring-boot-as-a-backend-for-Angularjs/ and it worked in the statistical url. But if I do this…
-
3
votes2
answers79
viewsRepeating code at listing time
I’m having a repeat problem at listing time, in my view it repeats R01 and R01, twice the same code and only then it correctly follows R02, RO3 and so on. The correct would be R01, R02, R03 and so…
javaasked 9 years, 3 months ago Frederico Queiroz 188 -
3
votes1
answer54
viewsFor an unordered set of listeners what is the best java.util.Set implementation to use?
I’m developing a Handle to a data stream, where periodically events will be launched that are to be captured by a small set of Listeners from 1 to 5 listeners. This set of listeners do not need to…
-
3
votes1
answer1201
viewsError 404 directed/or not to the Servlet. Problems with Layout
I am studying java for web (EE) and would like to know if you could help solve a java problem! I have in my web.xml a call to the erro404.jsp file that is at the root of the site to filter out pages…
-
3
votes1
answer203
viewsDuplicate mapping error: org.hibernate.Duplicatemappingexceptionn
I am using Hibernate 5 and am having the following problem: Caused by: org.hibernate.DuplicateMappingException: duplicate import: br.edu.unifeob.entidades.apuracao.Avaliacao refers to both…
-
3
votes1
answer3315
viewsEnsure that generic object passed as parameter is subclass of an abstract class
First I would like to say that my doubt is not specifically about "verify that a generic object passed as parameter is subclass of an abstract class.", but I couldn’t pick a better title. If you…
-
3
votes3
answers88
viewsTimer does not run when changing computer date
I have this simple timer that works normal. But when I change the computer date Retroactive the timer stops running. Someone can explain to me why?? I need to know if the user has changed the date…
javaasked 8 years, 3 months ago Alessandra Canutto 61 -
3
votes1
answer67
viewsJavamail: Mailbox always downloads the same email
I’m downloading the emails from Gmail, and storing in the database those that are important to my client’s system. Only the problem is when I use the code below, it always returns me the same…
-
3
votes1
answer209
viewsHow to find specific values in a String?
I have to get the Ethernet adapter + IPV4 from Windows, until then everything is quiet. I ran the process and stored everything in a String Buffer and sent it back: public String IP (String tarefa)…
-
3
votes2
answers797
viewsImplementation of Jmenubar in a Jframe
I’m having trouble trying to insert a component JMenuBar to my main frame. I don’t get any kind of problem when executing the code, but the options bar is not displayed in the program. What is…
-
3
votes3
answers3097
viewsHow to generate random matrices without repeating numbers on the same line?
I want to store random numbers from 1 to 60 in an array. When there are equal numbers on the lines, it is to generate another random number. Type, cannot be: 11 55 55 43 49 30, and yes should be 11…
-
3
votes1
answer110
viewsData is not saved in the database
I’m using Java, JPA, Primefaces, Wildfly and Mysql, not much to do, but it’s good to inform. I fill in all the fields, all right the check is performed. When I click save the success message is…
-
3
votes1
answer486
viewsUnable to create Managed bean
I’m having a problem here in java that I don’t know how to solve or what it might be because I’m learning to program with java for the web and I don’t know the possible causes of the following error…
-
3
votes2
answers783
viewsDo I need to do unit testing of the system entities?
I am working on a project and participating in a team , we were given the task of doing a series of tests with a system,testes de integração continua, testes unitários .... The point is that all…
-
3
votes2
answers2382
viewsQuery with dynamic spring data column
I need to perform a select using the spring data @Query, but I need to pass the column name by parameter Example: @Query("SELECT g FROM Grupo g where g.? = ?") Page<Grupo> findTeste(String…
-
3
votes1
answer2200
viewsHow to make a Carousel?
I’m trying to create a Carousel on Android as the of this video (source code) but it’s not going very well.…
-
3
votes3
answers135
viewsDifference of null and another proposition using this null object
If I have a code, for example: if(window!=null && window.isOpen()){ //todo } If window for null, Will he still try to call the second proposition or not check anymore? Because if he tries to…
java operators nullpointerexception null conditionasked 8 years, 3 months ago Mateus Carvalho 1,494 -
3
votes2
answers5650
viewsHow to turn on the camera flash?
I am not able to activate the camera flash to use as flashlight. The code I am running took from tutorials on the internet. package com.getten.home; import android.hardware.Camera; import…
-
3
votes1
answer161
viewsHow to receive automatically, in Activity, a value calculated in a Service?
I have an algorithm that generates prime numbers using a Service. Well, it works but I need it to update the data in my Activity automatically, at the moment it does this just by clicking on a…
-
3
votes2
answers252
viewsLogin to an Android APP
I am having trouble authenticating my user when the user is checked it returns me a successful response but my application does not exchange Activity. Just follow my codes: PHP: <?php…
-
3
votes1
answer1218
viewsAnimation when you touch the button
I have a registration screen, where a standard photo is already set. If I press on top of the photo it opens 2 options to change the photo. Either grab by the gallery or take a photo. By clicking on…
-
3
votes2
answers302
viewsQuestions about the Spring XML file?
I am developing an application that uses JAVA SE + SPRING. I have some questions regarding XML: Where I create the file xml of Spring ? What name do I give to the arquivo xml ? XML would be the…
-
3
votes1
answer1585
viewsGenerate Runnable Jar from a Maven project
I am having difficulty generating a Jar file from my application from Maven, I followed the following tutorial. Mkyoung.com It comes to generate the Jar but with a super reduced size and at the time…
-
3
votes1
answer75
viewsWhen declaring an interface in the class, who should implement it?
class Gerente extends Funcionario implements Autenticavel { He meant that Gerente implements the interface Autenticavel, or Funcionario which will implement the interface?…
-
3
votes1
answer767
viewsHow to pass a list of an object that contains another object (composition) to a JSON
I have two classes: Contact and Operator. A in the Contact class I have a composition: private Operadora operadora; I have a DAO where I have a class that returns a list of Contacts, in the console…