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
votes0
answers718
viewsSpring+JPA, visible Transient field in View and not persistent?
Good evening guys, I have a filter that I do manually with @query() that in it I make a total calculating Join of a sale ie, SUM(valor * quantidade) as total At the end I’ll put the filter for…
-
1
votes2
answers624
viewsHow to use AJAX in an iframe?
To put it in context: I am trying to get only one part of my HTML page updated every 5 seconds. For this, I am using AJAX. In the middle of the development, I found myself with a problem of not…
-
1
votes0
answers101
viewsWhen trying to access Repository with.sun.faces.context.Ajaxexceptionhandlerimpl handlePartialResponseError
Guys, I’m going through a problem here, and I can’t solve it. I’ve looked in the forums, but I haven’t seen any solutions either. Anyone gives this help? The error happens when I try to save the…
-
1
votes0
answers95
viewsCreating an injector with Google Guice
I’m trying to use Google Guice in my application. So I created a Module by binding an interface with an implementation... public class ApplicationModule extends AbstractModule { @Override protected…
-
1
votes1
answer139
viewsHow to view a Menu by clicking on the Bottomnavigationview item
My application this way: I need a menu to appear when I select the fourth item: The code of my Activity Main: package br.com.friendlychat.navigationbottombar; import android.os.Bundle; import…
-
1
votes1
answer103
viewsPopular Excel with Java object
Hi, I’m having a problem to popular a table the way I need, I want to do something like this. But with my code I can only get people like this. How do I format the same way? I tried to skip the…
-
1
votes1
answer646
viewsI’m trying to read and write an XLS with Apache POI
I am trying to make a class that reads a file. xls and writes another file in the same format, but my class gives the following error: org.apache.poi.poifs.filesystem.NotOLE2FileException: Invalid…
-
1
votes0
answers98
viewsClass Relationship with Primarykey Composite in Hibernate
I have the following relationamento In the Definition Scale entity I have a composite primary key composed of idEscalaDetailing and idTurma I’m having doubts to do the reverse mapping between…
-
1
votes2
answers140
viewsSubstring program
I have a C program that displays all substrings of a string: #include <stdio.h> #include <stdlib.h> #include <string.h> typedef char string[100]; void substrings(string str) { if…
-
1
votes1
answer38
viewsDifferent results with the same SQL statement
Talk programmers(as), quiet? I’ve done a lot of research not to repeat questions here, but I really don’t understand why the SQL statement works on Mysql Workbench and the Java/JDBC SQL string…
-
1
votes1
answer973
viewsJava - error: cannot find Symbol - Even with created object
I created these two classes: Java equipment. class Equipamento{ private int id; private String nome; private String local; public void setId(int id){ this.id = id; } public void setNome(String n){…
-
1
votes1
answer91
viewsGrab mouse position inside scroll pane
How do I get the mouse position inside a scroll pane in javafx? I have an app that does a drag and drop operation inside it, and I need that information to position the node on the screen. The…
-
1
votes0
answers354
viewsJava Spring Boot - Read file inside the . Jar
I’m doing a class that will read an ETL Pentaho Kettle (transformation), I put the file that the class will read in the Resources/KTR folder. But when I try to run the code as a java application…
-
1
votes1
answer677
viewsHTML - THYMELEAF - pass parameter
I created a parameter in Procedurecallerrepository and Procedurecallerrepositoryimpl So far everything ok my error is in html and I don’t know where I’m going wrong (I’m sorry if it’s something…
-
1
votes1
answer148
viewsPKCS11 Wildfly 13 - Digital certificate
I’m trying to use the following library: https://github.com/Samuel-Oliveira To use it, it is necessary to upload a digital certificate, in the case of type A1. When trying to use it with a normal…
-
1
votes0
answers59
viewsLog4j in Tomcat application on AWS Beanstalk
I have a multi tenant application developed in Java WEB (Spring) that uses log4j to log logs. Each tenant saves their log files in a specific folder, corresponding to the tenant of the logged-in…
-
1
votes1
answer6191
viewsCheck if Arraylist has identical items
I have the class Pessoa: String Nome, Cidade; public Pessoa(String Nome, String Cidade){ this.Nome = Nome; this.Cidade = Cidade; } public String getNome() { return Nome; } public String getCidade()…
-
1
votes1
answer92
viewsjava.lang.Illegalargumentexception when creating a Snackbar
I’m developing an app that accesses my college’s Moodle and posted the first version. Since then I noticed some flaws in the application presented in the Google Play console but I could not find the…
-
1
votes1
answer1238
viewsJPA error with Mysql 8
Hello, After updating my database, my application has been presenting exceptions, like java.sql.Sqlsyntaxerrorexception. The class below is the one he complains about, saying it doesn’t exist when…
-
1
votes1
answer32
viewsRegistering new date in Mysql
When I first register the item in the database it takes the date it was created and saved in the database, the problem happens when I edit the item in the program and then saved in the database it…
-
1
votes1
answer156
viewsError generating Id automatically in Hibernate
I am making an application with Hibernate, but is generating and error: "ids for this class must be Manually Assigned before Calling save()" The class that’s saying you’re wrong is like this..…
-
1
votes3
answers306
viewsUnderstanding the exercise of the book Use the Java Head
I did not understand the functioning of the code below, maybe later in the book have better explanations or missed something even in the review. I will detail the points in the code itself in which…
-
1
votes0
answers50
viewsProblem in classifying graph edges
I’m making an algorithm to classify the Edges of a graph, between Type T, B ,C and F. It’s giving me a wrong output, it finishes vertex 3 at the same time it starts 4, so it doesn’t end up…
-
1
votes0
answers27
viewsFinishing a java object variable with null - Will it be removed from memory?
public class TesteMemoria { public static void main(String... x){ ASayboltFurolViscosity objeto; for (Double i = 30.0; i < 40.0; i++){ objeto = new AlgoritmoASTMD2161_v1999_SSF(i,…
-
1
votes2
answers482
viewsError comparing strings
I need to make a program that takes a sentence, then a letter, and returns how many times the letter appears in the sentence. So I did this: import java.io.BufferedReader; import…
-
1
votes0
answers111
viewsJava: Streamcorruptedexception in object serialization/deserialization
I’m conducting an exercise involving serialization and deserialization in Java. When running the program I am getting the following error in the IDE console (Netbeans): set 08, 2018 5:07:53 PM…
-
1
votes1
answer51
viewsError: android.widget.Linearlayout cannot be cast to android.widget.Gridlayout
I’m trying to make an android app that lists the components coming from the bank. The error is as follows: Androidruntime: java.lang.Classcastexception: android.widget.Linearlayout cannot be cast to…
-
1
votes0
answers39
viewssetx and setY do not work in the pane (Javafx)
I’m having a problem setting the x and y position of an Imageview in a Javafx Pane. It is a loop code and, the first time the method is called, it arrow the img object at the specific coordinates…
-
1
votes1
answer227
viewsHow to create a business rule by JPA?
I need to implement a business rule that ensures that the same employee represented by the table Employee cannot be added more than once to the same project represented by the table Project. Let me…
-
1
votes1
answer67
viewsError sending pdf to Firebasestorage
I am trying to send PDF files to firebase Storage and with this code I can go to the point of picking up Uri, sending, but only falls into onFailure, follows the code @Override public void…
-
1
votes1
answer58
viewsHow do you run the getCidade() method with asynctask, and return the value of the city string to use in another method?
public class CadAnuncio extends AppCompatActivity { LocationManager locationManager; private Button btnSalvar; private DatabaseReference databaseAnuncio,…
-
1
votes0
answers265
viewsAndroid - How to Create a Loop Properly in an Activity and Pause It and Summarize It
I have a project of a CHIP-8 emulator that I’m trying to port to android, the entire emulator is written in C++ so I created a C++ library in android studio and added it to my project, the problem…
-
1
votes1
answer277
viewscommit with the @Transactional annotation in Spring
Good afternoon! I am new to Java and Spring and I am in need of help in the code below. I need every iteration of for to be performed the commit, but it is only being performed at the end of the…
-
1
votes2
answers73
viewshow do I stop a sum?
I’m making an app where I have to pull a sensor (I used the accelerometer) and save the sum of the 3 parameters. As soon as I try to save that sum the app hangs, I found that the save command that…
-
1
votes1
answer104
viewsHow to answer a json using Gson
First of all, I agree that the question has gotten a little strange, but I can’t write my question otherwise. At the end of the explanation of the problem if someone wants to suggest a better title…
-
1
votes1
answer76
viewsHow to get html code through a url in android studio
I would like to do as I get html code from a site using android studio. This is the code I did, but it does not returns anything. private static String pegarURL(String a) { StringBuilder b = new…
-
1
votes0
answers78
viewsHow to return when finished/keep record of the remaining time (Timer/Schedulel)?
So, I’m developing a project for a game that uses RMI (client/server) and needed to manage the timeout of players' plays. For example, if a player takes more than a minute to make his or her move,…
-
1
votes1
answer223
viewsSpring boot + Angular 6 + Heroku
I created a web application where the front uses angular 6 and the back uses spring boot. My goal at the moment is to put the application online. On the local server when I run the spring boot the…
-
1
votes1
answer151
viewsHow do I check if a switch is activated?
I’m trying to do a show that has some elements of the house, like lamps. On a screen I want you to show all the elements, whether these are on or off. I own some Switchs and want to put a text on…
-
1
votes1
answer45
viewsMultiple Returns Pattern Builder
I have a class Builder who is responsible for returning an object he builds: public class ObjetoBuilder { private Objeto objeto; public ObjetoBuilder() { objeto = new Objeto(); } public…
-
1
votes2
answers926
viewsRecursive function to calculate the number of lowercase letters in a character string
I was able to do a function to return a given character at an X position of a string: public static char funcao (String texto, int indice){ if (indice == 0){ return texto.charAt(indice); } else {…
-
1
votes1
answer48
viewsHow to use two date parameters for two Betweens without repeating the parameters using Spring Boots?
I’m starting with Spring Boot and I’m trying to use it for a query where I want to check if two date columns are between a period provided by parameters. The code below works, but for this I have to…
-
1
votes1
answer96
viewsValues with different types Gson - Java
I wonder, if there is a way with Gson to get values of different types in a "key-value" array in Json. Follow the example: { "events":[ {"event":"comprou-produto",…
-
1
votes1
answer170
viewsPOST disabled in JBOSS EAP 7
I implemented a service with JAX-RS that features GET and POST operations: @Path("/funcionario") @Singleton public class FuncionarioService { private List<Funcionario> funcionarios = new…
-
1
votes0
answers46
viewsArray and error handling in numbers game
The game is to discover opponent’s numbers, but not lottery type, have to use reasoning to get to the correct number. The rule is to play with 4 numbers at a time without repeating on the same line.…
-
1
votes1
answer112
viewsJava returning 0 in multiplication
The code is even simple to calculate a seller’s yield by multiplying in the case of 150000 * 0.1 it returns 0 code / public class FuncionarioComissionado { //Strings private para poder usar Get/Set…
javaasked 6 years, 9 months ago guilherme cabrals 19 -
1
votes0
answers114
viewsError calling Java Fx screens in Spring
I am developing a Spring + Java Fx application, when calling the code from the main class screen, it works normally, but if I call another screen, it does not record the information in the model and…
-
1
votes1
answer18
viewsProblems with if no managedbean
I have a login form with the registration and password fields. I am trying to validate this login where only the number "92018" can log in to the system, but when the login method is called, it does…
-
1
votes2
answers123
viewsHow do I get data from one node within another node in Firebase with android?
I need to get the data from the "usrCategoriaUsuario" node that is in tb_usuario. The normal data I get, but this usrCategoriaUsuario, I’m not getting. Code that searches the User data in Firebase:…
-
1
votes0
answers250
viewsGenerating jwt manually using JAVA, but jwt.io does not validate
I am trying to manually generate JWT in Java without using libs, but the returned JWT is not being validated by the web application https://jwt.io/. public String authenticateUser(String body) { try…