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
-
2
votes2
answers801
viewsConfirm form closure
I need to ask if I want to close the window that is open. I made the following form, but in any of the options, it closes. I currently use this event option: private void…
-
2
votes1
answer107
viewsDoubt RMI and JNDI
Talk to you guys!, currently I started studying RMI (Remote Method Invocation) with JNDI (Java Naming and Directory Interface). Briefly, from what I have learned so far is that the RMI technology is…
-
2
votes1
answer73
viewsTesting RMI with Junit
How to test a client/server application using RMI with Junit? I’ve searched a plethora of places and found nothing to help me.
-
2
votes1
answer128
viewsHow to position a component next to the Windows clock?
I learned that to center a component in the center of the screen just use: frame.setLocationRelativeTo(null); But how do I show the component on top of the Windows clock independent of the screen…
-
2
votes2
answers123
viewsHave a loop run again
Code: while (digita != 4){ System.out.println("Digite o o número referente ao tamanho da(s) pulseira(s)\n1.Pequena (17cm) - R$180,00\n2.Média (18cm) - R$200,00\n3.Grande (20cm) -…
-
2
votes2
answers873
viewsApache Commons Email does not send email using Gmail
Click here to open the repository in Maven Repository for Apache Commons Email. I have the following code that receives from a form the recipient, subject and the message: @RequestMapping(value = {…
-
2
votes1
answer1395
viewsHow to pick up Form value - Java - Swing
I created a form on Java interfacing Swing, in this has a field textfield Text and a button Send, in the code of the button need to assign the value informado in the textfield to a variable of the…
-
2
votes1
answer79
viewsJava, difference between Integer.TYPE and int.class
What is the difference between using Integer.TYPE and int.class? I did some tests and both can be passed as a parameter to a Class<?>.
-
2
votes1
answer126
viewsIs there any way to start a Thread that is in a method in another class?
I have a method and within it a thread, I needed to "startar" it from another class and then check when Thread ran out. Is it possible to do this? my code: Thread th; public void inserir(){ th = new…
-
2
votes1
answer530
viewsPersistence.xml and Eclipselink error in glassfish
Hello guys I’m with this problem after I migrated the project to another machine, I’m using Glassfish with Eclipselink in the database using Postgres 9.4 if anyone ever came across this error could…
-
2
votes1
answer1208
viewsCall method when Enter key is pressed
How to call send message method when key Enter was pressured? Code @Override public void keyPressed(KeyEvent e) { String messageSent = "User: " + writingTextField.getText(); if(e.getKeyCode() ==…
-
2
votes1
answer476
viewsWeb Service Java in Openshift using Tomcat 6 (Jboss EWS 1.0)
I’m trying to create a Web Service in JAVA so it can be consumed by an Android application. I need to use a Cloud technology, and only found the free Openshift and best recommended for now... Well,…
-
2
votes1
answer339
viewsProblem when rendering small percentage in Piechartmodel in Primefaces;
I am generating a graph usually without problems, only occurs with smaller percentages, showing the 'slice' correctly, but the value of this percentage is not displayed. I tried to change the…
-
2
votes1
answer107
viewsWhich event shows if the android keyboard is active or not?
There is some event or method that shows if the keyboard is active on the android screen, because I need to do this check in a Fragment.
-
2
votes2
answers742
viewsError sending email with Javamail
It was working normally. Now when I run the program the following error appears: Could not connect to SMTP host: smtp.gmail.com, port: 465; This is my way public void enviaEmail() { Properties props…
-
2
votes1
answer5362
viewsWhat is the purpose of the @Transactional(readonly = false) annotation?
Annotation used for service injection in the Spring Framework.
-
2
votes1
answer2126
viewsAngularjs User Authentication with Java/Jersey Rest API
I am developing the user authentication module in my application and I am having some problems accessing the API, getting error 403. The old way I was doing, when I sent the request to the service,…
-
2
votes1
answer163
viewsRelationship between classes Composite key error: not Mapped to a single Property
I have a Cvariacaoto class that has a composite key (FK_T, FK_F, FK_F_VARIACAO). Two of these primary key fields (FK_F, FK_F_VARIACAO) are also foreign key to the Fvariacaoto table, in a Manytoone…
-
2
votes1
answer39
viewsHow to change the life cycle of the Maven?
I have an EJB project and would like to run the test after deploying my Air. Because I have a test on the ejb layer, which needs to access the ejbstubs inside the server(was), before I did it with…
-
2
votes1
answer98
viewsRegular Expression
I have an application that reads a string and needs to detect parameters contained in the string. The parameter has the following pattern <<<.texto>>> (< and > are part of…
-
2
votes1
answer1674
viewsChained lists in Java
Assuming that I have a list chained Students, where one must register name and note, however this same student may contain more than one note. In my logic, he only registers a student with a single…
javaasked 9 years, 7 months ago Dan Lucio Prada 772 -
2
votes1
answer510
viewsFormat Textarea Javafx
I am creating a kind of Notepad, and I am trying to find some form, so that the úsuario can format its letter, size, color etc in a Javafx Textarea. Would anyone know if Javafx has a specific…
-
2
votes1
answer299
viewsMethod that checks if the status is ok
I have this code right below that makes a connection to my server. I would like to perform a status check of my server through a method that connects to that server, how can I implement this? public…
-
2
votes1
answer41
viewsProblem with selection in Mysql
Guys I’m starting in this business and having difficulty in selecting in more than one table. My selection command was as follows: Table 01: select * from veiculo;…
-
2
votes3
answers1110
viewsI have 5 threads running in parallel. How do I know when they’re all gone?
If I make one join for each of them, they will perform in sequence, one at a time. I needed to start the 5 in parallel and know when they all finished to do something. Does anyone know if and how…
-
2
votes1
answer673
viewsHow to create Android app that uses native mobile phone software such as camera, gallery, etc
How do I use mobile resources ? For example: I create an app, that when the user clicks on "Such" button, open the camera of the mobile phone... or the gallery... or alarm clock. I wanted to learn…
-
2
votes1
answer1392
viewsGet item value in focus on a Jlist?
I have a Jlist and would like to take the value of the item that is in focus on it, not want to capture this value with click or with some button, but rather just changing the focus(by clicking on…
-
2
votes1
answer1313
viewsRecover the value of a Jtextfield via an Actionlistener
I’m a little new to java and I was trying to understand the listeners. So excuse me if the mistake is simple. I have a program that creates a simple graphical interface and I want to get the value…
-
2
votes1
answer774
viewsJPA/Hibernate problem with competition and persistence in the JRE
I am working on a project to create a simple server running over Java SE. I am using JPA + Hibernate to perform persistence, but competing routines are a problem. I am spending a lot of time trying…
-
2
votes1
answer45
viewsHow to get position(x, y) of lower Node in Borderpane relative to the screen?
I have a Borderpane where you define your bottom value with an Hbox: borderPane.setBottom(new HBox(children)); I would like to know the position (x,y) mainly the y of Hbox in relation to the screen.…
-
2
votes1
answer36
viewsCapture values via a button
Good night ! I am developing an app to perform calculation of the amount to bill from labor to customers according to the type of service. However I’m having difficulty in the last screen where will…
-
2
votes0
answers543
viewsError "with.sun.faces.mgbean.Managedbeancreationexception"
I have a class annotated with @Managedbean with correct import and the error occurs below, as the log shows. How do I solve this problem? This happens when I call a controller method in the view.…
-
2
votes1
answer55
viewsConcatenate values in the Jfreechart chart
How to concatenate values in jfreechart? I’m trying this way: public static DefaultCategoryDataset dataset = new DefaultCategoryDataset();; public void atualizaDataset(int humano, int zumbi, int…
-
2
votes2
answers1773
viewsJava args pass file as parameter
I am doing a graph work where I have to make a library and after generating the jar in the execution I need to inform two parameters that are txt files, in the first will be the input data in the…
-
2
votes1
answer106
viewsJava class version
I wonder if in java I can specify a tag, or manifest, or something like that for a class or library and be able to query it within the Java code itself guy : @version 2.6.5 Class Pessoa { ... } and…
-
2
votes1
answer292
viewsCollect data from a Jtable and send to a List
In my Java application, I have a sales screen where the products that are selected go to a JTable. At the end of the sale, I need to collect data from JTable and deliver to the printing method,…
-
2
votes2
answers445
viewsI cannot generate a pdf file
Personal how to generate PDF file using ITEXT with JSF. The problem and the following, when I ask to generate the PDF file in a class having only the MAIN method, it generates normally, but when I…
-
2
votes1
answer71
viewsCheck text from file
I have a text file with the following content: Name: Number: Password: What I want to do is read this file and check if after : it has some character. Another question on the same subject: How can I…
-
2
votes1
answer412
viewsHow to set up Jersey 2.22 in the project?
I’m having a hard time setting up Jersey 2.22.1 on my web project that is deployed on the server Tomcat 8, that I’m developing in Netbeans. Note: I use Maven. I have read and reread the…
-
2
votes1
answer5287
viewsStackoverflow
Hello, I wonder why I get the Stackoverflow error in this code, but if I add one more condition in the recursive method, that is if(list.contains(Numb)) I don’t get this error. (This code would be…
javaasked 9 years, 7 months ago Geovane Wickert 111 -
2
votes1
answer844
viewsComplexity analysis
I have a question about the complexity analysis of this code in Java: public static int cont; public static int recursive(int base,int numb,ArrayList<Integer> lista){ if(lista.size()>base)…
javaasked 9 years, 7 months ago Geovane Wickert 111 -
2
votes1
answer838
viewsShoot event by clicking on day in Jcalendar?
How do I place an event in each Jcalendar day? My intention is to click on a day and create a kind of reminder that is related to the day, in a way that when the user clicks on the day again he sees…
-
2
votes1
answer655
viewsGrab attributes from a Thread object?
Is it possible to take the attributes of a Thread object? because I am using threads to read several files (one per thread) (which have float numbers separated by n) store the floats to sum the…
-
2
votes1
answer320
viewsHow do I format the value of a double variable on android?
I am making a small application that aims to calculate the BMI of a person, but I am not able to format the output of the value to only two decimal places always looks like: 22.222222 or 31.23232322…
-
2
votes1
answer90
viewsDoes Webservice (Asynctask) only work with Debug?
I’m making my Android app upload data from a Webservice. In it, I will load date data into a Spinner and, when it is complete, the same dates will load other data types into a Listview, but for now…
-
2
votes1
answer63
viewsWhat is the difference between Sessions Beans and Message Drivebeans?
There are two components responsible for business logic in the EJB architecture, the Session Beans and Message Drivebeans. I would like to know the difference of both and some example of their use.…
-
2
votes2
answers1159
viewsHow to limit the number of houses before the comma in a regular expression?
I am using this expression to not let the user type point before any number and limiting 2 houses after the comma, but I also needed to limit 5 houses before the comma, the way it is I can enter as…
-
2
votes1
answer251
viewsDoubt with Vraptor Download Images
I have a question about the function of Download Vraptor, I have an IMG on my server and I try to display it in my Mobile Application but when I request the served it does not return me an IMG type…
-
2
votes2
answers119
viewsHow to get the type of component clicked?
The getSource() method returns the event source, there is some method that returns the event source type, whether it was a jlabel, or jbutton, something like?
-
2
votes1
answer1199
viewsWhen I use an "Endpoint" class to publish a Web Service, where is the WSDL created?
For example, I have 3 classes in my Web Service: 1 - A SEI (the web service interface): package calc; import javax.jws.WebService; import javax.jws.WebMethod; import javax.jws.soap.SOAPBinding;…