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
answer291
viewsAndroid error with KSOP2 value Double java.lang.Runtimeexception: Cannot serialize:4.0
Guys I created a webservice Soap in java, I consume and perform operations in various methods, however when I will perform operations passing a double value occurs the following error:…
-
0
votes1
answer163
viewsIO Exception error when trying to manipulate a file
I have already compiled and run the program in Netbeans and it works normally, but when I run it through the terminal always gives the IO Exception error. Is there any other way to read files…
-
0
votes1
answer14
viewsLike implying Mouselisteners on a Gridlayout?
I created a GUI for a Board of a game with an 8x8 Gridlayout. In this Grid I need to have a mouse Listener in each of the containers. How do I get that? I’ve tried many ways and I’m not getting it.…
-
0
votes1
answer353
viewsProblem running application
Following this tutorial here, when you arrive at the first execution, my project does not run I downloaded my initial project from Springinitializr. My pom.xml file looks like this: <?xml…
-
0
votes1
answer101
viewsHow to reuse a String in another Step of my test?
I have a question (maybe simple for most) and I needed your help... I am programming an End-to-End Flow of Apis using Java, Restassured and Cucumber (to define my Steps). In my first API a return…
-
0
votes1
answer87
viewsCharts Primefaces
I am having the following problem I have the following class that receives the values of the graph of information collected in real time from the bank @ManagedBean public class ChartView implements…
-
0
votes1
answer47
viewsDownload bytes docx api Rest
The code shows a method that is called by the browser to generate a PDF. The bytes were generated by Jasper. The code works normally. @GetMapping("/relatorios/teste") public…
-
0
votes1
answer52
viewsHow to get data from Jframe
Hello, lately I have the following question: how to take a data that was generated in a jframe and send to another class. The idea is to use the jframe just to fill and return me the values that was…
-
0
votes1
answer103
viewsXamarin Build FAILED Error: Unsupported major.minor version 52.0
I’m using Xamarin Visual Studio Comunti 2015 After compiling a project, I get the following err: Exception in thread "main" 1>java.lang.UnsupportedClassVersionError: com/android/dx/command/Main :…
-
0
votes1
answer887
viewsRegular expression for monetary value
Watch the code in Java: String valor = 1.500,00; Pattern pattern = Pattern.compile("\\d+(\\.\\d{1,2})?"); Matcher matcher = pattern.matcher(valor); if (matcher.find()) { System.out.println("Valor…
-
0
votes1
answer263
viewsSwap button after JSF click
Talk personal I have the following problem, I have these two buttons that make: X : Removes the value of a chart + : Adds the value of a chart I need it to look like this: When I click the X button…
-
0
votes1
answer800
viewsFree access to the Tomcat management screen
I have installed Netbeans 8.1 in this installation, I took advantage of installing Tomcat 8.0.27. However I am not able to access the management screen, because it asks the password. I tried several…
-
0
votes2
answers65
viewsSwap one text for another using a string in the Menu
I’m having a problem and I’m not finding a solution, I have a string in a class java, that string is: R.string.text I will make a menu and put in the app preferences, to select only 1 option, and…
-
0
votes1
answer371
viewsTable relationship - Spring Boot Hibernate: Error accessing field [private int
Good morning everyone! I am having problems in the relationship of entities in the api, the bank was created correctly by Spring as can be seen below: Relationship Manytomany in trip table: @Id…
-
0
votes1
answer24
viewsUse class data in multiple Jframes
I am developing an application with several JFrames, I created a class called Person with several attributes to be used in JFrames application. My main question is: where should I instantiate this…
-
0
votes1
answer1216
viewsList Filter in Java
I am filtering one ArrayList<ArrayList<>> which I have to check whether certain data have already been entered inside it, detailed form: int index =…
javaasked 5 years, 4 months ago Guilherme Massao 13 -
0
votes1
answer72
viewsReturn/save problem in a JAVA list
Good night, I have a Master Class: import static javax.swing.JOptionPane.*; import java.util.ArrayList; import java.util.List; import static java.lang.Integer.parseInt; public class Principal {…
-
0
votes1
answer120
viewsDelete button function does not work
I’m developing a software for tcc I have already created the connection to the database and the function of entering data into the database when programming the following code to delete button, it…
-
0
votes3
answers102
viewsCheck number in database
In my database I have a table called "Matrices". In this table I record the livestock matrices I own on the farm, and each matrix has its respective number, which is stored in the "Number" column of…
-
0
votes1
answer84
viewsHow to adjust the regular expression in Java?
Look at the code: Pattern pattern = Pattern.compile("^\\d{1,3}(\\.\\d{3})*,\\d{2}$"); Matcher matcher = pattern.matcher(dadosCSV[position4]); And I took this regular expression already ready, it’s…
-
0
votes1
answer64
views"short s = 2;" Does Java already understand 2 as short?
I know that by default when initializing a variable of an integer type Java classifies it as int, but in the case of short s = 2, Java already understands 2 as short? Or is there some conversion?…
-
0
votes1
answer173
viewsHow to close app when clicking a Dialog in Mainactivity?
My app has several activitys. Some of them have a Dialog that when clicking on it, the application goes back to Mainactivity. I want when you click yes in the Mainactivity Dialog, the application is…
-
0
votes0
answers54
viewsDoubts structure of a crud on Android
I have the following classes: Client, Clientedao and DAO. In the Client template I have attributes and gets/sets. In Clientthe I have the methods save(), change(), ... ie the crud. This class…
-
0
votes1
answer37
viewsI need to modify the action taken when closing a Jframe
I am developing an application with persistence in Java for a college job, and I need the system to automatically save the data when closing the application (with a ready function provided by the…
-
0
votes1
answer57
viewsEdittext does not accept Keylistener
Eae guys, I’m trying to define a Reader for an Edittext but it’s giving error. Error: setKeyListener (android.text.method.Keylistener) in Textview cannot be Applied to…
-
0
votes1
answer98
viewsCss only applies on one page, using Spring MVC
Hello, I’m doing a project using Spring MVC I’m applying a css to the main page and it’s all right. <link href="${contextPath}resources/css/reset.css" rel="stylesheet" type="text/css"…
-
0
votes2
answers1961
viewsPractical example List and Arraylist
I’m creating a list of Estudantes, but I find myself in the following situation. In point 2 gives me error because it says I have to take the Student inside the List but when I do point 1 is already…
-
0
votes1
answer216
viewsI cannot inject Mockmvc into integration test [Spring Boot]
@RunWith(SpringRunner.class) @SpringBootTest public class CustomerRestTest { private static final String BASE_URL = "http://localhost:8080"; @Autowired private…
-
0
votes0
answers39
viewsblock duplicity in a given field
Guys I’m trying to block a "String" field of having duplicity in the record, however I can not do using DB, I wonder if I can do using "If" directly in the code. below follows the code I’m wanting…
javaasked 5 years, 3 months ago Benicius Claro 1 -
0
votes0
answers80
viewsRun a main method in a web project
I’m using the Intellij and I’m with a web project and with the Wildfly already configured in the options Run. I created a class with the main method for testing in this same project and I want to…
-
0
votes2
answers1761
viewsRelative path in Java
I need to read a txt. Only my project has to be extensible. type q does not only work on my machine. I think the txt file would have to stay in the project folder, and put a relative path. but I…
-
0
votes1
answer89
viewsSave Radiobuttom after selection
Hello, someone could help me in this matter, I have a list with questions in them there are 3 Radiosbuttom for responses, what I want is when the user click the save button, he lists the selected…
java android sqlite android-recyclerview radiobuttonasked 5 years, 3 months ago Renderson Cerqueira 1 -
0
votes0
answers80
viewsHow to set a timeout for a JSON request?
I am developing an application in JAVA, Android Studio, and I need to make some JSON requests. So I created an Asynctask class and do so in theInBackground: @Override protected String…
-
0
votes0
answers15
viewsdouble format in a toString
Hello, my problem is this: The exercise asks to print several values in Reais. After the tax calculations on top of this value (done on the object) I have toString printing the values, but it…
javaasked 5 years, 3 months ago Gabriel Rabelo Almeida 1 -
0
votes3
answers1305
viewsValidate element in Selenium Webdriver
I have a certain test, where I programmed to put some plates and then to it click on the button (forward) and then on the button (finish). Only that depends, by the fact that it has some plates that…
-
0
votes1
answer627
viewsHow to save information to an array?
Java masters, I am learning about matrices, vectors and I would like to know what happens to my code, because I create a matrix to receive six names and six positions for the employees matrix. Only…
-
0
votes1
answer48
viewsHandling object only in methods
When I create an instance of a class I can access its attributes only when I’m inside a method, why? In the example below I can give a set in the method main() but not within the class, why? public…
-
0
votes0
answers78
viewsDatetime Angularjs x Java x Mysql Persistence
I created an application in our company to control the use of certain equipment of our industry. The fact is that there was a need to control the date/time of entry and exit of a product in a…
-
0
votes1
answer76
viewsdoubt about JPQL
Hey there, guys. I’m using JPQL in my project to create some database access commands and I’m having trouble manipulating the language. I’m posting the snippet of code I’m having trouble with.…
-
0
votes0
answers59
viewsDoes Jparepository Saveall maintain the state of persistence in memory?
Jparepository offers us options save and saveAndFlush to persist the objects to the database. Unlike saveAndFlush, the save keeps the persistence state in memory, which ends up generating memory…
-
0
votes0
answers102
viewsCheck a regular expression with string in Java
I need to check if a particular digit recovered from a regular expression is equal to my input field digit, I am using the code below but can’t do the check: String digitoSenha = senha.substring(i,…
-
0
votes0
answers21
viewsHow to format field with a mask defined in Java
How I can format an int field to string the following way: Campo int: 62016 final field a string that has to stand "062016"
-
0
votes1
answer23
viewsHow to find the mockite method according to the package?
I’m trying to find the mockito library according to the package below; import static org.mockito.ArgumentMatchers.any; I’ve tried these jars libraries, but no results; mockito-core-1.9.5.jar…
-
0
votes0
answers33
viewsHow do I use LDAP to remove users' access in java or oracle Procedure?
I maintain the company’s personnel system and need to implement a routine that when the employee is retired or fired, he loses access to the network folders. There is a server LDAP that controls…
-
0
votes2
answers199
viewsLoad objects from other classes
I have a selectOneMenu which will be used to list all Generations (data in the database). These data should be listed when registering a Nature object. My selectOneMenu is like this :…
-
0
votes1
answer186
viewsHttpsessionlistener a single session per user
How can I make only one http session is open per user on the system. Main technologies in the project: Spring 4 JSF 2.2 Hibernate 5 Example: The user Juca, works on your computer using 3 browser.…
-
0
votes1
answer24
viewsListfragment Android
Today using a Fragment to solve a problem, I saw that there is a class called ListFragment but what does it do? What’s the difference with a Fragment? When should I use the ListFragment when should…
-
0
votes2
answers63
viewsWhy don’t my labels show up in the swing?
Can anyone help me? It’s a pretty rookie mistake because my Abels aren’t showing up in the swing? import javax.swing.*; public class first{ public static void main(String[] args){ JFrame f = new…
-
0
votes1
answer47
viewsproblems using fail in junit
I want to create custom message for every exception error in my test class, my test is working perfectly, however when I purposely make a mistake it does not come within my exception as you can see…
-
0
votes1
answer268
viewsTake data from one Plain text and put it into another in another Activity?
i have a catalog app that the customer required to be implemented a quantity choice function on each item. For example: I have the product A (in Activitya), the customer wants 25 units. in product B…