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
answer121
viewsNullpointerexception in database connection
Anyway, I’m getting one nullpointerException just that I have no idea how to deal with it, I took a look on the net about and apparently the problem is in uninitiated variables and things like that,…
-
1
votes2
answers106
viewsImage inside a Scrollview is blank on one device but usually appears on another
I have a Alertdialog whose content is a Scrollview with an image and a button inside. Scrollview works (I can "scroll" the bar), but the image does not appear (it is empty), although the button…
-
1
votes1
answer52
viewsSqlite Database is not entering values
I am creating a simple application that involves the Sqlite database and throughout the development my insert function in the table has stopped working. Through the debug I could notice that it is…
-
1
votes1
answer620
viewsHow to read TXT to a certain point and then continue from that point?
I have a class that is responsible for reading a TXT file part by part and return me a result according to this part. This result will be used by another class. That is, I open txt I read to a…
-
1
votes2
answers156
viewsSelect in the database using "like"
I am trying to make a select in mysql database, but would like to use the like, that should receive the value of a java variable. How can I do this interaction? public void…
-
1
votes1
answer345
viewsIs Hashmap possible with various values?
I need to fill a bank like this: Milk 50 kcal 20 proteins 120 Carbo etc. I got to do with hashmap, but I can only use one key for a value, it would have to do with various values, or another way…
-
1
votes1
answer78
views -
1
votes0
answers69
viewsHow did Mandar Sort view URL in native pagination query?
The structure below works perfectly, but when I send after the input and pagination data the command Sort it from the Sql error, which I need to put in the query to accept the Sort for the field I…
-
1
votes0
answers101
viewsMy code does not send email to Gmail, but sends to Hotmail
My code for some reason does not send emails to Gmail, well, at least not enough emails. This is a college job, I got the score, so no rush, but it’s driving me crazy, what’s the problem? Well, I…
-
1
votes0
answers88
viewsRollback to persist entity with Hibernate
I have an entity Product: @Entity @Table(name = "produto") public class Produto implements Serializable { private static final long serialVersionUID = 1L; private Long id; private Cliente cliente;…
-
1
votes0
answers54
viewsHow to change a value in another class?
I’m trying to change the value of a variable in another class but I’m not getting it. package com.cursoandroid.firebaseapp.novotestebanco; public class Logado { public String situacao; Logado(String…
-
1
votes2
answers764
viewsUpdating Progressbar in JSF
Good Afternoon, I’m doing an asynchronous method that searches the database(oracle), and returns in an Excel file. Inside my Method has the for @Async public synchronized void…
-
1
votes1
answer288
viewsHow to play audio automatically on startup of a program?
I want the audio to play as soon as the software starts. If you have any suggestions for positioning the audio button in the main frame,... Follow code for analysis: Main class package Interface;…
-
1
votes0
answers161
viewsAdd a Document to an Array in Mongodb
This week, I started messing with Mongodb (I’ve never had much contact with any DB before) and a question just came up that I’m not able to solve(I researched, believe me). Let’s go to the following…
-
1
votes1
answer129
viewsDoubt with reference when using add in Linkedlist, java
I have a LinkedList<CasosPossiveis> casos = new LinkedList<>(); and a CasosPossiveis objeto = new CasosPossiveis();. Within a for, after this statement, I make a: casos.add(objeto);,…
-
1
votes2
answers127
viewsUse of the "Instance of"
public class AlunoLicenciatura extends Aluno{ private String curso; private ArrayList<Disciplina> l_dis; public AlunoLicenciatura(String curso,Aluno a){…
-
1
votes0
answers30
viewsNETBEANS - JAVA - DERBY - Error Retrieving Byte for Imageicon
All right, all right? I have stored a BLOB file and am looking to do recovery of it, is a JPG. Below is the Resultset of the same: byte[] bin = null; // (2) ResultSet rs; try { rs =…
-
1
votes1
answer58
viewsScreen stops responding after clicking one of the buttons
I’m doing a simple program of the old game next to Swing. I wanted to know why, when shooting an event click by the method ActionPerfomed, my program freezes. I did some research and found that…
-
1
votes1
answer447
viewsWhen I make a request on my Rest API with Spring boot, it is coming with an extra item
I have debugged and the result is coming out a correct list, but when I request in Postman, comes an extra item. Looks like a counter. Can someone tell me what this is and how to take? This is my…
-
1
votes1
answer70
viewsVector doubt of objects
I’m having a question of how to proceed, there are syntax errors as you can see. But my knowledge is basic and I’m trying to improve. I have the following program. A register of Flights, only with…
javaasked 6 years, 10 months ago J.C. Ferri 45 -
1
votes2
answers151
viewsHelp in code printing of repeated characters
I want to print only the characters that are repeated in string and the amount of repetitions. If it appears only once, I don’t want to print it. I need help with boolena expression. How do I check…
-
1
votes1
answer176
viewsKeylistener for various Jtextfields
I created a KeyListener for verification of a String typed, if it is in the bank. If it does, it sends an alert. The question now is that I have about 50 jTextFields. It is possible to create a…
-
1
votes1
answer36
viewsPass jTextField value to Namedquery
I have some jTextfFields where I need to send to the DAO their values, these values are arriving correctly in the DAO, but the return of NameQuery is being null. There is no mistake, only the return…
-
1
votes1
answer299
viewsProblems converting date to Calendar
Trying to convert date from date to date. Using springBoot. I didn’t have clarity about the true cause of the exception. Someone could help? @SpringBootApplication public class Boot { public static…
-
1
votes1
answer78
viewsHow do you force threads to perform certain functions?
10 threads are agreed when the Client connects to the server, when the Client asks for a word, The server wakes up these threads and they will go through a list of tasks. What I wanted to happen:…
-
1
votes1
answer688
viewsExercise with Hashmap
I’m trying to do this exercise, I don’t know where I’m going wrong. Can you help me? I need to create a map that has the number of characters of a city name and by value in a list of all names with…
-
1
votes1
answer143
viewsBufferedreader always returns null
Although some questions already exist with similar subject matter, I could not get an exact answer, so I turn again to Stack. I’m developing a client-server system, I already had the project…
-
1
votes1
answer890
viewsBest way for a bean to call another bean passing itself as a parameter in JSF
I have a 1:n relationship, where a System can have multiple Loggers. I also have two Beans: one for System (Systemsbean that refers to page systems.xhtml) and another for Logger (Loggerbean that…
-
1
votes2
answers35
viewsSelect does not select the correct value
I have the following problem: <select name="cargo" id="selectCargo" class="form-control show-tick maiuscula" required > <option value="">ESCOLHA A EMPRESA</option> <c:forEach…
-
1
votes0
answers110
viewsconfiguration methods do not work in Maven project with Spring-boot
I have the 3 classes that transcribed the code. the run method on boot starta my application. the other two classes are in the package that contains the settings. I am using spring boot and have a…
-
1
votes1
answer114
viewsApp Ionic Integrated Framework with JSF Java Web System
Guys, I need some guidance from an experienced developer, where the need is: I have an application created in Java Web with JSF in production. I need to develop a Hybrid App with Ionic framework…
-
1
votes3
answers754
viewsJoin objects within collection of different objects
How do I "join" or concatenate an object within a collection of different objects? I’ve tried redoing but it always gives the same error. public class Prova { private String titulo; private int…
-
1
votes2
answers427
viewsHow to create a generic class that receives data from two other classes
I have three classes, the superclass Refeição, and the child classes Ingrediente and Prato, wanted to create a generic class, which would receive data from child classes to create a crud (with…
-
1
votes1
answer31
viewsAuto-increment in Android components
Good people, I have the following code: if (bolaPreta == 1) { img1.setImageResource(R.drawable.icon_circpreto); } if (bolaPreta == 2) { img1.setImageResource(R.drawable.icon_circpreto);…
-
1
votes0
answers36
viewsSave 2 templates to same firebase id
I have 2 models , the courier and the vehicle , I need to save the data of the two models in the same id of database, I did it this way, I used the vehicle. salvarDados(); but did not save: private…
-
1
votes1
answer132
viewssystem with CRUD
I am majoring in Systems and I am developing a system, and my difficulty is to remove an element array, because the problem in question is that when there is more than one element it removes…
-
1
votes0
answers390
viewsError while running project in android studio
While running my project the following error appeared: Error:com.android.builder.dexing.DexArchiveBuilderException: Failed to process…
-
1
votes1
answer185
viewsMy Jlabel does not appear
I’ve used several commands to make this label appear, but I can’t, in this object I’m using Paint and ActionPerformed, but no Drawing this overlapping this label and even then it does not appear,…
-
1
votes1
answer57
viewsDoubt How to perform onChange on two Selects
I would like to know how to perform an onChange in the two selects I have in my form follow the selects: <div class="row"> <div class="col-md-12"> <div class="form-group…
-
1
votes1
answer687
viewsHow do you turn a Spring Boot project into a . jar file?
Guys I don’t know how to turn a Spring Boot project into a file. jar My attempt was to enter the project through msdos and with the command mvn install can create the file . jar However several…
-
1
votes1
answer35
viewsHow do I get the value that is returning from the console.log(Results[4].geocode) to use in my if comparison?
var init = [iAppLib.getPersonalBits(), iAppLib.getGeoCode() ]; var codes = false; var gcOk = new…
-
1
votes1
answer77
viewsCreating Ejbs in Spring MVC Project - Problems with Dependency Injection
I have a Java application with Spring MVC that is divided into modules as follows. proj_servicos = Mapped entities, Repository classes (communication with the bank) and Services (Where Repository is…
-
1
votes1
answer178
views6 build path Entries are Missing no eclipse
When reinstalling the eclipse and importing my project back which was cloned from github on a newly formatted machine there was an error and my project does not compile, it gives me a meaningless…
-
1
votes0
answers210
viewsHow to thread to wait for another class to be completed and continue the code?
As well as described in the code I need a solution to give a pause in main until it waits for some call to continue the code of the class main. I know this will be solved with thread, but so far I…
-
1
votes2
answers41
viewsReturn Updated Android Date Time
I made a class called Current Date containing this data: package com.projeto.projetov1.model; import java.text.SimpleDateFormat; public class DataHoraAtual { long date = System.currentTimeMillis();…
-
1
votes2
answers529
viewsHow to make a minimum ceiling and a maximum ceiling in a random number?
I am developing an application in Java and in my controller I have a function that generates random numbers. Example: In my first column I want you to manage from 0 to 8, so far OK. In the second…
-
1
votes1
answer470
viewsHow to cascade relationship?
I have a class mapped with Hibernate, however, when saving an object is cascateado the whole object to the child table (what is expected). The problem is that equal objects are saved instead of just…
-
1
votes1
answer130
viewsProblems with Sockets
I’m creating an app that needs send and receive information of a web page through Sockets, the server in Java I managed to do, but I do not know much about JS, could help me to do the client that…
-
1
votes1
answer92
viewsReturn from Webservice does not respect the namespace of my own WSDL
Hello! I’m starting now in the world of Webservices. I made a WS in the eclipse Wizard using Axis 1 (if I’m not mistaken), in the style "Bottom up": No eclipse, positioned in the class that will be…
-
1
votes0
answers40
viewsJAR converted to exe does not open after being transferred via socket
I have a JAR program that I converted to EXE with Launch4j. The EXE works normal, but when I try to transfer this file via socket it just doesn’t open with 2 clicks. If I use a "java -jar.exe file"…