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
answer44
viewsI can’t get an app token, help!
Follow my application security classes; Oauth2authorizationserverconfigjwt class public class OAuth2AuthorizationServerConfigJwt extends AuthorizationServerConfigurerAdapter{ @Autowired…
-
-1
votes2
answers48
viewsNull Pointer Exception when trying to perform a @PUT
I’m testing the put by Postman but is giving null Pointer Exception when I try to perform @put @PUT @Path("/{idCliente}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)…
javaasked 5 years ago Lais Sant'ana 29 -
-1
votes1
answer52
viewsI can’t reuse child class method
I created a class ContaCorrente as a daughter of a class Conta. In class Conta have a method saca: public boolean saca (double valor) { if (saldo >= valor) { this.saldo -= valor;…
-
-1
votes1
answer70
viewsHow to remove a Where from @Query in Spring Jparepository
I am using Spring BOOT with Starter JPA and java 8 and I have this query in my Repository : @Query("select p from Product p where p.name like %:name% and p.costValue = :costValue and p.saleValue=…
-
-1
votes1
answer50
viewsHow to leave access to my API open for consultation
I have an application built in Angular2+ and I need to leave an open route for external consultation, without having to log in to the application: Java resource…
-
-1
votes1
answer76
viewsHow to return query results to the Firestore within the Ackground method?
I’m working on a Cookbook app to learn how to use Firebase resources and I’m working on an Activity that should list all recipes already registered by the user. The routines to record data in the…
-
-1
votes1
answer56
viewsbuffered Reader server while(in.read() != -1)
When I am connected by the browser on localhost:80 on the server whose Java code is below, the server reads the request data using class methods BufferedReader. However, the server is displaying the…
-
-1
votes1
answer40
viewsSpring MVC does not recognize static page - CSS
I am doing a project in java using Spring MVC and when implementing the technology my page stopped being stylized, I already looked for the solution in other questions, in the documentation of…
-
-1
votes1
answer184
viewsHow to convert a received JSON into my Spring Kafka Consumer into an entity ready to be saved in the bank?
Good afternoon! I need to consume Jsons from Kafka topics and convert to entities, and so be able to save in the database, Postgres, in case Configuration of the Consumer: @Configuration…
-
-1
votes1
answer68
viewsHow to calculate total currencies - java
The program shows any amount of coins and their values. I need to create a public method that makes the total sum of coins, I’m not getting. package primeiro; public class ControleMoedas { private…
javaasked 4 years, 12 months ago En.Fabiano 1 -
-1
votes1
answer34
viewsDecision coming straight to Else
I want to call another screen from the Intent, but the decision is going straight to Else. Can anyone help? package com.example.login; import android.annotation.SuppressLint; import…
-
-1
votes1
answer66
viewsHow to pass multiple lists in a query? Using JPQL
The problem is this: I have a controller that receives a list of Integers: [1245,12346 ...] In my table I need to consult using this list but the columns are separate, IE, the first digits are in…
-
-1
votes1
answer72
viewsAndroid Studio does not recognize some commands
Does anyone know how to fix it? Out of nowhere these two commands stopped working Note: When I run the application there is no error, but it still shows that there are errors in the code for some…
-
-1
votes1
answer23
viewsModify innerhtml by
I’m trying to create HTML tags that will each receive a different value from an array. For this I used innerhtml to create the content, but they are superimposed only on the first div. var y…
-
-1
votes1
answer119
viewsHow to get the table name of the first select Oracle?
I have the following oracle query: SELECT * FROM TABELA_PESSOA A WHERE A.CPF IN (SELECT B.CPF FROM TABELA_CONTA B WHERE B.CPF = A.CPF) I want to get the table name of the first select which is the:…
-
-1
votes1
answer138
viewsMy application is done in webview and by clicking back with the android phone button it shows the msg Auncher stopped
This is my code Mainactivity.java when running on a device I click the back button simply appears the message Launcher stopped I really need to understand what is missing in the code my main concept…
-
-1
votes1
answer89
viewsShould I use Thread.Sleep() for my program not to occupy the processor?
I have a small group of classes that implement a game of Snake with two players, the game is working as expected. But I’m using one while infinity that is operating at the maximum speed that the JVM…
javaasked 4 years, 11 months ago Pirategull 659 -
-1
votes2
answers70
viewsHow to open a new screen through a Button ? (The Button is inside a Popup)
package com.example.ConsultoriaRuiz; import android.app.Activity; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import…
-
-1
votes1
answer104
viewsTake an attribute from another class and put as parameter in a constructor
I have a tremendous doubt that I can’t find a solution! I’m trying to get a constructor to take an attribute from a class and make it as a parameter as shown in the following code: public class…
-
-1
votes1
answer76
viewsFind out Docker-Compose error
I own the following Docker-Compose: services: mysql: image: mysql:5.6 ports: - "3316:3306" volumes: - ./database/setup:/docker-entrypoint-initdb.d - ./database/data:/var/lib/mysql -…
-
-1
votes1
answer219
viewsAbout the onActivityResult() method in Android Studio
Good afternoon guys, I have a job to deliver done in Android Studio, I was trying to send Strings by intents, my teacher said that the correct way would be using startActivityForResult() and…
-
-1
votes1
answer42
viewsDoubts with JDBC
I am using the JDBC driver to connect my program to the database and when I use the getString method it makes me a string that I can print on screen but when comparing this string that it returns to…
-
-1
votes1
answer44
viewsProblem with Java Activity in Android Studio
Good afternoon, I’m facing a problem that whenever I update two different nodes on Firebase from a single véz, a Activity simply opens again overlapping the Activity current. Follows the code below…
-
-1
votes1
answer34
viewsFailure to update variables
I am developing a project in java, a "farm game" where there are several Tats for the character that is created. When we create a character defenimos which his class, it will influence his Stats. My…
-
-1
votes1
answer527
viewsHow to popular a list to DTO more simply
To show the list of a register in my system, I populate the query in a DTO as below. My question is: There is a simpler way to popular the query in the DTO list? public List<ObjetoDTO>…
-
-1
votes1
answer52
viewsHow to create a function to display the largest numbers of a B tree in Java?
I have a question, how to make a function that returns the Knot with the highest value of a tree B that stores integers. I’m trying to adapt the ride code in order to try to return, but only returns…
-
-1
votes1
answer39
viewsI can’t access the player’s Boolean, how do I proceed?
the code import java.awt.Canvas; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import…
-
-1
votes1
answer37
viewsforeign key registration method
I’m having trouble with the foreign key. I have a company record and in this register I put 3 foreign keys, which is that such relationship 1:n, right? Anyway, I can only put the columns on the…
-
-1
votes1
answer68
views -
-1
votes1
answer69
viewsHow to connect Oracle to Java? This error appears "Error while registering: oracle.jdbc.driver.Oracledriver"
import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; public class…
javaasked 4 years, 10 months ago ariel batista 1 -
-1
votes1
answer64
viewsConsumption of URL https IBPT
I need to consume the new IBPT url to do tax calculations without importing tables. The url is this : https://apidoni.ibpt.org.br/api/v1/products?token=..tMobi=un&valor=34000.00>in=sem gtin…
-
-1
votes1
answer37
viewsC# Lambda for Java Lambda
I have this code in C#. A lambda expression that searches for files in a directory using regex and plays those files in a function by running a command line. All found files are added in "Task" to…
-
-1
votes1
answer291
viewsSpring Boot - Error when redirecting to listing page after registration deletion
I’m starting with Spring Boot, my difficulty is in defining redirects (paths). The current error occurs in redirecting after deleting a record. On the page that lists all the properties I have the…
-
-1
votes1
answer101
viewsHow to capture a json field in java?
I have that code: public static void main(String[] args) throws JSONException { String filmes[] = new String[2]; RestTemplate restTemplate = new RestTemplate(); String resposta =…
-
-1
votes1
answer47
viewsGift format text converter for Java language Moodle
I am beginner with programming mainly in Java, I have doubts about how to work with String in an arraylist, I would need to access each line in the text and modify it. Asterisk response * are…
javaasked 4 years, 10 months ago Weslley Bezerra 3 -
-1
votes2
answers49
viewsHow do I solve the problem of this instantiation?
program class package application; import java.util.Locale; import java.util.Scanner; import model.entities.Account; import model.exceptions.DomainException; public class Program { public static…
-
-1
votes1
answer51
viewsBanner Admob with display problems
I developed an Android app in Java and added a banner on it to display ads. In test mode it is displayed, but when I put the Admob banner code it does not display the banner on the screen, but the…
-
-1
votes1
answer13
viewsWhen creating file, delete at the end of the run
I have the following strange behavior. I am creating a text file using Filewriter and Bufferedwriter. At the end of the run (void main), the generated file is deleted. If I debug and stop the…
-
-1
votes1
answer20
viewsfindAllbyId bringing the same result to the whole query
I’m having a small problem, my query is returning the same result on all Rows. Example: Code: @NamedQuery(name = "UtilizadorPerfil.getByFilter", query = "SELECT u FROM UtilizadorPerfil u WHERE…
-
-1
votes1
answer333
viewsHow to make the back-end and front-end connection?
I need your help. I have an HTML form, which requests two types of data from the user, Height and Weight. And I have a code in Java that will receive these two data and calculate the BMI. My…
-
-1
votes1
answer246
viewsHow to take an entire Edittext value
I’m having trouble with the method validar() where I want to take an entire amount of the EditText to be able to compare a result in the if. I have already tried casting but does not support the…
-
-1
votes1
answer71
viewsMy navigation Drawer no longer goes to my screens, just a logout button I made, the others do not call the other screen
public class MainActivity extends AppCompatActivity { private AppBarConfiguration mAppBarConfiguration; ImageView imageView_Carrinho; @Override protected void…
-
-1
votes1
answer45
viewsjava.lang.Nullpointerexception error even with instantiated and initialized object
Good afternoon, In the code below I have already entered the Supplier class within the main Product and even so continues the error below, Can someone help me fix and explain why it’s wrong so…
java classes nullpointerexception instantiate-object initializationasked 4 years, 9 months ago Deivson Bezerra 149 -
-1
votes1
answer144
viewsHow do I calculate the angle of an object in java?
In case I am making a game and have a player and an enemy (the enemy does not move). I would like the enemy to always throw himself towards the player and for that I need to find the angle of the…
-
-1
votes1
answer262
viewsProblem to download Maven dependencies in Netbeans
I am Noob on Maven and I ended up picking up a project I’m having trouble running in netbeans: > Plugin org.apache.maven.plugins:maven-resources-plugin:2.5 or one of > its dependencies could…
-
-1
votes1
answer136
viewsHow do I "settar" the digital certificate, when implementing wsdl from Sefaz, via cmd wsimport?
Hello, I’m trying to implement the java classes, by wsdl of the Sefaz web service, via cxf wsimport. As you all know, to consume Sefaz web services, you need to have a digital certificate, and I do.…
-
-1
votes2
answers292
viewsBasic - Java: error: class, interface, or Enum expected
I am learning POO by Java and this would be my first code, outside the classic hello world kkk. How long to compile it via bash, the following error appears: class2.java:12: error: class, interface,…
-
-1
votes1
answer37
viewsWhen adding Authentication Filter in Spring security, it is not possible to access the H2-console
Hello, I created my spring security configuration class, but when adding the authorization filter my access to H2-console was lost: @Configuration @EnableWebSecurity…
-
-1
votes1
answer35
viewsScanner not working
I’m trying to do a little programming, but the scanner doesn’t seem to be working. Whenever I put to print it returns 0 independent of the numbers, which was to return the highest number. It works…
-
-1
votes1
answer32
viewsError calling save method using JSF Hibernate JPA An established connection has been overridden by the software on the host computer
I am trying to save the data from my form but when I click save of error saying that "An established connection was annulled by the software on the computer". But when I test the save method using…