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
votes2
answers43
viewsDivision does not display numbers after the comma
My algorithm in all tests println(), is working and in logic also however, the numbers after the comma it does not demonstrate. public class Exe27 { public static void main(String[] args) { // TODO…
-
0
votes1
answer363
viewsError connecting to Database - Firebird/Java
I am trying to connect a java desktop application to a Firebird database and the eclipse console shows the following error: "PM org.firebirdsql.logging.Jullogger warn: WARNING: No Connection…
-
0
votes1
answer63
viewsJsoup does not bring full HTML Document
When capturing the page and displaying it on the console, I realized that the HTML was not complete. During the execution I can notice that it returns many elements, but when it finishes the…
-
0
votes1
answer82
viewsProblem passing version on Maven via Property
I am trying to make a modification to a project to allow you to pass a Property and generate the package with the version that was passed. Ex: mvn package install -Dversion.app=0.0.1 But I have a…
-
0
votes1
answer151
viewsI can’t use Scenebuilder with Eclipse
Hello, I have Eclipse (Eclipse IDE for Java Developers) and wanted to install Javafx. I already installed e(fx)clipse and restarted the IDE. But when I create a new project in New > Other, the…
-
0
votes1
answer861
viewsAPK continuously crashes
My APK opens correctly when the code is this: package com.example.wheresmybusdriver; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import…
-
0
votes1
answer558
viewsNothing happens when running Java project in Intellij
I’m trying to run a project in Java but going to "Run" -> "Run" or Alt+Shift+F10 and nothing happens. The terminal doesn’t show anything, even though it has System.out on main. Only my colleagues…
-
0
votes1
answer186
viewsError @Postmapping @Manytoone settando "usuario_id" spring boot
I’m using Spring and Hibernate in one of the applications I’m working on and I have a problem with processing transactions. I need to do a POST using 2 entities, the Lancamentoentity and…
-
0
votes1
answer33
viewsJSF <p:command button> action is not invoked for download
Good morning guys, I need to open a dialog for report, and in p:inputtext I need to validate if there is such a client , if there is no client list open by another dialog and select which…
-
0
votes2
answers382
viewsShopping Cart Java
I have doubts about the creation of a shopping cart, I managed so far: Inform the product name, Product price Quantity; there is the sum and the question if you make another purchase, if it is "N"…
javaasked 5 years ago vagner matos 13 -
0
votes1
answer191
viewsBest way to set up the HTTP header content-length
Hello, I have a video player that makes a request via Servlet that already works and I need to include a new video. At first I will return the video according to the logged in user. The problem I…
-
0
votes1
answer23
viewsService in workmanager runs only on usb cable by android studio
I have an android application where after the user enters his company ID he activates a switch and from there the application is posting in an API the position of it. This is done through the…
-
0
votes1
answer57
views"Uncompilable source code" error when trying to connect to database
Of that mistake: java.lang.Runtimeexception: Uncompilable source code - Erroneous Sym type: br.com.infox.dal.Moduloconexao.forName This is my code: package br.com.infox.telas; import java.sql.*;…
javaasked 5 years ago thiagobarth 1 -
0
votes1
answer466
viewsHow to Maintain Mobile Self-adjusting Iframe?
I need Help. I always turn to help here when I need help in general, but I found no answer, and nothing that works. I need to create a friendly address - index, which will call a very long page in a…
-
0
votes0
answers39
viewsDecrease quatity of "if"
Hello ! I made a Java code to answer an exercise and was curious to decrease the amount of "if" in order to improve the code,who can help. The questionnaire calls for. Develop a program that reads…
-
0
votes1
answer94
viewsHow to use the Scanner class to read two inputs separated by a Java space, and by two different variables?
I am trying to do something simple, I would like that, given two arguments separated by a space, read through stdin, each be stored in a different variable, for example: Scanner s1 = new…
javaasked 4 years, 11 months ago Pirategull 659 -
0
votes1
answer59
views(Java) Read TXT (input) and generate TXT (output) with organized information
I need to make the following logic: 1- Read a txt with several lines, each line has an activity EX: Walk 10min, Study 30min... (each activity in a row). 2- Half day lunch time. 3- Organize the…
-
0
votes1
answer63
viewsStatus error 404 (Servlet)
I’m having a problem with this Servlet, when I start with Tomcat error 404 appears and displays the following message "The requested Resource [/test/Novaempresa] is not available". JSP <%@ page…
-
0
votes1
answer121
views"onClick" and "onLongClick" functions are called with a single touch
I have a simple problem, but I cannot find a specific solution to this problem. Inside my application I have a Recycler View and in it I have two click events: one for simple touch and one for long…
-
0
votes1
answer485
viewsSort using tie-breaker criteria
I need to sort a list of objects with the following criteria: Higher average proficiency levels in each of the technical competence required for the task; If the averages are equal, unpack for the…
-
0
votes1
answer76
viewsJava Spring: Post method does not insert relationship id
I’m learning the Spring framework, I tried to follow some 1-1 relationship tutorials where a library has an address. When uploading library data and address id in the body, a new record is inserted…
-
0
votes0
answers15
viewsjava.lang.Nullpointerexception error
Good, I’m trying to use Session = sessionFactory.openSession(); to fetch objects in the BD and give me the following error. Exception in thread "main" java.lang.Nullpointerexception at…
-
0
votes1
answer158
viewsAuthenticate user with SQLITE database
I’m needing the parameters used in the button to query the database (the code was the result of another post response) when trying to implement the function inside the baton I could not get it to…
-
0
votes2
answers67
viewsHow to pause Thread while Alert runs within Platform.runLater - Javafx Java
I need to execute a method within a Thread that contains Alert and Dialog. As you already know Javafx has the limitation of not being able to show Alert or Dialog inside a Thread, so I put them…
-
0
votes1
answer26
viewsHow do I retrieve information from a Java window in a Combobox from another window?
I have a register of suppliers and one of products, and I would like to recover in the product registration window the information of which suppliers are already registered to be able to save in the…
-
0
votes1
answer129
viewsChange button color when click = Gree when drop back normal color?
I want when I click on Button it to change color and when I drop it back to original color! Part of Button public void addButton(String comprar, final InterfaceBtn interfaceBtn) { final Button…
-
0
votes1
answer25
viewsHow to create a Bucket on Aws S3 using android?
I’m trying to do it this way: public AmazonS3Client getS3Client(Context context) { BasicAWSCredentials credentials = new BasicAWSCredentials(accessKey, secretKey); s3Client = new…
-
0
votes0
answers57
viewsServlet does not receive the URL parameter
I’m trying to create a basic password recovery system. Each user has a token stored in the database and when trying to create a new password, it would be stored in the same account as the token…
-
0
votes2
answers172
viewsHow to access an attribute in a Java Arraylist?
I created an application that receives some data and gathers in a ArrayList of a class that is in another package. How do I recover an attribute that is private by getter that is in the other class…
-
0
votes1
answer46
viewsQuestions with the Clear command
Good evening, you guys. I’m new to the forum, so I apologize if you’ve already asked this question. My doubt concerns the command .clear(); using the webdriver Selenium in eclipse. Well, I’m…
-
0
votes1
answer59
viewsHow do we know which object another object belongs to?
I’ve tried to come up with a simpler example, so I have a person who has a list of cars. If I have a C1 car, how will I know who it belongs to? public class Pessoa { private String nome; private…
-
0
votes1
answer54
viewsHow to use Interceptor in Spring?
I’m a beginner, and in the project I’m developing I used the Interceptor to block access to other resources if the user is not logged in to the session. For example: if the user has not logged in,…
-
0
votes2
answers1098
viewsResponsestatusexception - Spring boot - Return of the message
I am new to java and I am created a training API and I came across the following problem: I do the request via Postman, the return of JSON is ok, but if I do a search that does not return anything…
-
0
votes0
answers26
viewsSave time in format: HOUR:MINUTE using primefaces
I have a following problem, I want to save an entry time in which I type this time and I did this in xhtml: <p:datePicker maxlength="6" id="timeonly" showTime="true"…
-
0
votes1
answer121
viewsHTTP GET in JAVA with a different result than POSTMAN
I am running an HTTP Get Request in Java using Gson to use the data in my program, but the first and last attribute are coming as null. However, when performing the request in POSTMAN I saw that…
-
0
votes1
answer123
viewsError Caused by: javax.mail.Authenticationfailedexception
I’m trying to use the Commons Email library, but this is giving the following error Exception in thread "main" org.apache.commons.mail.EmailException: Sending the email to the following server…
-
0
votes1
answer200
viewsTransfer an object within a class method to another class
Well, I know I’m doing it in the least practical way, but I’d like to know how I transfer an instance from one class to another class. I’m creating an algorithm in which I’m going to call a method…
-
0
votes1
answer29
viewsError in Relationship NoHibernate
I have the following classes User: import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; import javax.persistence.CascadeType; import…
-
0
votes1
answer46
viewsMethod that returns the smallest between two parameters does not work
Create a method with two parameters that returns the smaller of two numbers passed as parameters When I don’t know how to solve, usually I will see the resolution with explanation, but it turns out…
-
0
votes1
answer266
viewsFirst faces problem when converting an Enum
I’m having trouble converting an I made a class to convert only at the time of subtemer the form happens the following error: javax.faces.FacesException: java.lang.IllegalArgumentException: No enum…
-
0
votes1
answer53
viewsHow do you pass an activity value to a fragment?
I’m trying to instantiate a method that returns a value of type int in a fragment, but when I show the value on the device screen Textview shows this: null. Fragment code: public View…
-
0
votes1
answer146
viewsError while performing Basic Auth authentication in REST API on android
I’m having a hard time integrating with an API using basic auth authentication. I created a Java API using spring boot and spring security. When I use Postman the request works without any problem,…
-
0
votes2
answers311
viewsHow to subtract 2 hours string
I’m doing a Java project in Android Studio where I have a database connected to a BD on a server. In one of the tables, I have 2 hours, hora_inicio and hora_fim that are extracted to string. I…
-
0
votes3
answers983
viewsCheck if an element exists if the page is loaded. (Selenium)
I am testing a piece of my application, so I created the following method to check if the element exists on the page: public boolean existe(){ try{ driver.findElement(elemento); return true; }…
-
0
votes1
answer142
viewsSpringboot does not generate the tables in the bank
When I run the project, my tables do not appear in the database. I noticed that when I take my relations out of the attributes that I declared @Onetomany, it creates the tables, but my project needs…
-
0
votes1
answer144
viewshow to join lines in a text file and create a folder automatically on disk
Given a text file as described below: MARIA;5;MPOO MARIA;3;AED MARIA;5;MPOOJOHN;1;IP How to create a logic to obtain a result (which groups by equal names and discipline and adds the interactions),…
javaasked 4 years, 10 months ago Manuela carneiro 31 -
0
votes1
answer93
viewsRepetition loop in Java
Hello I am new in Java language, I would like to know how I could implement a repetition loop every time an Inputmismatchexception type exception was capture, in this case return to the beginning of…
javaasked 4 years, 10 months ago rafae_domingues 35 -
0
votes3
answers227
viewsHandling of JAVA arrays
Good morning, I am developing a very simple stock system where the items will be stored in a matrix follows code: package main; import java.io.Console; import java.util.Arrays; import…
-
0
votes1
answer30
viewsUsing the JPA Repository example
I need to do a search in the bank where I have an object that is filled with everything except the id and check if it has any object that gives a "Match" with it and return it! I thought to make a…
-
0
votes1
answer167
viewsOverwrite an Inheritance property or not ? Kotlin
I have a question about code : class SaldoInsuficienteException(mensagem:String = "O saldo é Insuficiente") : Exception(mensagem) Now I tested imagining how the code was written in English and the…