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
votes1
answer32
viewsError :Exception in thread "AWT-Eventqueue-0" java.lang.Nullpointerexception
Well, I’m trying to make a login screen, in which the data are in the database, and if you have the right data as in the bd appears a message to the user, but is giving error. The Login page: import…
-
0
votes1
answer37
viewsGenerate key to access document
I need to generate a key that contains letters and numbers Ex: "AJ67G8". I am generating with Random from java.io.Serializable: public static String nomeAleatorio(int nCaracteres) { Random rand =…
-
0
votes0
answers403
viewsSwipe Viewpager Tabs - alignment, icone color change, back to page 0 and shrink to Toolbar
Hello, I made in the code below a Viewpager with Tabs: In the code of Main: private TabLayout tabLayout; private ViewPager viewPager; SwipeRefreshLayout refresh; ParseUser currentUser; @Override…
-
0
votes1
answer1929
viewsImplementation of a Linkedlist
I’m having trouble implementing a LinkedList for the discipline of Data Structure. The code is giving this error: Exception in thread "main" java.lang.NullPointerException, and I don’t really…
-
0
votes1
answer67
viewsDisplay Sqlite table field values in the Console
I’m using the following code snippet to return on the Android Studio console the values of the fields of a DB: db.execSQL("CREATE TABLE IF NOT EXISTS pessoas(id INTEGER PRIMARY KEY AUTOINCREMENT,…
-
0
votes0
answers16
viewsWEBVIEW JAVA problems opening external links
Good morning, I’m having trouble in my Webview, I put my entire site to work in the APP, however... every time I click to open an external tab it opens externally, there is the possibility to open…
javaasked 3 years, 7 months ago Bruno Bafilli 85 -
0
votes1
answer164
viewsError Cannot make a Static Reference to the non-static method from the type
I’m trying to do this exercise and it returns this error: Cannot make a Static Reference to the non-static method triple(int) from the type Minhasfuncoes public class MinhasFuncoes { public int…
-
0
votes2
answers93
viewsWhen I use this permission an error occurs in the WHOLE. What do I do?
When I use this permission an error occurs in the WHOLE. What I do? if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED…
-
0
votes2
answers86
viewsI do not know how to call a certain item on the list that enters my "for" in other functions
I’m trying to make a program that picks up a list of partners that contain the name, email, and renewal day(like paying monthly fee), and when the day comes, send an email to it. But I’m having…
-
0
votes1
answer137
viewsHow to create a Gridview with gallery images?
I’m making a APP who works with images, I’m saving the images in a gallery folder called imagensAPP in this way: Saveimage: public File saveImage() { int imageNum = 0; //SALVANDO EM IMAGENSAPP . . .…
-
0
votes0
answers18
viewsWhy, in Java, should one prioritize the use of interfaces, rather than inheritance with classes?
I wonder why, in Java, one should prioritize the use of interfaces, rather than inheritance with classes.
-
0
votes1
answer27
viewsCan the main method already be written when creating a new class?
To speed up the process of creating the java class you would like the main method to always be written when creating a new class, as if it were a shortcut already integrated when creating the class,…
-
0
votes1
answer60
viewsPrivate encapsulation in inheritance
The class SuperSuper has an attribute of type private defined whole. Any specialization of the class SuperSuper may reset the encapsulation to public and your data is automatically converted? public…
-
0
votes1
answer57
viewsJSF - Deploy problems with Wildfly and Tomcat9 (web.xml and faces-config)
Hello, everybody! Good morning. I have a big problem that p/ me is bizarre. I have a little project here very simple, but I’m not getting up. When I run it from the entire project (right click - Run…
-
0
votes1
answer56
viewsCreate selects with Hibernate criteria Generico
I’m making a web software, administrative, it has several graphs and several tables, the problem with that is that several graphs and tables generate many queries to the database, and with that,…
-
0
votes2
answers58
viewsProblem with persistence with spring
The mistake: java.lang.Illegalargumentexception: Not an Entity: class br.com.api.entities.Characters My Class package br.com.api.entities; import java.time.LocalDateTime; import…
-
0
votes0
answers17
viewsHow to use a specific jvm
Hello, I am currently trying to reproduce result in information recovery task and the model I am playing is in java, a language I am not used to. To run the model, I need to use the bundled JVM…
-
0
votes1
answer73
viewsError while downloading intellij
I’m trying to download intellij but every time I set up and start a new project of this error: Could not open init Generic class cache for initialization script 'C: Users Allan Appdata Local Temp…
-
0
votes2
answers511
viewsWsimport of multiple equal services with various unnecessary operations
In Java, I am using the wsimport tool. The process works. However there are some problems. I have to wsimport into the services of several different suppliers (all of them third parties, I have no…
-
0
votes0
answers18
viewsGood evening, can anyone tell me what’s wrong with this media program?
Giving static class error for some reason, someone can help? class Media{ public int Media(int a, int b){ return (a + b) / 2; } public double Media2(double a, double b){ return (a + b) / 2; } public…
-
0
votes2
answers37
viewsHow to run a . sql file containing a Procedure (oracle) in Java
I have this script inside a file named xxx.sql how do I create Procedure through a call within java code? DECLARE PROCEDURE P_GERA_LOG(P_TEXTO IN VARCHAR2) IS BEGIN…
-
0
votes1
answer58
viewsWhat is the criterion of Java in having in some cases, a class in its API and in other cases an interface?
The Java API is immense, but some pre-defined features in it are implemented through a class and other functionality through an interface. What criterion used by Java to choose one or the other?…
-
0
votes0
answers11
viewsTable is not generated via jpa
I am studying JSF through the book "The definitive guide to jsf in java ee 8", but I made an error I reviewed the code many times and did not find the origin of this error : Exception…
-
0
votes1
answer48
viewsHow to get the value of a JSON field
I want to get the strings from inside the field text but they end up returning null. The JSON I get is this:…
-
0
votes1
answer63
viewsStrange characters when executing a method to add matrices
Good morning guys, I’m a beginner in Java and I have a little problem here. Can anyone tell me what are these strange characters that appear on the console when executing a matrix sum method (I’m…
javaasked 7 years, 10 months ago David Damasceno 846 -
0
votes0
answers15
viewsPlugin to build java objects automatically in Vscode or Intellij
Imagine the following situation: You have a Java class using lombok with @Builder This class has attributes with types referring to another class It is a class with many attributes Is there a plugin…
-
0
votes0
answers83
viewsConversion error on Primefaces imageCropper component
I’m trying to cut an image with the component imageCropper of Primefaces, but in the implementations I performed it only gives conversion error, and when not, the object croppedImage that Primefaces…
-
0
votes0
answers22
viewsHibernate Criteria: Sort list by highest date of a child object
How do I create a Criteria to list an object ordering by the longest date of a child object. In this scenario: Domain: class Entity { List<Children> childrens; } class Children { Date date }…
-
0
votes3
answers119
viewsHow do you not display repeated JAVA values
Good evening, I managed to get it to display all the values along with the repeated ones and only the repeated ones, I wanted to know how to display only the numbers that were not repeated. Ex:…
-
0
votes0
answers15
viewsHow to Disable Jframe X
How to disable X from a frame? The below option I found just doesn’t perform close action: frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); I need the X button of the frame to be disabled…
-
0
votes1
answer26
viewsHow to sum the lines of a two-dimensional vector and show the result of the sum of each line?
for (int i = 0; i < vetor.length; i++) { for (int j = 0; j < vetor.length; j++) { soma += vetor[j][i]; } System.out.print("Aluno " + (i + 1) + " : "); System.out.println(soma + " "); }…
-
0
votes1
answer57
views"Nullpointerexception" error is null
I have created a student and teacher registration program. You have a List option as well. However, when I go to register the teacher he gives the following error "Exception in thread "main"…
-
0
votes0
answers60
viewshow to pass data from a Double Chained List to a graphical interface?
I am very beginner in programming and I am coding this program for a job. I have a "Filmoteca", I need to navigate through a list chained with a graphical interface. I don’t know how I can navigate…
-
0
votes0
answers11
viewsUsing Mobileads.initialize in onCreateView
Hi I’m developing an app and I wish to advertise on it, only I’m having a question that’s starting to become a concern, My app has a navigation bar and I use fragments instead of activitys and every…
-
0
votes1
answer40
viewsError creating table Hibernate add ('type=Myisam') mysql
Hello, I am studying about Java web using Spring boot and Hibernate. but during an event project Hibernate is dropping an exception when running the server. if you need more information just ask.…
-
0
votes0
answers14
viewsCreate a user-generated Java object using Scanner or Joptionpane
Usually when creating an object we type Class obj1 = new Class(); But what if I want the user to create interactively on the console and give a name (like this obj1) to the object, as it is done?…
javaasked 3 years, 2 months ago Jairo Araujo 1 -
0
votes1
answer21
viewsProblems with Maven
Hello I read how Maven works, but there is one thing I don’t understand I will depend on Maven after creating my executable program ? i’m a beginner in java, I would also like to know how to use the…
-
0
votes0
answers12
viewsjava.lang.Classnotfoundexception: javax.persistence.Persistence
I am in error when using Entitymanagerfactory, is a web project with Hibernate + JPA This is the mistake: java.lang.Classnotfoundexception: javax.persistence.Persistence at…
-
0
votes1
answer26
viewsSpring boot, using H2 bank for testing
I use postgresql, but for the tests I want to use the H2 database, how do I make spring recognize the H2 database for the tests? Create another application.properties by passing the H2 data? ***I’m…
-
0
votes1
answer589
viewsRequest without @Xmlrootelement
I’m doing a simple user registration with Java and Angularjs. My javascript request looks like this: $http({ url: "rest/user/register", method: "POST", data: $scope.newUser }); In java, I have a…
-
0
votes0
answers13
viewsRedirect to page . jsp via a commandLink tag
I’m having a hard time linking a jsp. Use little JSF and would like to know which command can be inserted inside the tag commandLink to make a redirect process. Example: <h:commandLink…
-
0
votes0
answers12
viewsHow to set a Jtable with salaries from a table in the database that contains only payments
I am developing a system that manages customer payment and salary records. In the system database has the payments table, where is made the insert of customer payments. I need to make a salary…
-
0
votes1
answer76
viewsQuery with Java 8 parameter to generate random numbers using Collectors.toList()
I have this method to generate random numbers in a ArrayList; public static List<Integer> gerarAleatorio() { List<Integer> aleatorios = new ArrayList<>(); while(aleatorios.size()…
-
0
votes0
answers172
viewsSingle Page Filter Exception
I have a filter @Webfilter("/*") that blocks everything, however, I would like you to have some exception pages... A page (or one I chose) is not blocked Has as? @WebFilter(urlPatterns =…
-
0
votes1
answer390
viewsDynamic query using JPQL
I need to implement a dynamic query logic, in BD using JPQL, and I have 4 filters: 1 - PROJECT COORDINATOR 2 - SERVICE PROVIDER 3 - PROJECT START DATE 4 - FINAL DATE OF THE PROJECT Any of the fields…
-
0
votes0
answers8
viewsProblem in PDF Creation using Htmlconverter
When I create a pdf document from an html, there is a problem regarding accented characters and italic "Ç". When I open the document, strange characters appear instead of the original ones. How to…
javaasked 3 years, 1 month ago Nichollas Emanuel 1 -
0
votes0
answers9
viewsRelationships UML diagram
Guys, I’d like some help understanding a situation. I need to do a dev course work. And I was in doubt about a class relationship. In the Image, we have the car class and the person class.…
-
0
votes1
answer97
viewsProblem performing a Java INSERT language
Hello community people, I’m with a problem that I think should be very easy but as I am beginner to me is not rs, I have a Insert to realize that stays in a class called ClienteDAO follows code…
-
0
votes1
answer271
viewsImage upload and update
I have a javaEE application where one of the requirements is to upload an image used for the user profile. Everything you’re accomplishing so far: 1. Selects the image to be edited (Cut, Rotate,…
-
0
votes0
answers14
viewsDOCUMENT VERIFICATION ON ANOTHER WEBSITE
Hello! I would like to do an integration to check a CNPJ. On my site, the user would have to put their CPNJ, UF, entity name, city and purpose. And, for confirmation purposes, I would have to do a…