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
answers133
viewsHow to apply filters to database queries on all requests
I am developing an application using Spring Boot and Spring Data JPA that will work similarly to a blog. In this application there are three different types of user and each user will belong to…
-
1
votes1
answer41
viewsNeural Networks - Weka - What is the Threshold parameter?
When creating a predictive data model using neural network in Weka what the Threshold means and how this parameter influences the calculations of the predicted value?
-
1
votes1
answer265
views -
1
votes1
answer5363
viewsInstall JDK 8, 9 or 10 on Ubuntu 18.04
Does anyone know another way to install java in Ubuntu 18.04. I tried java 8 and 10 and gave these errors: "The oracle-java10-installer package is not available, but is referenced by another…
-
1
votes1
answer933
viewsHow do I add a background image to a Jframe?
I’m trying to change the background image of my Jframe, but I’m having a hard time. Here’s the code: public class teste_tamagotchi extends JFrame { private JPanel contentPane; /** * Launch the…
-
1
votes0
answers217
viewsHow to close connection like Jparepository and Spring Boot
Hello, I am working on a project using Spring Boot and am using Jparepository. I need to close the connection after running a bank operation, for example: query - findAll(). I know it may seem…
-
1
votes1
answer254
viewsTake text from excel cell
I have an application that reads Excel data, but I can only read the value of the cell and I can’t read what the cell is literally showing. For example: Here I select where the spreadsheet is and…
-
1
votes3
answers500
viewsAndroid - Remove White Space Between Recyclerview Items
I have a problem just like this here. I’m using the 'com.android.support:recyclerview-v7:28.0.0'. The XML is as follows, activity_main.xml, problem lies in the recyclerOverlay: <?xml…
-
1
votes0
answers1274
views -
1
votes1
answer59
viewsHow to make an if comparing values with a list that is in an yml?
I get a request and want to check if that channel is in a list I created in yml. @ConfigurationProperties(prefix = "parceiros") @Component public class CanaisMapper { private List<String>…
-
1
votes1
answer1041
viewsHow to represent an N:N relationship in java?
I think it’s a very simple question, but I couldn’t find any example that would make that clear. I already made my database model in Postgresql and when it came to creating the classes I was a…
-
1
votes2
answers161
viewsHow to round double values returned by Interface Location
I own a ArrayList that stores GPS coordinate objects and their elements are always being compared with the double values returned by the methods getLatitude() and getLongitude() of Interface…
-
1
votes0
answers438
viewsError: android.view.Inflateexception: Binary XML file line #10: Error inflating class android.widget.Listview
I am running my app, however it returns the following error: Caused by: android.view.InflateException: Binary XML file line #10: Error inflating class android.widget.ListView And I’m simply running…
-
1
votes1
answer349
viewsHide button (p:commandbutton), Primefaces, with PF api
I’m trying to accomplish something seemingly simple, but I’m taking a hell of a beating... Studying, I read that Primefaces has a javascript / jquery api, so I decided to take a look. Turns out I…
-
1
votes1
answer81
viewsCtrl+Click to open a Java class
When trying to open a class, either from my own project or native Java using Ctrl+Click, the following message appears: How do I set up Eclipse to open the class source code using Ctrl+Clicking?…
-
1
votes0
answers116
viewsMaking a data filter
I have a page where I list data from a table in my database. In it, a field and a form, to filter data from the table. Follow the code that has been used to make the filter: <p:panel…
-
1
votes1
answer1031
viewsProblem with nextLine() after nextInt() in a Loop
I have this code to remove from a ArrayList, and a while to check if the user wants to continue removing elements. But when the remove value is true the logic "skips" the next question (Wishes to…
-
1
votes1
answer654
viewsReceive json array value for string - Java
Hello, I don’t have so much knowledge in Json and I’m having a problem and I couldn’t find an exact solution to it in the community. I have the following json file format: { "name" : "ProductName",…
-
1
votes0
answers107
viewsRemove file from a Jlist and from the computer
I have a frame, with a list of values where several files are displayed. At this time I am doing the delete button sentry (last part code), where the goal is to delete the file from disk, and jlist.…
-
1
votes0
answers467
viewsHow to generate a list with data from an Android Checkbox?
I am developing an Android app for pizzeria that generates a list of ingredients from checked Checkbox, IE, the user gives a "check" in the items you want for your pizza as catupiry, pepperoni,…
-
1
votes2
answers115
viewsFATAL EXCEPTION error when loading image gallery using Asynctask
I’m creating a small gallery and I’m having trouble uploading the images using Asynctask class Adapter: public class AdapterGaleriaFragment extends BaseAdapter { Context ctx;…
-
1
votes1
answer157
viewsclose Activities in Dialog
The problem is a quiz app that’s ready, except for this problem. the app has activities A(start game), B(questions), C(result). on A has a start button game that by clicking, goes to B. By clicking…
-
1
votes1
answer54
viewsAsynktask does not run doInBackGround
I am developing an android app for the integrative college project in which I need to pass parameter 2 strings (user and password) to a PHP API that will return a User object or a Boolean false. I…
-
1
votes2
answers1635
viewsHow to open a web link on a java button?
Well, I created a class : import java.awt.Desktop; import java.net.URI; public class AbrirLink { public static void main(String[] args){ try{ URI link = new URI("www.google.com");…
-
1
votes0
answers257
viewsHow to compare the day of a Localdate in Criteriabuilder
I have an entity that has a Localdate field. @Entity @Table(name="feriado") public class Feriado implements Serializable{ private static final long serialVersionUID = 1L; @Id…
-
1
votes1
answer30
viewsNoclassdeffounderror - Only running via Jenkins
Hello, I have an automation project with Selenium + java + Maven integrated into Jenkins. Today I did a refactor on it moving some classes to new packages. In my machine there is no problem of…
-
1
votes1
answer48
viewsWays to remove with Sparsearray
While trying to remove items from my SparsArray found the method remove and another method that is the removeAt but what’s the difference?
-
1
votes1
answer60
viewsStringtokenizer with String delimiter does not work
I have to wear one string tokenizer to share a string in Java. the code is like this: StringTokenizer st1 = new StringTokenizer(palavra, "--"); But when I enter the following string: 1 - -- * d 2…
-
1
votes1
answer373
viewsWorking with high quality images in sqlite3
In my application I make the selection of an image from the gallery, then I save it in the bank, but if the image has a high quality the app does not save, besides not saving it to work, has some…
-
1
votes1
answer87
viewsMain method in Jframe?
I have a question: When creating a new Jframe in Netbeans, a main method is placed inside it, I thought it was necessary and therefore never touched it. Today I deleted it and the program continued…
-
1
votes2
answers223
viewsAre parameters with vectors in Java always by reference?
I am aware that, in Java, any parameter passage of an object is by reference, already with primitive types, by value. However, I was left with doubt about the common vector. I don’t mean the class…
-
1
votes1
answer138
viewsConditional return of Checkbox with problem
I’m making a mistake that ridiculously seems easy, but I can’t fix it. In my xml has a CheckBox returning false (disabled), in my java has a simple if(termosUso.isChecked()){}, in theory was so that…
-
1
votes1
answer1371
viewsHow to list files and folders from ftp server?
I’m not able to list the FTP server in the app, using the Android emulator, I realize that in the old versions of Android the listing happens normally. However from Android 4 I have problems for…
-
1
votes0
answers218
viewsHow to make a POST with an Httpentity in the correct format?
Good morning, I’m performing a POST for a API using the HttpEntity of Spring, but I’m not sure if the POST that I’m performing is being done in the right way, and I’m having mistakes in creating a…
-
1
votes1
answer55
viewsJPA in java web
I am with a JAVA WEB project and I am having problems with Hibernate. The error is as follows: Informações: HCANN000001: Hibernate Commons Annotations {4.0.2.Final} Informações: HHH000412: Hibernate…
-
1
votes1
answer72
viewsMove File to JAVA Recycle Bin
Hello, there is some way I can move a File to the recycle bin instead of deleting it permanently? File f = new File("um caminho com um arquivo top aki); f.delete(); //retorna um true caso consiga…
-
1
votes1
answer53
viewsPause an Asynctask until a task is completed
In my Asynctask I urge 4 new objects, only I have to stay in it until all objects are brought in. Follow the code: @Override protected Void doInBackground(Void... voids) { new…
-
1
votes1
answer49
viewsWhy doesn’t my button event start in Swing?
import javax.swing.JFrame; import javax.swing.JButton; import javax.swing.JLabel; import java.awt.event.ActionEvent; public class main{ public static void main(String[] args){ JFrame frame = new…
-
1
votes2
answers430
viewsProblems with a Java Linked List object
I’m learning from the Caelum datastructures handouts, and I started to see Liagadas Lists, followed all the code it offers, step by step and understood the logic of the chained list, but what I…
javaasked 7 years, 11 months ago user53564 -
1
votes2
answers735
viewsMultiple Databases with Spring Boot
In my application, customers have their own database and I am developing a REST application, with Spring Boot, from which I need to configure Datasources to connect to databases, according to a…
-
1
votes0
answers40
viewsHow do I create a library in Android Studio and publish it
I would like to know how to create a library in Android Studio and later publish it in a repository and add its dependencies in a project. Something like for example: implementation…
-
1
votes2
answers250
viewsHow to validate elements produced during a Java Stream before Collect?
Given the hypothetical example below as it would be the best way to validate all the elements produced by a Java Stream, in the example below I would like to check if all the elements produced are…
-
1
votes1
answer111
viewsCheck if position is between 2 positions
I am using this code here to check if a position is 'inside' an 'area', but it will probably explode if the hashmap has many Keys/Values, what would be the best way to do this ? Thank you.…
-
1
votes1
answer187
viewsJava Class Constructor Fix to Sonar
I need to correct some differences in sonar. I have these builders, getters and setters: public EmpregadoContrato() { // construtor padrão } public EmpregadoContrato(Integer id) { this.id = id; }…
-
1
votes3
answers686
viewsProgrammatically change the background color of the Overflow Menu in the Toolbar
My application has an option that allows the user to switch between layout daytime colours and other layout night colors. My problem is that I don’t know how to programmatically change the color of…
-
1
votes2
answers471
viewsSpring boot: Unable to find or load main class
It’s been a while since I’ve used Spring. I changed the name of the controller package and the application doesn’t want to run anymore. On the second underscored red image was costume.costumes the…
-
1
votes0
answers49
viewsHow to add the necessary permissions for the Printer Job to work on Tomcat7
Ambience My environment is Tomcat7 and I am using Java 1.8, Windows 10 and I am using a PDF Reader to test the print. My user is a machine administrator. Problem I am trying to send a PDF for…
-
1
votes3
answers2177
viewsDifference between a return and no return method
What is the difference between a method with return and another without return? Since a method with no return could be just the sum of two numbers, I still have the result of this sum.
-
1
votes1
answer871
viewsWhat is the difference between Resttemplate for Spring boot Feingclient?
I came across a question: What is the difference between the RestTemplate (I never implemented) and the FeingClient (I’ve already implemented)? I realized that the two have the same or similar…
-
1
votes0
answers39
viewsIs it necessary to use any CI tool to build and build Docker-Compose with Maven?
I am building a web application with Spring MVC and Postgres, my problem here is with using pom.xml to create a Docker-Compose file to deploy in containers. Is it possible to add commands to pom.xml…