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
answer11
viewsReactor - After filter false, call another method
Given the code below: fun method() { return gateway1.getPerson(id) .filter { isPersonValid(it) } .flatMap { gateway2.isPersonHasAddress(id) } // Retorna Mono<Boolean> .filter { it }…
-
1
votes1
answer830
viewsRead XML with Java
I’m using the following code to send a .xml via SOAP package consumirwebserviceporrequisicaoxml; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.StringWriter; import…
-
1
votes1
answer86
viewsCharacter difference enconding Charset Difference using JPA but not with Prepared statement
I have an application using spring boot + oracle (via Tomcat datasource). Using spring-data, a simple query in a table returns encoding problem characters. This same application, in a very specific…
-
1
votes1
answer60
viewsI’m not getting/knowing how to use Setter
I’m trying to do some tests in JAVA here and I’m in trouble: The product class, with the initialization and the getters/setters public class Produtos { private String[] nomeItem = {"Item 1","Item…
-
1
votes0
answers46
viewsUsing Try-with-Resources in Java code
I have a following problem, I am unable to pass a code that I currently have and that is wrong, it works but does not close the connection to bank and gives too much error, and I wanted to use it…
-
1
votes1
answer1181
viewsHow to close a file in Java?
I’m trying to delete a file using File, but I have the following mistake: The file is already being used by another process. I also have this error when trying to rename using Files. How can I…
-
1
votes0
answers126
viewsSend objects larger than 5 Gb using Amazon S3 SDK
I’ve been using the Amazon S3 SDK for cloud server communications for a while, called Dreamhost or Dreamobjects. My application uses files for my Buckets. However, I started having problems because…
-
1
votes1
answer1247
viewsDeleting children records with @Manytoone annotation from Spring JPA
I have the classes Presente and Reserva, as below: @Entity public class Presente { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long codigo; private String nome; //getters e…
-
1
votes1
answer148
viewsError picking GET attribute in jsp!
I am facing the following problem, I am making the following redirection: response.sendRedirect("../../index.jsp?NA=1"); Where the url goes like this:…
-
1
votes1
answer112
viewsHow to change the state of a Togglebutton in java?
I created this Drawable to define how Background of the 6 Togglebutton. How do I make the Togglebutton toggle between them without being clicked? <selector…
-
1
votes1
answer214
viewsReturn error of Listview object list
Here’s my main class: public class MainActivity extends AppCompatActivity { public ListView lista; ArrayAdapter<Aluno> adapter; @Override protected void onCreate(Bundle savedInstanceState) {…
-
1
votes0
answers24
viewsError sending data via ksoap2 on the jboss webservice
So personal I am not able to send the data via ksoap2 on android. Appears the following error: I honestly did not understand what the problem, so I turned to the stack, because the namespace is…
-
1
votes1
answer270
viewsThreaded barriers - Output snippet code
I have the following code snippet. Can anyone explain to me the following question? In the main when I create the two threads, I go to the Boat and I can tell he’s sleeping for a second. Why main…
-
1
votes0
answers165
viewsMaking a relationship update using REST, Jax-rs, Jersey and Javascript
Well, I took a basis to make a simple CRUD of just one table using REST and the others that I put in the question, everything worked perfectly, until I put more tables(classes) and relationship…
-
1
votes1
answer94
viewsProblem with JSF
I have a screen and I would like to each product added, I could choose a quantity and then calculate that quantity multiplying by the value of the product. However, I have no idea how to do this,…
-
1
votes0
answers151
viewsERROR "do not have a Property of the name Return"
Hello, I’m trying to implement a Webservice and I’m having trouble answering. I used Soapui and it’s working. I am at the stage of implementing the Webservice client in the application. When I…
-
1
votes1
answer231
viewsEclipselink and JPA
I have problems trying to record information in the database, in a simple WS with JPA, Eclipselink and Postgresql database. I can search data and present them as json in the browser with GET…
-
1
votes1
answer107
viewsHow do I send data to a socket server that has already been started within an Asynctask?
I was able to connect to the server through the application, receive and show the data sent by it. There is also no problem sending messages to the server. The problem is: once the connection is…
-
1
votes1
answer101
viewsn >= 1 in the while condition returns no value
Good night. I’m starting to learn Java and I made a program with swing that calculates the factorial of a number. I did using while, and in the condition, I tried to do with the condition (n >=…
-
1
votes1
answer208
viewsHibernate error while running web project
I have an error that I could not solve, I start my project and it runs straight. When I access the project via the web, I log in and it. When I click on any button, it gives this error below:…
-
1
votes0
answers528
viewsHow to export a postgres table with column names to csv format with jdbc?
This is my code, which unfortunately does not export column names: package net.viralpatel.java; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import…
-
1
votes1
answer245
viewsWhat is the difference between using Swingutilities.invokeLater(Runnable) and Eventqueue.invokeLater(Runnable) when calling a window?
I was reading this answer where it talks about the use of EDT to manipulate swing components, but there is suggested to use one of the two methods cited to "dispatch" the interface to the EDT. There…
-
1
votes1
answer330
viewsRMI application works localhost, but gives error when placing Server IP
If I run the code snippet as it is below in my application, it works: public static void main(String args[]){ try { final InterfaceTrilha interfaceServer = (InterfaceTrilha)…
-
1
votes0
answers131
viewsclass fill table made in DAO class
Guys, I’m a little tied up and I’d appreciate your help. The project works, inserts users into the database, but I would like to do a jtable to display the entered data; Here the complete…
-
1
votes1
answer111
viewsCalculate sql table in android
I have the following sqlite database and works well: db=openOrCreateDatabase("BaseDadosDB", Context.MODE_PRIVATE, null); db.execSQL("CREATE TABLE IF NOT EXISTS tabeladados(data date,total…
-
1
votes1
answer199
viewsSelective reading of an XML
I’m able to read an XML but there’s more stuff I don’t need. The problem is that my XML source file has repeated tags in such a hierarchy (see the PLAN tag that repeats): <explain>…
-
1
votes2
answers1268
viewsSearch in a table in Mysql with Java
I’m having trouble trying to get something on the table, I’m new so I did it the way I know. Button code: livros.setPesquisarLivro(txtLivro.getText()); try { modelo.setNumRows(0); for (ObjetoLivro c…
-
1
votes1
answer1752
viewsNetworkerror: 400 Bad Request
When sending a post I received by retrofit in the log the message Networkerror: 400 Bad Request. In Development Environment no error occurs, data is synchronized from device to Server ( Tomcat )…
-
1
votes2
answers74
viewsSkip file when entering an Exception
Good afternoon Below is a method I use to read certain files from a folder. The problem is as follows. If the folder has 50 files (or 60, or 70, or 80 ...) and the method is reading a "faulty" file…
-
1
votes1
answer648
viewsExtract data from JSON within JSON that they see from a Web Service serving an Android APP
Good night, guys, how are you? I am developing an Android APP and it consumes data from a webservice, but I’m having trouble bringing some information to the APP. This is the JSON I return to my…
-
1
votes1
answer395
viewsJava null data insertion error, Java Postgre database
I am trying to insert data into a table in the database, but returns error "null". public void cadastrarChamadas() { Chamadas1 cha= null; String sql = "Insert into tb_chamadas(cha_cod , cha_nome,…
-
1
votes1
answer598
viewsOpening an Activity and returning saving the main state
After many researches I came across the following situation: I’m on my own Main Activity and would like to open another Activity(passing parameters to Activity2[In case a meditate]), after this use…
-
1
votes1
answer1539
viewsERROR: column "type" of relation "tb_person" does not exist
Hello. I am trying to persist a record, but when I run, it is returning the error below: // ... @Inheritance(strategy = InheritanceType.JOINED) @DiscriminatorColumn(name = "tipo", discriminatorType…
-
1
votes0
answers225
viewsFileupload java saves files to an inappropriate folder
I found an example of fileupload on the internet and added it to my project. However, it moves the files up to a folder inside the glashfish server. This folder is named after /config, and all the…
-
1
votes1
answer197
viewsPreferenceactivity#findPreference() returns null
someone could help with the error below? I’m beginner with android and could not identify where I missed. Thank you! Log Bug 01-22 11:45:32.722 13037-13037/com.example.android.sunshine.app…
-
1
votes1
answer663
views -
1
votes1
answer76
viewsAdd multiple indices of a vector as parameter
I’m starting in JAVA. I created two classes, the class Pessoa, which receives the following parameters at the instantiation of a new object: public Pessoa(String nome, int idade, char sexo) And the…
-
1
votes0
answers160
viewsTable in Ireporter does not appear in the application
Gentlemen good afternoon! I’m in a bush with no dog and I can’t find any more solutions to my problem, look: In my Ireport form I use the Table component. I created a dataset that is responsible for…
-
1
votes2
answers1670
viewsHow to update recyclerView after updating data via dialog
My app works more or less like this. Inside a fragment I have a Recyclerview composed of cardviews, fed by a database. On each card, there is an edit button (imageView) that opens a dialog…
-
1
votes2
answers381
viewsHibernate connection problems with Mysql Database
Hello, I am starting my studies in Hibernate and I am not making a connection to the Mysql Database. Below is my code: import java.util.Calendar; import javax.persistence.Entity; import…
-
1
votes1
answer732
viewsList a user’s groups on an AD server
I need to list a user’s groups X on the AD server. I have the following code snippet ready that already authenticates on the server and returns me all groups: public static boolean…
-
1
votes0
answers66
viewsDriver does not wait for page to load to proceed
Hi, I’m using Selenium to run some tests and then export the code to the eclipse. I’m trying to gettext a page that uses ajax using xpath, and then I’m trying to authenticate with assertTrue, but…
-
1
votes2
answers959
viewsInstantiate an object through the interface and access methods not present in it
I have the following interface: interface something { void doSomething(); } And I have a class that implements this interface and adds another method that does not contain in the interface: public…
-
1
votes0
answers260
viewsIntegration test send e-mail
Today I have a system, which sends several emails. Many settings and upload rules. I need to add about 50 new rules, new emails Time formats with attached file, images and other "cositas" more. Like…
-
1
votes2
answers117
viewsHow to identify the click on a drawableLeft
I got the following EditText: <EditText android:id="@+id/mPasswordTxt" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="center_horizontal"…
-
1
votes1
answer148
viewsHow to send Json to another Activity?
How to send Json to another Activity? public class SolicitaDados extends AsyncTask<String, Void, String> { @Override protected String doInBackground(String... urls){ return…
-
1
votes1
answer162
viewsI have a list and how do I display all the elements?
This method only returns me to the last position of the list, the others it does not show. How do I display all same? Agente agente = new Agente(); List<Agente> lista = getA(); for(Agente a:…
-
1
votes2
answers86
viewsCompare Background with Drawable
I have a problem comparing the Background of a ImageButton with a drawable IB6 is my ImageButton and wanted to see if you had the drawable def, when it comes to this if application to and error in…
-
1
votes1
answer380
viewsCalendar is not working properly
My conversion from timestamp to Calendar was done, apparently successfully, as the data presented appeared correct except the day of the week. data=(java.util.Gregoriancalendar)…
-
1
votes1
answer216
viewsHow to popular a Spinner from data returned from a URL?
I have the following code that works well, but with an example of array: @Override protected Boolean doInBackground(String...urls) { try { Log.e("****** MESSAGE ******", " Json Object = " +…