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
votes0
answers86
viewsI cannot remove element from the list
When I upload photos using FileUpload I can’t delete from the list where I’m adding. Use that StremedContent to be listed contentNova every time the method is called by FileUpload. The problem is…
-
0
votes1
answer168
views@Inject does not work inside annotated class @Scheduled
I am creating a class using deltaspike and Quartz, using @scheduled. In this class I inject a CDI bean, which is a service class. I chose to use deltaspike because it controls the CDI context within…
javaasked 6 years, 7 months ago Alexandre Camilo 16 -
0
votes1
answer312
viewsClasses Parameterized with Junit 4
I have an exercise to solve involving classes parameterized in Java and I’m a little confused. The exercise is as follows: Program a parameterized class to test the method with the following input…
-
0
votes1
answer64
viewsWrong time recording
I own these 3 classes as a model. Object: import java.io.Serializable; import java.util.List; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity;…
-
0
votes0
answers250
viewsHibernate does not create table in the database
The event model is an entity that should be created in the bank, but Hibernate is not creating. persistence.xml <persistence xmlns="http://java.sun.com/xml/ns/persistence"…
-
0
votes1
answer105
viewsConnection error while using Hibernate Logs
I am trying to see the Hibernate generated sqls in my JAVA application but I am having problems because when adding the two commands below are launched some exceptions. Commands I am inserting into…
-
0
votes0
answers34
viewsLong task on Broadcastreceiver, error: android.os.Networkonmainthreadexception
When I perform a task (which usually requires a AsyncTask) in the BroadcastReceiver, he accuses me of error: erro: android.os.NetworkOnMainThreadException I saw that it is not a good practice a…
-
0
votes0
answers220
viewsNetbeans error starting Tomcat. "Error: Unable to locate or load the main Tomcat Files class"
I’ve had this problem for days. On two other machines with the same operating system, the same installation procedure was done and no error occurred. I’ll be attaching print with the bug. I have…
-
0
votes1
answer68
viewsxmlns jsf error, settings?
I am getting the following error when trying to compile a xhtml page, I am using the xmlns`s below: Elements with namespace http://java.sun.com/jsf/html may not have Attributes in namespace…
-
0
votes3
answers842
viewsSave state when returning to an Activity
I have an Activity of registration with 4 fields: 1 editText and 3 Spinners. At the click of a button the data entered in these fields are recorded in the database and lead to another Activity with…
-
0
votes2
answers145
viewsHow to run request again after having permission accepted on android?
I have a button that when pressed it should open the telephone call mode with a dynamic number. This method requires permission CALL_PHONE. And when pressed the first time, it opens a dialog asking…
-
0
votes1
answer422
viewsGet specific value from a JSON JAVA URL
Good morning Friends. I’m having a hard time handling information collected in a third-party online JSON url, my APP needs information from various websites that send back different ways in JSON…
-
0
votes1
answer182
viewsInsert a code into Mainactivity
I just started messing with Androidstudio and here’s the deal. I have this code in my mainactivity: package com.tero.master; import android.media.MediaPlayer; import…
-
0
votes1
answer413
viewsContent Not Allowed in Prolog, even though XML is perfectly formatted
So, I’ve been trying to send an XML to a Southern Sapucaia Webservice, RS. XML requests the printing of a PNG-shaped Nfse. The problem is that XML is sent and as a return I receive a message stating…
-
0
votes0
answers227
viewsFilter Datatable Primefaces does not work with p:selectCheckboxnu
Talk to me, people! I’m using the filter itself datatable of primefaces but it’s not working when I use it to filter the p:selectCheckboxMenu.When I select one of the options it doesn’t find…
-
0
votes1
answer182
viewsCreate a comparison string in Java
When I put to execute the code by Eclipse and arrive at the part of typing the login gives an error which I do not and does not go to the next phase that is to enter the password. I would like a…
-
0
votes2
answers73
viewsproblems with consultation in hql
I’m doing a criminal record project. The goal is to register and consult customers and employees, however, it is already possible to save the data, the problem is to consult. I made Jpanel forms (I…
-
0
votes3
answers1595
viewsHow to pass code (id) through my viwer using Thymeleaf and spring mvc for the controller?
My entity: package local.demo.models; import java.io.Serializable; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import…
-
0
votes1
answer72
viewsReading of files in Java
public static void loadfile(stock []a) throws IOException{ String fich; File fichDad; int i=countDatas(a); while(sc.nextLine().length()!=0); do{ System.out.print("\nQual é o nome do ficheiro que…
-
0
votes0
answers33
viewsAndroid - app stops working when I open the camera
I have a project that there is a form that the user can take a photo to insert, this worked but due to an android update whenever I click the photo button the app to, someone knows what can be?…
-
0
votes1
answer62
viewsCreate objects after external server response via API
Here’s the thing, I created a php API that generates a Json. THE LINK IS THIS for those who want to view. I was able to access the link and rescue the information, because I used a Toast to show…
-
0
votes1
answer136
views"The Java Exception has ocurred" error while running the Postgre JDBC driver
Follow my problem: 1 - I am using the Postgre 9.6 database. 2 - I downloaded and opened in ECLIPSE a project with example Java application with the use of Hibernate and Postgre that the teacher…
-
0
votes1
answer1723
viewsSend a POST request with java
I need to submit a POST request to the following address which is an Amazon API: https://ikd29r1hsl.execute-api.us-west-1.amazonaws.com/prod/contaazul/grade And in this request a JSON has to be…
-
0
votes2
answers103
viewsDoubt in Selectonemenu Primefaces
I have a Selectonemenu in my xhtml view. I have an onchange in it that when clicking calls a p:dialog to fill out a form. Follow selectOneMenu <p:column headerText="Mecânica"> <div…
-
0
votes1
answer43
viewsIterate over components Swing recursively is strange
To add Listeners to all components of my Frame I’m iterating on it recursively: private void adicionarListeners(Component componente) { Stack<Component> stack = new Stack<Component>();…
-
0
votes1
answer382
viewsError : "No Persistence Provider for Entitymanager"
I have a project in Eclipse with an application that persists in the Postgresql 9.6 database through Hibernate, but Java is not recognizing the "persistence-Unit name" which is set in the…
-
0
votes1
answer862
viewsHow to insert column titles into a jTable?
I couldn’t display the title of the chart, could you help? Obs.: I inserted it "JScrollPane scroll = new JScrollPane(tabela);" and "contentPane.add(scroll);" or "getContentPane.add(scroll)" as I saw…
-
0
votes1
answer925
viewsHow to convert a Json file to a list of objects in Java?
I am trying to read the data from a. json file and store them in a ArrayList<> of objects, but an error is occurring that I do not know what it means. Sale class - To store the data that will…
-
0
votes1
answer72
viewsProblem with weighted average logic
According to all the sources I have consulted, several to be sure, the weighted average is calculated as follows:: Add up all the values that have the same weight, then multiply this sum by the said…
-
0
votes1
answer96
viewsHow to extract String from a larger string separated by "/"
I have a string and want to extract a substring see in my code: String link = "lojas/RJ/Macaé/Loja Modelo/pedidos_ativos/03-03-2018-8773"; String uf =…
-
0
votes1
answer748
viewsEfficient method for comparing lists
I have a problem where I need to compare Strings and define their proximity. The problem is that I have a list with 21,000 records and I need to compare them all, with each other, which would give a…
-
0
votes0
answers207
viewsDoubt JSF Dialog + Selectonemenu
Hello, I’m trying to open a dialog with a selectonemenu, depending on what the user selects. My Selectonemenu looks like this <p:column headerText="Mecânica"> <h:commandButton>…
-
0
votes1
answer80
viewsCreate spinner with dynamic values
I’m trying to create a spinner with dynamic values. It’s making a mistake when I try to set the Adapter in the spinner, follows below the error and my code. java.lang.NullPointerException: Attempt…
-
0
votes0
answers57
viewsHow to return the value of a sql database combobox in a Jtextfield?
In my program I have a register of customers in which contain two combobox. One is districts and the other is counties. As I show in the next photo in the comboDistricts has several districts of…
-
0
votes0
answers39
viewsCriteria releasing Java heap space due to the size of Clause Restrictions.in()
I am trying to run a query using Criteria but it is returning a "Java heap" Exception. It’s probably because of the amount of data I’m going through in the "in" here below a code that represents my…
-
0
votes1
answer338
viewsManytomany JPA - Product Category
Hello, I’m having difficulties in the process of deleting a record that has relationship @ManyToMany. When I delete the record referring to the Product entity with the annotation CascadeType.ALL, it…
-
0
votes0
answers218
viewsHow can I change the position of the legend of Linechart Jfreechart?
I’m creating using Jfreechart to create line charts, but I’m having difficulty customizing the position of the legend. Currently my chart is like this: But I need the caption to be in the lower left…
-
0
votes1
answer177
viewsHow do I recover a result from within the "onActivityResult" in my Activity
I’m trying to use the camera phone as a barcode reader. I can retrieve the barcode, and see the result inside the "onActivityResult", however, I need to take the result I got, to my main function,…
-
0
votes0
answers148
viewsSwing integrated with Javafx is possible?
I wanted to know if it is possible to call a Javafx screen through a Swing screen button. The code of the Javafx screen I want to call is the following: public class EditorHTML extends Application {…
-
0
votes1
answer483
viewsInheritance, polymorphism and access to methods
I have 3 classes and 1 enum: public class Pessoa { private TipoPessoa tipo; public TipoPessoa getTipo() { return tipo; } public void setTipo(TipoPessoa tipo) { this.tipo = tipo; } } public class…
-
0
votes1
answer158
viewsMount container folder to host
Good afternoon, folks, I’d like some guidance on creating an image and Compose. I am preparing an environment for the java development team with eclipse toncat java and initial Workspace. I thought…
-
0
votes1
answer125
viewsButton does not appear in an Active and appears in another
I have a problem I don’t know where it is. I have a layout that runs a video, with a button in the front, only that the button does not appear although when I click on the area of the button it…
-
0
votes2
answers97
viewsApplication consuming too much server resource
I’m facing a problem with an app in Java for Android, the app apparently arrives at a point that consumes excessive server resource, if many users connect in the app reaches the point of taking down…
-
0
votes0
answers223
viewsjava.lang.Illegalargumentexception: org.hibernate.hql.internal.Ast.Querysyntaxexception: Unexpected AST Node: query
I’m having to make a SELECT in JPA that contains an ORDER BY by selecting from another table. Small representation of tables: When I did by SQL it was normal, but when turning into JPA, it did not…
-
0
votes2
answers318
views -
0
votes1
answer206
viewsDatepicker date return problems
I’m using a datepicker for an application that will be used in the course, but when I convert it from int to Date, it returns the date 29/03/2018 as follows: Wed Sep 08 00:00:00 GMT 34 Code that is…
-
0
votes1
answer142
viewsTomcat Maven web project Rest application does not work netbeans
Personal created a simple application to make a web service I did it this way netbeans file -> new project -> Maven (web application) I created a class called Restapplication package…
-
0
votes0
answers302
viewsError running setOnClickListener
I’m not able to do a simple BMI calculation. This is the error that appears in the image. Code: ButtonCalcular.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View…
-
0
votes0
answers40
viewsHow do you make Jtextfield behave like Combobox?
I wonder if there’s a way to turn my Jtextfield into some sort of combo box. I would like that when I type something, this data is automatically relating to some database and appear options of…
-
0
votes2
answers771
viewsCheck equal numbers java
Guys, can someone help me out here. I did a check of 3 notes inside a while. I need that if 2 notes are equal a message Aluno1 and Aluno2 (Show only if the two typed notes are equal) Approved. I…
javaasked 6 years, 6 months ago Leonardo Macedo 743