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
votes0
answers15
viewsKeyevents not working
I wrote this program recently and I’m having some problems with the keystroke events. It was so that when I pressed a specific key a message would appear on the console, but this is not happening.…
javaasked 4 years, 3 months ago UmCarinhaQualquer 11 -
0
votes1
answer29
viewsMaking a Mistake in Creating a Bean
I created my API with TDD, but when I implemented a new method in my controller the tests stopped working. I created several tests that stopped working when I created loansByBook in Bookcontroller,…
-
0
votes0
answers18
viewsMultiple query with JOIN FETCH command using JPQL
I own the following entity in my application: @Entity public class Produto implements Entidade{ @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; private String nome; private…
-
0
votes1
answer30
views@Requestmapping does not work on Intellij
The same code works on Eclipse and Spring Tool Suit, but not on Intellij Ultimate Edition. I’ve tried to recreate the project from scratch and still nothing. Using the same dependencies and files in…
-
0
votes0
answers81
viewsSpring Boot Admin cannot fetch healt information from client
I made a simple library api but when my monitor tries to fetch her health reports return the following error: Error in client : Failed to register application as…
-
0
votes1
answer45
viewsError declaring Java constants
I have just started my studies in Java and I have a problem declaring a constant: class Ex007 { public static void main(String[] args) { float comprimento, raio = 9f; public static final float PI =…
-
0
votes0
answers13
viewsHow to unlink simultaneous reading of class codes in fragments in Android JAVA
I am creating a java application using fragments but noticed that when the program opens the first fragment, it runs the codes of all java classes of the fragments simultaneously, that is, when the…
-
0
votes1
answer27
viewsHow to do @Autowired on a List<Meucomponente>?
Good morning, I have a component that has injected services. This component is of the 'prototype' scope and is running infinitely. I need to run X components (passed via argument) of these and why I…
-
0
votes0
answers11
viewsCapture only one line of an Excel spreadsheet with POI
Hello, everybody! I have a system that needs to validate the type of cell contents of a spreadsheet line. I wish it was just a line, to avoid going through all the lines in the file, to avoid…
-
0
votes0
answers12
viewsHow to make partial submission through a dialog called in the datatable?
Hello, I have a datatable of the first faces that shows registered patients. In this datatable, I have a button that leads to a screen to inform the patient’s blood type (blood type and RH factor…
-
0
votes0
answers24
viewsFat Jar Eclipse Plug-in does not appear in Export
I need to extract a "fat" jar, I installed the Fat Jar Plug-in in eclipse (https://sourceforge.net/projects/fjep/). Eclipse Version: Luna Service Release 2 (4.4.2) Extract the jar to the plugins…
-
0
votes1
answer35
viewsCORS error when using fetch API js - source destination
Well, I’m trying to use pure Js and html, to consume an api, running on the localhost. Follow the codes: Java Javascript(running on a local server) but it returns a Cors error, which I am placing…
-
0
votes1
answer70
viewsAlgorithm performance in JAVA
Good afternoon, you guys. I have the following exercise to deliver: Challenge Mr Milli, Petland City resident, is the famous owner of the world’s largest board game factory. Recently, he had the…
-
0
votes1
answer24
viewsJava function does not return the correct value
I’m not getting the desired value from the recursive function below. I have tried putting a System.out.println to monitor the values of the cycleLength and n variables and the result was that for…
-
0
votes1
answer283
viewsJsonformat with Localdatetime springboot
Hello, I am trying to record in the bank only the time of the attribute of my Entity, I put @Jsonformat(Pattern = "HH:mm:ss") but the error when it will record Resolved…
-
0
votes0
answers16
views -
0
votes0
answers51
viewsProblem deploying API REST springboot on Heroku
Good evening! I am trying to deploy a REST API on Heroku, but I come across the following error: [] [ERROR] Failed to execute goal org.apache.Maven.plugins: Maven-Compiler-plugin: 3.8.1: compile…
-
0
votes0
answers20
viewsHow to run scroll in automated test on Android with Appium?
Hello, good morning! Can you help me? I’m trying to scroll in an automated test on an android, but nothing happens. It’s the screen below: I need to scroll in the three columns in order to select a…
-
0
votes1
answer86
viewsError while compiling SPRING BOOT application
I am trying to compile a java application and is giving this error: restartedMain] j.LocalContainerEntityManagerFactoryBean : Failed to initialize JPA EntityManagerFactory: Unable to create…
-
0
votes2
answers44
viewsI need help on the IF command, it doesn’t work I don’t know why, it closes the program when I write FRONT is to be a writing game
package reading; java.util.Random import; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); String nome; Random rand = new…
-
0
votes2
answers102
viewsHelps to understand the Rest of Division
Boas, I’m having some difficulty understanding the rest of the division, I can calculate and get to the value of the rest and understand the formula, but in the code example described below I’m…
-
0
votes0
answers8
viewsJradiobutton and Jcombobox always send the same value, even if I select another
I’m having trouble even though I’m selecting another field on JComboBox it always returns the moderate value, no JRadioButton It always comes back Male the result. I send the value to the class…
javaasked 4 years, 2 months ago Samuel Goulart 1 -
0
votes1
answer33
views -
0
votes2
answers221
viewsJAVA - How to compare columns of an int[][] array
I have to compare the rows and columns of an array and know if they repeat themselves. To compare the lines, it was "easy", but I’m picking to compare the columns. To solve temporarily I am…
-
0
votes0
answers22
viewsSearchview with Arraylist Android Studio
Good night, I’m a beginner and I’m having trouble creating a Searchview with Arraylist. I have tried several examples or manuals on the internet but without success, I still cannot understand how…
-
0
votes0
answers14
viewsList of properties with Soapobject on Android
I have the following parameter structure in the webservice, and the Alistafoto parameter is a list (array): <parameters> <NCodCli></NCodCli> <AListaFoto>…
-
0
votes0
answers24
viewsTrouble with Rabbit and Spring
Talk about beauty? I’m having a problem using my application with Rabbit via Docker. Here’s what you get: I created a Docker-Compose, it follows: version: "3" services: rabbitmq: image:…
-
0
votes0
answers25
viewsProblem when setting entity in httppost using Java
I’ve been trying to replace a library for hours, can someone help me? I believe that due to lack of jar compatibility, my system is not accepting the following line of code:…
-
0
votes0
answers17
viewsInsert with JXL reading is registering only 36 values
Hello. I am creating a program whose purpose is to read files. xls and save to the bank, but when I use the read method with Insert, it inserts only 36 lines, without presenting errors. Could you…
-
0
votes0
answers13
viewsCapture user date and move on to be selected with BETWEEN Sqlite, Android Studio
Personal I am trying to carry out the selection of a list of data in the database Sqlite, using the following code snippet, the selection in the form that is made below is already working well.…
-
0
votes1
answer77
viewsHow to take the value of a select option and popular within a jsp variable
I would like to know how I get the value of select option and inputo within a variable in jsp. I’m trying the following code plus this giving error : Here I fill select with data coming from the…
-
0
votes0
answers59
viewsDocumentation with Swagger
Hello, everyone. I’m having trouble analyzing my documentation with Swagger. It just doesn’t show up anything but some HTML elements on my page localhost:8080/swagger-ui.html, how the image shows:…
-
0
votes2
answers41
viewsError in java code
I’m starting to learn programming in java, and the following happened: ERRO!!!!! Exception in thread "main" java.lang.Error: Unresolved compilation problems: Player cannot be resolved to a type…
javaasked 4 years, 2 months ago Paulo Ricardo 17 -
0
votes0
answers22
viewsError in creating foreign key fk_client in database
Hello, when I was doing the client table relationship with sales table, at the time of finalizing, the system displayed an error message, so the relationship was not created the message is this:…
javaasked 4 years, 2 months ago antonio ferreira lopes 11 -
0
votes0
answers58
viewsSpring Boot rollback in chain transactions
After validating all entities, I call a method to perform several operations in the bank, in which if one of them goes wrong, all the above must be undone. When arriving at the "throw new…
-
0
votes0
answers12
viewsSend Arraylist from an Acttivity to a Fragment
Good afternoon, everyone, I am trying to send an Arraylist of an Activity to a Fragment that will use it in a Gridview, but I have not been successful. When clicking the button the Activity creates…
-
0
votes0
answers27
viewsJavascript to remove an attribute from AD (Pentaho - modified Java Script Value)
I am trying to remove an attribute from an AD record using Pentaho, so I have this script below. It is returning the error: Can’t find method…
-
0
votes0
answers16
viewsPosition search Itemclick Arraylist
Good Night, I have an Activity with Recyclerview and Searchview by clicking on any cell brings me a new attempt with the information of the chosen cell, but when searching a given word returns item…
-
0
votes0
answers22
viewsHow does the <class> tag work in the persistence.xml file in jpa?
Good night. I’m starting in jpa studies, and in a moment I came across the following situation, I filled in the persistence.xml file as follows: <?xml version="1.0" encoding="UTF-8"?>…
-
0
votes0
answers30
viewsProblem When Streaming Android Camera to Wowza
I’m trying to transmit the camera image of Android by rtsp to Wowza, but without success. No error returns, but also in local Wowza no traffic appears. I have local Wowza for testing at…
-
0
votes0
answers26
viewsHow to call the camera instead of the webview (php) application gallery in android studio?
My code works to call the gallery, but I need instead of the gallery it open the camera first with gallery option. Follows code below import android.app.Activity; import android.content.Intent;…
-
0
votes0
answers36
viewsDifficulty Creating a Session
i’m having a hard time creating a Java Session. I’m creating a registered api called. In short, I have the User Controllers and the Chamadoscontroller. In Callscontroller it needs to receive the id…
-
0
votes0
answers32
viewsConvert Bytearray to Multipartfile without using the Mockmultipartfile class
I have a Bytearray type attribute (byte[]) and would like to convert it to a Multipartfile. After that I would like to take this multipartFile and send it to a function that will perform a request…
-
0
votes0
answers40
viewsException is being printed on the console instead of being sent to the client
public boolean validateToken(String token){ try { Jws<Claims> claims = Jwts.parser().setSigningKey(secretKey).parseClaimsJws(token); if (claims.getBody().getExpiration().before(new Date())) {…
-
0
votes3
answers95
viewsPass Enum value per method parameter
I have a value that stores the status of an element. For example: 1 - sending 2 - Cancelled 3 - Error. The value that will be saved in the database is the numeric value. I have a method that sets…
-
0
votes1
answer41
viewsError in Docker-Compose.yml
Good evening guys, I’m having an error in Docker-Compose.yml, the error shown is as follows: and my code is this: version: '2.4' x-database-variables: &database-variables SPRING_DATASOURCE_URL:…
-
0
votes0
answers44
viewsException java.lang.Noclassdeffounderror: javax/xml/Ws/Endpoint
It is a simple code, where I will create a Webservice with SOAP, but when I run the code in Eclipse it presents me the following error: Exception in thread "main" java.lang.NoClassDefFoundError:…
-
0
votes0
answers56
viewsUnreachable catch block for Unknownhostexception. This Exception is Never thrown from the Try statement body
Speak devs, all right? I am trying to connect Mongdb to a Java application and I get this error: Unreachable catch block for UnknownHostException. This exception is never thrown from the try…
-
0
votes0
answers13
viewsHow to set a postgres function parameter using Native query?
Good afternoon! I created a Native query that uses a postgres function date_part(text, timestamp). My code: String sql = "SELECT " + "(SELECT coalesce(count(*), 0) FROM public.cliente) AS…
-
0
votes0
answers36
viewsHow to return a stream id?
I need to get the ID inside the findById, but I don’t understand how I can do it in stream. @Override public void run(String... args) throws Exception { //TODO ler argumentos com data e workflow de…