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
answer62
viewsHTTP Status 404 - Not Found - with Spring, Hibernate, Jpa, Mysql eTomcat
I made a change in my project passing the responsibility to Spring to control the transactions according to Caelum documentation and other examples I searched the web, already searched for…
-
-1
votes1
answer187
viewsResultset Return null in Java
I use the code below to check in Postgre if the table exists, running the Query in Pgadmin have as answer value null. But apparently Resultset will never return null. Is there any way to compare RS…
-
-1
votes1
answer27
viewsDelete position of array
Good afternoon I have an order app, record the items within an array when I need to delete an item from the request, somehow the array size does not decrease for example I registered 3 items and…
-
-1
votes1
answer195
viewsSpring Boot and Hibernate - problems to move up application and map classes into entities
the thing is, I created a page using Spring Boot, Thymeleaf, Hibernate e Mysql para cadastro de estacionamentos e veículos mas estou muito perdido em relação ao mapeamento das entidades e…
-
-1
votes1
answer48
viewsgetWindow() command is not recognized
Someone help me for love of desu, to using SDK 29 so the problem is not that at least...…
-
-1
votes1
answer18
viewsthe image I want to put in the window n appears what I do?
import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JLabel; public class Janela extends JFrame { ImageIcon imagem = new…
-
-1
votes1
answer208
viewsjavax.net.ssl.Sslhandshakeexception: Received fatal Alert: bad_certificate
I am trying to authenticate on a web page with digital certificate, but the above error occurs. There is a "workaround": Import the certificate into Windows and re-export. In this process, the file…
-
-1
votes1
answer210
viewsVariable pom.xml that shows the location of the file
I use Ubuntu 18.04. My project is on an NTFS partition. I need to know which variable shows the location the pom.xml file is in. I’m using the ${basic} variable, but it’s not showing where the…
-
-1
votes2
answers543
viewsHow to generate random numbers without rethinking in Java?
Something similar to the code below. Numbers in the Random range that do not repeat public void sorteiaCartelaB() { for (int i=0; i < b.length; i++) { b[i] = (int)(Math.random() * 60 + 1); for…
-
-1
votes2
answers2844
viewsHow to make the Discord bot send a private message
I put the code like this if (message.content.startsWith('.send')) { message.guild.member(462005459184910339).createDM() } but it doesn’t work, I’m using Discord.js…
javaasked 5 years, 2 months ago Enzo Leonardo Gonalves Almeida 1 -
-1
votes1
answer851
viewsError adding students to a class 'The Given id must not be null! '
When I click on Include student appears this error but I do not understand why, someone to give me a light, thank you. Console error java.lang.Illegalargumentexception: The Given id must not be…
-
-1
votes1
answer48
viewsAnsible does not execute mvn clean install command
The problem is that amid a deploy automation for approval, I have to execute the command mvn clean install only that I saw Ansible. my task is like this: - name: Build projeto backend command: mvn…
-
-1
votes3
answers3421
viewsWrite to files without erasing its contents
How can I write to a file without deleting what’s inside it? I’m using the classes below. public void criarArquivos() throws IOException{ /*1 forma*/ FileWriter arqTeste = new…
-
-1
votes1
answer64
viewsProblems with cast in Reflection
Good afternoon. I’m new to using the java Reflection API. I’m having the following problem, when trying to create a generic Dao class to be used in a CRUD for sqlite on android, I can’t cast a field…
-
-1
votes1
answer89
viewsHow can I take a private variable in another class in Java?
I’m having a question about how I can catch one private variable in another class. I’m wanting to put all in private so I have better control and organization. Example: Class Inicio Private int…
javaasked 5 years, 2 months ago Sr Kassiano 3 -
-1
votes1
answer251
viewsMockito returning null Spring Boot + Junit + org.mockito.Bddmockito
Everything all right, guys? At the time I make a mock my error application and returns null of the mock, I have tried several ways to resolve, but it does not send anything different, could help me?…
-
-1
votes1
answer259
viewsThymeleaf vs Angular
My searches say that Thymeleaf is a template engine that renders on the server, while Angular would be a front end framework, which renders on the client. I ask you. 1 - My search is correct, you…
-
-1
votes1
answer59
viewsMy Spring Data Hibernate project does not create the tables in SQL Server
I am studying Spring Data with Hibernate and I am using the SQL server database. I set up the project, with the dependencies in the pom file. The project is complicated without errors, but does not…
-
-1
votes2
answers254
viewsUsing Enum in Java
Hey there, guys. The program should randomly generate a "Heads" or "Tails" value, but using Enum. It is not clear to me how to implement the statement below using Enum. Can someone give me a light?…
-
-1
votes1
answer43
viewsAre the Spring Data and Spring Data JPA modules frameworks?
I believe that every beginner has difficulties understanding the concept of a framework. I’m starting to study the Spring framework, within it there are several projects or modules, and within these…
-
-1
votes1
answer54
viewsDoesn’t Arraylist accept Overload Polymorphism?
I am trying to overload the add method, but apparently this does not work with Arraylists. Confirm? Métodos: public int somar(ArrayList <Classe> classe){...} public int…
-
-1
votes1
answer120
viewsHow do I leave my Hibernate (Spring Boot) dynamic query?
Hello I am trying to let my dynamic query down as follows: @Query("SELECT T.NR_EVENT FROM TB_TIMELINE AS T WHERE T.NR_PENUMPER = :customerCode") public List<TB_TIMELINE>…
-
-1
votes3
answers54
viewsProblem when consulting the registered position where it shows null value
Hello I am new in programming but I am developing a code through the advanced Java course of Bradesco site and there the last part is to assemble a system, however I have a problem in the…
-
-1
votes1
answer144
viewsMy Springboot Java EE application does not recognize my Docker mysql container
Good afternoon, For study purposes, I created a java application using Springboot and am trying to set up a mysql database that is hosted on Windows Docker. However, even with the container running…
-
-1
votes1
answer66
viewsHow to create a "want to continue" Java Nide question
public void nfinal(){ double n1, n2; System.out.println("Digite o valor da nota 1 e da nota 2: "); n1 = ler.nextDouble(); n2 = ler.nextDouble(); double nf = (n1+n2)/2; System.out.printf("Nota final…
javaasked 4 years, 9 months ago Alcinthedark 1 -
-1
votes1
answer10
viewsProblem trying to open my java application
I am trying to generate a . jar of a game but at the time of running the application, it does not open and when having open by the error cmd. someone can help me. I thank you.…
javaasked 4 years, 9 months ago Chagas Júnior 1 -
-1
votes1
answer38
viewsJava - How to read a String after a certain character
I have a string that contains the following text "DRINKS/SODA", as I do to read only the word "SODA"? In my code "txtDescGroup.setText(Entity.getDescGrupo1());" Entity.getDescGroup 1() = Is what is…
-
-1
votes1
answer61
viewsProblems to create Springboot
I’m having trouble trying to turn my application into an API using Springboot. I have followed several tutorials on the WEB. However, some dependency problems persist. My program aims to transform…
javaasked 4 years, 8 months ago Paulo Cuba 1 -
-1
votes1
answer18
viewsIt is possible to perform queries in a table that is not mapped by Hibernate
I would like to list data from a table that is not mapped by Hibernate; that is, I have an Endity map table and I want to report a search in a table in my database that is not an Entity. That’s…
-
-1
votes1
answer157
viewsError setting model in Jtable
So people, I was developing a frame that received a table from the database, I used the same scope of the function several times and it worked perfectly, I just modified the necessary to generate…
-
-1
votes1
answer33
viewsCreate options within a Java class
In a game where I have to create a teacher class, and in the creation of each teacher with the specification of the subject, because each one will have a different action. Example: Math teacher…
javaasked 4 years, 7 months ago Claudio Neves 1 -
-1
votes1
answer56
viewsHow to fix 1892 Spring startup error?
When I start my project in Spring Boot it appears to me this error: More information about the error: 2021-02-10 19:41:35.984 INFO 1892 --- [ restartedMain] com.produtos.apirest.ApirestApplication :…
-
-1
votes1
answer53
viewsHow to fix this java error?
I am trying to create an Api with Spring Boot. However, even if I implement all the dependencies in the pom.xml file, the error persists. The error message is: Failed to execute Goal…
-
-1
votes1
answer44
viewsDoubt about the top of a stack in the Java language
I’m a beginner in programming and I was studying some data structures in the Java language. When I started studying about the "stack" structure, I had the following question: Let’s say I have a…
-
-1
votes1
answer46
viewsHow to make a Onetoone in JPA with composite primary key?
How to put a User inside Serveruser? I tried it like this. It creates the database, but it keeps throwing me an exception And also he is creating a new user_idd field, would like to use the user_id…
-
-1
votes1
answer37
viewsHow to import java class from another app’s src folder?
For example, I have several apps. They all have in the src folder the same java class (example: Calculator.java which is the same for everyone). Only when I modify this class, I have to copy it to…
-
-1
votes1
answer23
viewsHow can I get the value of a span tag with jsoup?
public class Main { public static void main(String[] args) throws IOException { // write your code here Document doc = (Document)…
-
-1
votes1
answer40
viewsMultiplication of Values
I have a product sales system In this system the user selects the product in a Combobox, after selecting the product the field Unit Value (Textfield) is filled automatically with the value that was…
-
-1
votes2
answers48
viewsHow to Get the value of a multiplication?
System made in Vaadin + Java + Springboot + Maven + Mysql I have a sales system, where the user chooses the product he wants to buy in a Combobox, sets the amount he wants to buy (Numberfield), when…
-
-1
votes1
answer64
viewsTrying to create my own Java checked exception
Guys, my question is this:: In the file method, I really need to do this Try-catch? In my mind I wouldn’t need to since I’m declaring the throws with my class…
-
-1
votes1
answer19
viewsHow to create pixels on the canvas in java
I am building a drawing app (For a progam workout) and had the following question, How to create plagued java pixels on the screen?
-
-1
votes1
answer65
viewsError trying to email in a spring boot project
I have the following error when I try to send an email in a spring boot project: javax.mail.Messagingexception: Could not Convert socket to TLS;…
-
-1
votes1
answer39
viewsId and Product getting null when saving data Many To One
Whenever I try to create an itemPedido list and use it in a request mapper, it ends up as id and null product. Already trackei with the Debugger and it does not catch the reference with the…
-
-1
votes2
answers25
viewsMake a program that receives as parameters a string and a character to be searched for and enter the index of the last occurrence of the character
I’m stuck in this part and I can’t think what else to do to progress. I have little programming time, what can I do from here?…
javaasked 4 years, 4 months ago Daniel Manhães 1 -
-1
votes1
answer638
viewsProblems with Springboot - o.s.boot.Springapplication : Application run failed
Error Starting Applicationcontext. To display the conditions report re-run your application with 'debug' enabled. 2021-05-13 08:05:53.688 ERROR 14840 --- [ restartedMain] o.s.boot.Springapplication…
-
-1
votes1
answer12
viewsFill a vector using useDelimiter in Java
Hello, I’m wanting to fill a vector using the useDelimiter of Java. For now I only know how to fill a vector this way using for: for (int i = 0; i < vet.length; i++) { System.out.print("Digite um…
-
-1
votes1
answer25
viewsChange Actuator healthcheck endpoint in Spring Boot 1.5
need to change the healthcheck endpoint of my application with Actuator. I’ve tried to management.endpoints.web.base-path=/test management.endpoints.web.path-Mapping.health=healthcheck but it seems…
-
-1
votes1
answer41
viewsHow to view the latest record stored in the mysql database in a Java Swing interface?
I want to display in the java swing graphical interface the total number of users registered there in my database Look what I tried He of error null public void restt() { String sql = "select…
-
-1
votes1
answer35
viewsRegular Expression to validate email provider string - Java
Hello! I’m trying to validate an email provider in Java using regular expression, but I’m not getting a result. I declared the variable for regex as string, but the suggestion is to use Boolean,…
-
-1
votes1
answer36
viewsInvoking methods within an Arraylist does not recognize the object method
I try to invoke the method through the method get().getNome(), but says that the method does not exist.…