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
answers67
viewsTwo questions regarding the use of the Corsregistry.allowOrigins() method
I’m trying to do a post type resquest with credentials (token) for my spring boot built api. But I’m having trouble specifying the source I pass as a parameter to the method…
-
0
votes0
answers271
viewsProblem extracting token from incoming request header in Spring boot. Httpservletrequest.getHeader("Authorization") == null;
I made a CRUD API using Spring boot and used authentication and authorization in this CRUD with JWT (JSON web token). I have a tokenFilter class in my API which is responsible for validating tokens…
-
0
votes1
answer46
viewsDoubt about layers needed in a simple Gateway made in STS
I made a web service json/Rest that plays the role of a gateway, the client sends the request to an endpoint, but the gateway replicates the request for various services. In it, I just pass the…
-
0
votes1
answer252
viewsShow suggestions while typing autocomplete
I got the following autoComplete : <p:autoComplete id="geracao" value="#{habilidademb.habilidade.geracao}" completeMethod="#{habilidademb.listarGeracoes()}" dropdown="true" var="bean"…
-
0
votes1
answer72
viewsProblem with audio in web application with tomcat7 deployment
Hello, I’ve developed a web application that requires audio. I use a javascript code to control this audio call. With the application ready, I transferred to another computer deploying in tomcat7.…
-
0
votes0
answers21
viewsBring values from a Text file to a Listview in Android Studio
I have a file . txt on my phone with the following layout: 123;ManoelEntulhos;Simples;AAA-1111; 456;MateusEntulhos;Comum;BBB-2222; And I want to show him in my Listview this way: 123 ManoelEntulhos…
-
0
votes1
answer21
views" 'case' is not a Valid Java identifer"
I have a question. I am trying to create a springboot project from scratch, but when I try to change the name of my package, I have this problem. When I put any name other than "case" in the middle…
-
0
votes0
answers15
viewsI’m having problems with Exception in thread "AWT-Eventqueue-0" and I’m not getting it right
I need to put information from a database into a Jtable and I’m not getting out of that internship and I can’t find it on the Internet. In this project I need to register residents in an Sqlite,…
-
0
votes0
answers75
viewsHow to work with Classes that have other Classes as a Springboot attribute
Eae people , this is the first time I’m programming for the web and using spring boot for it , is a college project where Frontend will be done in JS with React and Back made in JAVA with Spring .…
-
0
votes0
answers56
viewsNullpointerexception Modelmapper
I’m using Modelmapper, I created a Mapper class where I have some methods that converts dto to a model and vice versa, it turns out I’m getting a nullPointerException when using these methods of the…
-
0
votes0
answers17
viewsCreate Maven dependency between packages
Hello, there is a way via Maven to import only the classes of a project without the dependencies? <dependency> <groupId>basic-service</groupId>…
-
0
votes0
answers50
viewsHow to add a set of libs jar in Maven at once with Vscode?
I wanted to know if this is possible, I have a dependency hit .jar to install(100 .jar of libraries roughly), but the problem is that I have to search each of them and add in pom.xml to work on…
-
0
votes1
answer47
views -
0
votes0
answers94
viewsProblem running a Spring project with Mongodb
Hello, yesterday before giving a commit on the project I tested, and it worked normally. Today when I turned on the PC and tried to test it my sping was not initialized. Can you help me identify…
-
0
votes1
answer2531
viewsHow do I get user id in a session?
I am doing a project using jsp and Servlet, I need that when a user logs in, his id is saved in the session, so that with this id, the system knows that this id user is making changes to his data…
-
0
votes1
answer166
viewsImproving Login Logic - JDBC - Javaweb
I am developing the method of login of an application, but I’ve been realizing that the query I’m running to check if a user is registered in the system and if his password matches the database data…
-
0
votes0
answers35
viewsOutofbounds Error
Good, I would ask you to help me with this mistake! This is part of a game code, the idea and print something like this M M M 123456789012345678901 1 2 M positions will vary with each move, Thank…
-
0
votes0
answers11
viewsCause of Nullpointer in DAO
Good morning, good morning. I’m making the following mistake GRAVE: Servlet.service() for servlet [dispatcher] in context with path [/PortalSega] threw exception [Request processing failed; nested…
-
0
votes1
answer313
viewsData being deleted from H2 database with Spring Boot
I am making an application with Spring Boot and using the H2 bank. When I register a person, they get id 1, if I register someone else gets id 2 and so on, only if I restart the bank I lose…
-
0
votes1
answer220
viewsSpinner with a call icon
Hello, I’m trying to make a spinner with the options: "Open Today" and "It doesn’t matter". In my layout, I do not want anything written and a clock icon to appear, when clicked, load the spinner…
-
0
votes0
answers24
viewsA Restcontroller bean at the same time being a Configuration bean and a Component bean hurts SRP?
In a Java application with Spring I came across a class annotated as follows: import ... @Component @RestController @Configuration public class MySender { ... } At first glance I suspected that…
-
0
votes1
answer57
viewsInclude Button
Good evening, I’m doing a TCC project, and I was wondering which function I can use on the buttons + and -. The idea is a request app, where when you click on + an item will be added, and when you…
-
0
votes1
answer59
viewsError: Firebase API initialization Failure
I’m making the following mistake: Firebase API initialization Failure. From this form, every time I send a notification through Firebase, the "crash app". Bundle dependencies { compile…
-
0
votes0
answers47
viewsHow do I edit a list of objects within a txt file?
I am doing a job in college for the discipline of OOP in java. In this way it was requested a crud operating files ". txt". I’m having a hard time manipulating the list I put in there. I can provide…
-
0
votes0
answers38
viewsCheck whether a string is contained in a char matrix in horizontal or vertical JAVA
For the time being I’ve written this function public static boolean isHidden(char[][] board, String word){ boolean check = false; for(int i = 0; i < (board[0].length); i++){ for(int j = 0;…
-
0
votes1
answer20
viewsReactor - Use orelse after a filter
With the following code: public void deleteOrSave() { Mono.just("someName") .filter(this::isMyName) .flatMap(this::delete) .orElse(this::save); } private boolean isMyName(String name) { return…
-
0
votes3
answers131
viewsSubtract 1 month from a date string in the dd/mm/yyyy format
String data = "09/04/2021"; String charComeco = data.substring(0, 2); String charMeio = data.substring(3, 5); Integer meioTratado2 = Integer.parseInt(charMeio); meioTratado2 -=1;…
-
0
votes1
answer818
viewsHow to take a screenshot save to the project folder and save the path to the Mysql database?
So I have a jsp with form,it converts the image to B64 and sends as string pro Servlet Servlet converts to b643 String stt = request.getParameter("base64img"); try{ String parts[] = stt.split(",");…
-
0
votes0
answers16
viewsTWO BOX CHECK GIVING ERROR
Using this check in case the user leaves the text box blank, he gives me an Alert saying that he has to insert something, but is not entering this part of the code..…
-
0
votes0
answers14
viewsDoubt - List of dependencies that do not exist in the repository
Good afternoon, I wonder if there is a Maven command that parses pom.xml and tells all the dependencies that are in the pom.xml file and are not in the repository. I even found a command mvn…
-
0
votes1
answer105
viewsI can’t get the phone number out of a phone book
I’m not getting the phone number to add to my list, someone knows? public void pegarContatos() { Uri agenda = ContactsContract.Contacts.CONTENT_URI; Cursor cursor =…
-
0
votes0
answers17
views"java.lang.Nullpointerexception" error when trying to search a database list
Good afternoon! I have the error quoted in the title when I try to load the list of Patients from the Database. Follow the code: package servlets; import banco_dados.conexaoBancoDados; import…
-
0
votes1
answer298
viewsUi:repeat - taking Description from the bank
Hi. I would like to know ,how to organize my ui:repeat... why on the page it displays : Change of Schedule and the checkbox field, Nightwork and the checkbox field summing up I wish I could organize…
-
0
votes0
answers12
viewsTake variable from a java file and display inside onCreate
I’m trying to display a value in a Toast which is in a string, in another java file, only the error onCreate does not allow the value is undegistenting someone take a look at me Mainactivity.java…
-
0
votes0
answers41
viewsUnit tests with Powermockrunner showing errors
I have two classes of tests that are run with PowerMockRunner and extending the class JdbcTest. Below follows their source code: Test class ScimImportUsersBusinessTest…
-
0
votes1
answer22
viewsHow to detect auto if the device is horizontal in java
I want to do a script on Java to detect if the device is horizontal or vertical, with if Else, want to be horizontal automatically hide the navigation bar of the device in…
-
0
votes1
answer358
viewsHelp with Date and Time Search
Good Morning I’m doing a date search on android and I’m having trouble checking the time.He says it gave syntax error near the time, and another when I pick the date the time is showing less 3…
-
0
votes0
answers16
viewsVideoview switches to a new Activity Android Studio
Hello. I’m creating an app that in the first Activity shows an introductory video and I wanted when the video ends the next Activity to start automatically. How could I do that? Thank you.
-
0
votes1
answer16
viewsHow do I popular the user, and use their data to popular the View?
MVP is something new for me and I’ve been having some difficulties. I would like to know, how I should create a class to receive the data of my logged user from the Firebase database to popular my…
-
0
votes2
answers33
viewsWhy do I try to divide the value of 0?
package com.company; import java.util.Scanner; public class Lista3 { public static void main(String[] args) { Scanner entrada = new Scanner(System.in); …
-
0
votes0
answers57
viewsTurn JAR into EXE using Launch4j , does not run the program as it should?
I exported an eclipse jar that normally runs it via terminal: java - jar meujar.jar But if I turn this jar into . exe using the program Launch4j , the software can not change the screen , for…
-
0
votes1
answer226
viewsHorizontal Scroll Bar, selectOneMenu - Primefaces
Good Morning, I am developing an academic project using JAVA EE, JSF, Primefaces, CDI, Hibernete among other technologies... The layout is responsive and I’m using Panelgrid to organize the form…
-
0
votes1
answer36
viewsHow to deal with duplicity exceptions in Constraint Unique?
Speak devs, all right? How best to deal with duplicity errors when trying to create field with Constraint Unique? Just let the exception happen? Or I a findByAlgumCampo and if it already exists I do…
-
0
votes0
answers11
viewsproblems with Inputstream, Filenotfound
I am making a game in it contains several images and sounds that stay in the project folder when exporting the . jar all the imports disappear said my problem is that I was using ImageIO.read(new…
-
0
votes2
answers49
viewsParameters in Java
Hello, everyone! I have a question which, apparently, must be simple. I am working on a project where there are several methods with parameters being specified in this way, for example: (String...…
-
0
votes2
answers68
viewsHow to use XML inside a String variable
I created a variable of type String that has the return of the webservice in XML: Example: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <books> <book> <author>…
-
0
votes1
answer33
viewsClass Dependency Injection that I don’t have access to
Hello, how are you? How can I inject dependency into a class I don’t have access to, that is, I can’t say on top of the class that it’s a java bean (@Component). Thank you very much!…
-
0
votes1
answer108
viewsJava java.lang.Nullpointerexception in a Jpanel constructor
I’m trying to compile a memory game in java, but gives the following error: Exception in thread "main" java.lang.NullPointerException at javax.swing.ImageIcon.<init>(ImageIcon.java:217) at…
-
0
votes1
answer96
viewsAlertdialog with background
I created this alertDialog but I wonder if instead of having an icon when it appears, if it is possible to all have another color or even use an image like yours (Background). E Assign to the…
-
0
votes0
answers16
viewsmethods of other Ctivity
I’m developing a simulated proof app in it will have several categories of evidence and with checkbox to select which you want to do but I’m unable to call the metadata, appears only the first…