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
answer85
viewsCalling method inside a getter
It is good practice to call any method within a getter? Example: public final class ScannerDeHtm { private static final String DIR_CEF = DefineDiretorio.getDiretorio() + "CEF"; private static…
javaasked 8 years, 1 month ago Rafael Teixeira 11 -
0
votes1
answer57
views -
0
votes0
answers48
viewsGenerate web pages using Flask or Django from the tables
I have a schema in a Mysql database. I want to generate the web pages from the tables of this schema. Is there any generator of this in python? A few years ago I was generating a "system" like this…
-
0
votes1
answer54
viewsNullpointerexception when comparing two String arrays in java
I have two String matrices and when executing this: if (prod[i][0].equals(temporaria[j][0]) && prod[i][0]!= null && temporaria[j][0]!= null) get Nullpointerexception without at least…
-
0
votes2
answers67
viewsProblem in the printing of a vector
Guys I’m having a basic problem that I can’t understand the mistake: Prova Class: public class Prova { public static void main(String[] args) { Vetor lista = new Vetor(); Scanner scan = new…
-
0
votes1
answer78
viewsWhat to call Named Query in main? JPA
Guys, please, could someone show me how to call in the main @Namedquery class of another class. Follow the example: @Entity @Table(name="edificio")…
-
0
votes1
answer234
viewsRules processing with spring security
I am building an application with Spring Security and after performing all settings to have the custom login done with the UserDetailsService, I realized that when logging in, although the data is…
-
0
votes0
answers82
viewsProblem with Return returning null to another class
I have a class responsible for downloading a list of students in a web service through a method where I pass as parameter a string with the teacher’s code and it returns me an array of students. The…
-
0
votes1
answer397
viewsConvert java code to pascal
I need to convert to Pascal / Firemonkey the java code below: the main doubts are: how to extract each pixel in firemonkey? how this code operates: slice |= (byte) ((v ? 1 : 0) << (7 -b));…
-
0
votes1
answer144
viewsjava.lang.Noclassdeffounderror: org/codehaus/groovy/Runtime/Bytecodeinterface8
I have a report and need to use sub Ports, but whenever I try to use, find this exception: java.lang.NoClassDefFoundError: org/codehaus/groovy/runtime/BytecodeInterface8 Caused by:…
-
0
votes0
answers243
viewsWhat are the return values of compareTo in Java?
What is the difference between the 0, 1 and -1 returns of compareTo() in Java? Example: Date date1 = '08/02/2019'; Date date2 = '08/03/2019'; date1.compareTo(date2);…
javaasked 5 years, 8 months ago Paulo Gonçalves 51 -
0
votes1
answer63
viewsUser see only Items of the Operational unit that is in your registration
I have a vehicle management system. The company in which I work has several business units, so the user can only see the cars of the unit in which he works. This I managed to do, but whenever…
-
0
votes1
answer1396
viewsJava spring: convert a file to Multipartfile
I created a simple file: File file = new File("text.txt"); But I would like to convert this to a Multipartfile, which would be the best way? I have tried the code below without success:…
-
0
votes1
answer35
viewsI can’t recover an imageview on (R.drawable)
It was supposed to appear (R.drawable.image1) I don’t know what else to do if someone can help me in this situation....…
-
0
votes1
answer253
viewsWaiting for table level lock Mysql Java application error
I have a Java swing application that uses the Mysql database, in its operation after spending some time in operation I realized that the application hangs in a few moments, It is necessary to…
-
0
votes0
answers54
viewsHow do I match a value of an array with another value in another array in Java?
I know how to get the value of an array position and compare the array values. As code below. for (int i = 0; i < listadosWifi.size(); i++) { /* pega o SSID e o BSSID */ providerName =…
-
0
votes1
answer39
viewsError in the findById of a generic class for persistence and queries using Hibernate JPA
I have a generic class I’m using to perform queries with JPA Hibernate. My class is like this: public class BaseRepositoryImpl<T> implements BaseRepository<T> The problem is that in some…
-
0
votes1
answer206
viewsFluig - Mysql 8 Connector
I can’t get my Fluig server up, because there’s an error com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Public Key Retrieval is not allowed Exhaustively researching,…
-
0
votes1
answer39
viewsChecking the existence of a file
Given a file url: URL pomUrl = new URL("https://gitlab/grupo/projeto/blob/develop/pom.xml"); How can I verify the existence of a sister file to this? Something like: public boolean temIrmao(String…
-
0
votes2
answers61
viewsError "required int" when executing code
I made this small program, where I want you to loop, while the user chooses to register more messages. The error, after compiling the code, says: required:int found: no Arguments Reason: actual and…
-
0
votes2
answers399
viewsPick up quantity of entries inside the Joptionpane
Hello, I’m having difficulty picking up the number of entries that is made by the user to then use them. Code: public static void main(String[] args) { // TODO code application logic here int n, s =…
-
0
votes1
answer248
viewsError saving form with Hibernate: could not execute statement
I have a web form that saves data in Mysql, but is returning an error could not execute statement; Column 'bairro' cannot be null. The error says that the 'neighborhood' field cannot be null, but I…
-
0
votes1
answer42
viewswanted my presentation slides to appear only once when the app is installed?
i would like that when the user finished going through the slides of my app would automatically open a new Activity and the slides were destroyed so that they would not appear anymore they would…
-
0
votes0
answers87
viewsGoogoostatementcache - Multiply Prepared statement!
Hello, when changing an object and saving I am having problems of slowness and in a few moments even totally locks my application. By persisting is returning me only this information, but I could…
-
0
votes3
answers301
viewsHow to make the if-Else instruction work for reading integers
My program compiled in cmd, but running does not execute the instruction if, showing only the last String and closes. I want the user to have the option to register another message. What possible…
-
0
votes2
answers186
viewsMake variable wait to be set by user after While? java
Hello, I want the user to set the value of a variable, but it should set it only after the while. My question is, how do you do it? Here’s the piece I’m doubting. public static void…
-
0
votes0
answers31
viewsSet image using Firebase database
I need the image that’s stored in the Storage Firebase appear in the listview customized. However, I cannot define the image in the format gs://<Seu banco><childs>. I’ve tried using the…
-
0
votes1
answer58
viewssplit(" ") in String " Java Essential " generates 3 tokens. Why?
The idea was to separate words from whitespace. It follows the following code. String s = " Java Essencial "; String[] ss = s.split(" "); for (int i = 0; i < ss.length; i++) {…
javaasked 5 years, 7 months ago Usuário Sedento 79 -
0
votes0
answers105
viewsColumn Count error doesn’t match value Count at Row 1, for a select
My system, in the save button, I inserted 3 tables at the same time, being that 2 uses FK, I am using the field cad_id as FK in 2 tables, I am making a select to take in the bank a single field…
-
0
votes1
answer74
views -
0
votes0
answers298
viewsShow Jprogressbar while connecting to database
I have a java desktop application with netbeans connecting via JDBC, and I have a class that connects to a database and returns some items that are stored there. I’d like to exhibit a progressBar As…
-
0
votes1
answer259
viewsREST - Send null to Integer parameter
I have the following situation in my REST (Jersey): URL: http://localhost:8080/api/listar_log_utilizacao/null Code: @GET @Path("/listar_log_utilizacao/{idUsuario: .*}")…
-
0
votes0
answers182
viewsFill Listview with an array
I have an Array List where I store the subjects with the respective grades of a particular student. This array has only 2 attributes: nomendDiscipline valuer I would like to know how to fill a…
-
0
votes1
answer72
viewsCreate mask to accept only links containing HTTP/HTTPS - Java JSF
I need to create a field input where the user will place a link, but this field can only accept links that contain http:// or https:// at first. There is a way to do a validation in Javascript or…
-
0
votes1
answer56
viewsDoubt of execution javac in cmd
Hello, I’m starting now in Java and wanted to know how to compile . java in . class in a direct way. I can run the javac in cmd but I do so: cd C:\Local\ javac HelloWorld.java But I’d like to know…
-
0
votes1
answer119
viewsHibernate does not find Hibernate.cfg.xml
. When indicating the configuration file to Hibernate, I tried the wrong relative path before ". cgf) (.. /.. /main/Resources/Hibernate.cgf.xml). But now corrected, the absolute and Hibernate path…
-
0
votes0
answers27
viewsvariable in selectOneMenu
In a form I have the field where I enter the name and create a folder with that name, in the second form a selectedOneMenu where lists the folders I created in the first form, now my problem is in…
-
0
votes2
answers122
viewsCheck password fields with each other in java in spring
How do I validate two password fields if both are equal Usuario usuario = (Usuario) target; if(usuario.getSenha().equals(usuario.getSenha2())) { errors.rejectValue("senha2", "field.compare"); }…
javaasked 5 years, 7 months ago Gerson dias 1 -
0
votes2
answers201
viewsWhen to use Return and This in JAVA?
I am learning POO in Java and sometimes when I am creating methods I feel a little lost in relation to what I should send to the main class. I wonder if there is any basic rule of when to use…
-
0
votes1
answer161
viewsEclipse IDE error
Hello, folks. Can anyone tell me what those bugs are? It also says "String cannot be resolved to a type", could be problems with the JDK version?…
-
0
votes0
answers993
viewsSet variable value in Inputtext JSF
Guys, I’m having a doubt maybe a little bit stupid but I’m not able to solve, I’m starting web development using java and jsf, primefaces and I have a problem at the time of changing a record. I…
-
0
votes1
answer55
viewsuploadFile primefaces
The method below, along with my jsf, uploads a file. bat to a folder inside my project, until then it works normal, the problem is that when I go to see the folder where the file is, it is there,…
-
0
votes1
answer32
viewsAndroid Studio Startup Error
I’m learning how to develop mobile apps.I installed Android studio but when I create an Activity, in this case Basic Activity, the following boot error appears:…
-
0
votes1
answer185
viewsValidate email in JAVA memory
In java, how do I check if the String the user typed has the character "@" or ends with ". com" or ". br" to validate the email in memory ?
-
0
votes1
answer148
viewsError starting the app
When I try to run an application by Android Studio in the Genymotion emulator an unexpected error occurs and the app does not open. And the log flap Logcat from Android Studio returns the following:…
-
0
votes1
answer132
viewsAlternatives to JSF for front-end
Once I want to keep the back-end in Java, what could I adopt for the front-end, as an alternative to the decadent JSF? Hugs!
javaasked 5 years, 7 months ago user120772 -
0
votes1
answer58
viewsHow to find all places where depreciated methods are being used in Netbeans?
Are there any tools in Netbeans that allow you to generate a file, report, log, or something like that to find all methods that are deprecated in a Class or Project? I tried to find on the Internet,…
-
0
votes1
answer64
viewsMethod that returns the amount of objects removed from an object array
My method can actually remove objects from the array, but it always returns 0 the amount of removed, I have tested different amounts and it always removed from the list, but always returned 0 of…
javaasked 5 years, 7 months ago user129831 -
0
votes2
answers143
viewsSpring Bean tenantEntityManager error: Unable to find column with Logical name
am having an error while trying to run my JSF application with Spring, more specifically: -I have a method to do a badge search on certain repositories and change them after running method on a…
-
0
votes1
answer112
viewsTake data array from an API via Java
I have an API with a data array. Example: "bandeiras" : [ { "bandeira": "MASTER", "status": "ATIVO" }, { "bandeira": "HIPER", "status": "ATIVO" } ] What I have to do to get the data from each flag,…