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
answer210
viewsHow to verify that vector fields are null?
I am building a program, which should initially check whether the array of type (Class) is null. My class has the get and set method, as well as the constructors with and without standard. However,…
-
-1
votes1
answer207
viewsHow can I add 2 submenu buttons in Android Studio
I would like to add dynamically options to my screen menu on Android, I saw several examples, but all facing a single button. supposing that I have. override fun onCreateOptionsMenu(menu: Menu,…
-
-1
votes2
answers47
viewsAlert only appear 1x inside a for
I have a question: I have a method that goes through a list of clients and in it checks if it is the type countSolidaria =3 , every time the method goes through this list he gives an Alert showing…
-
-1
votes1
answer46
viewsUsing a NOT Criteria with Hibernate
Currently, I have a survey with Criteria that brings me results normally, but I want to add an implementation like NOT. Does anyone have any idea how I could do that? I put in the code a comment…
-
-1
votes1
answer587
viewsException in thread "main" java.lang.Noclassdeffounderror: org/apache/logging/lo g4j/Logmanager
I am trying to start a jar file and as soon as I run, I get this error! You can help me? C:\Unky\Web\BloodStrikeServer-master>mvn clean package -Dmaven.test.skip=true 'mvn' não é reconhecido como…
-
-1
votes1
answer75
viewsHow to generate with while or do-while multiple Iterations in an Arraylist of a data set?
I have the following data set in an arraylist. Conference,Conference,1.0,1.0,1.0,1.0,1.0,1.0,true,1.0, 01,6.0 Reviewer,Reviewer,1.0,1.0,1.0,1.0,1.0,1.0,false,1.0, 01,6.0…
-
-1
votes1
answer49
viewsNullpointerexception do not know how to solve
I’m making a house class and a door class, and in the house class I’m declaring 3 doors and when I’m going to run gives Nullpointerexception, could someone give me a light class of my door package…
-
-1
votes1
answer221
viewsError: package not imported in eclipse
I’m creating a Rest app in eclipse but am getting an error message when importing classes from jersey. Code import javax.WebServices.rs.GET; //import da biblioteca jersey import…
-
-1
votes1
answer151
viewsjava Import video file (.mp4)
I need to import a video file (.mp4) and store it in a Bufferedimage[], so I can work with each frame as if it were an image. my code(the part with (??? ) is where I did not agree): public class…
-
-1
votes2
answers70
viewsWhat’s the fastest way?
I made a little game in Java and the players' dice are in the database, when a player enters, he is placed in a ArrayList<PlayerData> where it contains the getters and setters of level, money…
-
-1
votes1
answer112
viewsHow to deal with the null values of an array when converting from String to Double?
I need to display the top 10 contract termination clauses, which are in a vector, extracted from a CSV file. Here, when I refer to contract termination clauses, I mean monetary values (money), more…
-
-1
votes1
answer64
viewsDisplay a string in a text field that is locked for editing
I have developed a client-server chat and I am incrementing some functions to make it more presentable and complete. One thing I still don’t know how to do is display a string within a text field.…
-
-1
votes1
answer157
viewsString Arrays
In a "use java head" book exercise, it asks to declare 3 string arrays, but when I put the code in the ide it gives an error of incompatible string types to String[] someone knows why??? package…
-
-1
votes1
answer42
viewsGPS sensor locking when sensor is off
I’m making an app that reads GPS coordinates. When the sensor is on and running, the app pulls the information right, but when the sensor is off, the app hangs when I try to read the coordinates…
-
-1
votes1
answer1212
viewsError : java.lang.Nullpointerexception: Cannot invoke method Trim()
I have tried using Port and baseUri and does not run the rest, always fails. Complete error: java.lang.NullPointerException: Cannot invoke method trim() on null object at…
-
-1
votes1
answer47
viewsI cannot compile my program because I have an error that says "Nullpointerexception"
I’m trying to build a Java project according to the concepts of object-oriented programming. However the compiler(ECLIPSE) accuses an error in the line of my liigar function. It says it has a…
-
-1
votes1
answer118
viewsError: The constructor Velocitytemplate(Inputstream) is Undefined
import java.io.Serializable; import java.util.Locale; import javax.enterprise.context.RequestScoped; import javax.inject.Inject; import javax.inject.Named; import…
-
-1
votes1
answer5720
viewsError executing application (Unsatisfieddependencyexception: Error Creating bean with name )
Can anyone help me about the error presented while trying to run the application? Error: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name…
-
-1
votes1
answer43
viewsDifficulty in array
I am trying to make a code but error in the array. If someone can give me a light. Master code: import java.util.Scanner; public class Tanque { int valor; private int kmTotal = 0; private int…
javaasked 6 years, 6 months ago guilherme cabrals 19 -
-1
votes1
answer41
viewsEndpoint Rest with Jersey shows no expected result
I created a Javaee project directly in Intellij and added the Javaee 8 dependencies via Maven. The structure of the project is in this link. web xml.: <?xml version="1.0" encoding="UTF-8"?>…
-
-1
votes1
answer143
viewsjava build error ( javac )
I have a "poo1.java file": package pootest; public class init{ public static void main(String[] args){ Caneta bic1 = new Caneta(); bic1.cor = "azul"; bic1.tampada = true; bic1.ponta = 0.5f;…
-
-1
votes1
answer703
viewsMake Application Work on Local Network Only - Localhost
Good morning to all. Guys, I have a network in a client of 3 computers. As there is no internet on the server works with the following address the registration of users.…
-
-1
votes1
answer109
viewsAndroid Development with Android Studio - Recyclerview is not working
I’m trying to get into this world of Android development, using Android Studio. And right at the beginning I already face a simple problem for an experienced programmer who uses Android Studio but…
-
-1
votes1
answer231
viewsProblem with JSF2 + CDI + Tomcat
Personal talk, I’m working with JSF and I’m here. I have a simple project for now, with a page with a form that has an Enum attribute in it, IE, when the page is loaded has a selectItems there that…
-
-1
votes1
answer80
viewsnull Object Reference
Logcat java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.View android.view.LayoutInflater.inflate(int, android.view.ViewGroup, boolean)' on a null object reference…
-
-1
votes1
answer32
viewsImage being saved with poor quality
The following code is to save the image in a certain folder, which is taken by my application, but the image is saved with a horrible quality, even being at most "100". if (requestCode == 5) { if…
-
-1
votes1
answer167
viewsI can’t put picture in a Jbutton
I tried to put the image but it’s just enough NullPointerException, I have tried creating a folder called img inside the briefcase src and point there however unsuccessfully too. I don’t know what I…
-
-1
votes1
answer41
viewsCounting months from a date
An Adm will register an ad, what I want, is to pick up the dataCadastro and from it count 1month, 2months, 3months(depends on Adm ). package br.com.petpoint.models; import java.util.Date; import…
javaasked 6 years, 5 months ago Fabiola Matos da Cruz 3 -
-1
votes1
answer531
viewsWhat’s wrong with running the React-Native app?
Hi, I’m trying to run my React app Turn on via command sudo React-Native run-android But always returns me the following error message: FAILURE: Build failed with an exception. * What went wrong:…
-
-1
votes1
answer158
viewsCollection of an Object making calculations with Bigdecimal
I have the attribute valorTotal this value must be represented by the sum of all items in the Item class that are in the list items, I am trying to make the sum of all the items in the list that are…
-
-1
votes1
answer200
viewsCondition IF, ELSE
I have a Java Spring MVC application, with Hibernate and JPA and HTML interface. I have Two forms that depend on the Notebooks class registered and its attributes. The forms have the following…
-
-1
votes1
answer35
views -
-1
votes1
answer660
viewsHow to close jframe from an actionPerformed?
I created a java login application, but I can’t close the screen during ActionPerformed of the button with the this.dispose(); What to do to make it work? Code: import java.awt.EventQueue; import…
-
-1
votes2
answers806
viewsHow to deserialize Json Springboot webservice
I am trying to consume the themoviedb webservice and am encountering following error. -----------------------POJO---------------------------------------------- package com.wsemovie.model; import…
-
-1
votes1
answer764
viewsException in thread "AWT-Eventqueue-0" java.lang.Numberformatexception: For input string: "8"
I was developing a simple java application using Swing, and I don’t know what the error in my code. Here follows the code: private void btnVerificaActionPerformed(java.awt.event.ActionEvent evt) {…
javaasked 6 years, 3 months ago Ângelo Salles 41 -
-1
votes2
answers80
viewsReading strings and saving them in arrays
I am trying to make a program in which vendor names have to be read and have to be stored in an array. My biggest problem is that I don’t know what is the limit of names entered by the user. Hence I…
javaasked 6 years, 3 months ago Guilherme Daniel 11 -
-1
votes1
answer71
viewsMove Files after FTP Upload
My code uploads all images without folder, and it’s all OK! But what is it that needs to do FTP as images are uploaded to the path: "/storage/emulated/0/PicturesGRP/enviados";, storing the uploaded…
-
-1
votes2
answers74
viewsJava running 2 programs in parallel
I’m using intellj and I just started a free course. I challenged myself to make a code in which you put a date and the program says the day of the week, but when trying to run the code opens a small…
-
-1
votes1
answer62
viewsActionbar disarranged after updating Android Studio
After update no more Actionbar appears in new projects. Androidmanifest.xml: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android"…
-
-1
votes1
answer623
viewsAndroid Studio Error:Execution failed for task ':app:instantRunMainApkResourcesDebug'
I’m developing an app android, when I try to run or compile my app I get the message Execution failed for task ':app:instantRunMainApkResourcesDebug'. Compiler points out that there is an error in…
-
-1
votes2
answers175
viewsSetters in an array
I have a array of private integers separated into one class (Obs.: I did so to train the use of the get and of set) and another class that must set values at the addresses of array. This is a…
-
-1
votes1
answer415
viewsUnit test of an SQL query in Junit
I need some help to do the unit test on Junit. How to do the @Test method below: public static StringBuilder findSQLPA() { StringBuilder sql = new StringBuilder(); sql.append(" select…
-
-1
votes1
answer259
viewsHow to create a selector to choose between Camera, Gallery and Photos in Android Studio?
Speak Devs! I already gave a search, but I could not find something that would help me, anyway... I would like to create a menu similar to that of the image below. I can get camera and gallery…
-
-1
votes1
answer118
viewsHow to show the project version on the JSP page of a Spring MVC Web application
In the Java Web project with Spring MVC framework has the file pom.xml and within this file has several properties, among these properties has the version of the project:…
-
-1
votes2
answers417
viewsJar does not perform
I am using netbeans and Maven. When I try to run the jar file in cmd, the error shown is "no major manifest attribute in". Follow the nbactions.xml code: <?xml version="1.0" encoding="UTF-8"?>…
-
-1
votes1
answer301
viewsHow to disable a commandButton in Primefaces according to the return of a Boolean method implemented in the bean?
I have a button to delete a file that I just want to appear to the user if my class has records. Just follow his code: <p:commandButton icon="ui-icon-trash" value="Excluir"…
-
-1
votes1
answer50
viewsJava reflection value checker
I’m trying to use Reflection and Recursion to capture values. For example: public class Endereco{ String rua; Integer numero; } public class Cachorro{ String nome; Integer idade; } public class…
-
-1
votes1
answer161
viewsJSP and return java age
How to calculate age, I don’t know how to do in JSP and how to calculate with Java class method Java age. import java.text.ParseException; import java.text.SimpleDateFormat; import…
-
-1
votes1
answer944
viewsJava: find files in directory
I have a simple function to search a file in the application directory and return it, however the return is always being empty, I could not find where the error is. Path currentRelativePath =…
-
-1
votes1
answer370
viewsDisplay data from an array of objects stored in memory
I cannot make a method that returns the information of registered students. package menu; import java.util.Scanner; import modelo.Aluno; import repositorio.RepositorioAluno; public class AlunoMain {…