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
answer27
viewsDo not compile non-static variable and package does not exist
Can help me please, I’m studying Java and I’m having the following mistakes: Main.java:12: error: non-static variable carro1 cannot be referenced from a static context carro1 = new…
javaasked 6 years ago Bruno Souza 3 -
0
votes1
answer25
viewsMy case 3 does not delete from the list and case 4 does not compare and returns the amount of gender written
I register some books, after that I try to delete some with my case 3, but typing case 2 to show all it continues showing the book that should have been deleted. My case 4 should compare the typed…
-
0
votes1
answer92
viewsMake ul move using script only
Hello! I saw an example of carousel that use the feature of margin to simulate the movement of items. How can I just with the script, do something similar, considering that the code repeats the…
-
0
votes2
answers370
viewsRun select from the java DAO class
I’m having trouble using a select of a dao class in a main class. You can help me. Follows code. package Model; public class MTotalProduto { private String codigoBarra; private double totalProduto;…
-
0
votes1
answer71
viewsI am unable to list the data in the Mysql database using Hibernate JPA
**Classe: Estado** package entidade; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; @Entity public…
-
0
votes0
answers29
viewsWhy is the data blank when changing a data in phpMyAdmin using Hibernate JPA? I am using Nextline
package loja; import javax.persistence.EntityManagerFactory; import javax.persistence.Persistence; public class Loja { **Conexão: Loja** private static EntityManagerFactory loja; public static…
-
0
votes1
answer44
viewsI cannot delete data from an entity
I have a method that deletes a company entity and its attachments, after the archiving of a protocol, however, when I try to delete, this happens: Caused by: java.sql.BatchUpdateException: Entrada…
-
0
votes1
answer89
viewsHow to mount a Json with Jackson having the model classes?
I have the following classes: public class OnesignalRequestModel { private String app_id; private List<IDModelJson> include_player_ids; private ContentJsonModel content; public String…
-
0
votes0
answers56
viewsProblem with java.lang.Nullpointerexception android.graphics.Bitmap.compress
Hello I’m having this error in my code someone could help me solve this? grateful in advance. java.lang.NullPointerException: Attempt to invoke virtual method 'boolean…
-
0
votes1
answer735
viewsHow to map a table without ID, using Hibernate annnotaions?
Hello, good morning, sir. Having a table that relates USER and ACHIEVEMENTS called USER_ACHIEVEMENTS, where it does not have ID, only USER_ID and ACHIEVEMENTS_ID, ie a manyToMany relationship. How…
-
0
votes0
answers32
viewsThere is a way to save an Araaylist<Food> in the MYSQL database
Here’s my situation: I’m putting together an app that indicates meals . So I have a table called food, which has as fields: idAlimento, name, measure For example: 1 , rice, 100 grams 2, feijao, 50…
-
0
votes2
answers33
viewsRoutine doesn’t work
I have a loop for the user to enter the student’s name and age. but when compiling, the first part of asking the student’s name is passing by and already falls asking the student’s age. follows the…
-
0
votes1
answer1461
viewsHow to resolve 'Error: Javafx Runtime components not found' java 11 ( linux )
I downloaded the Javafx Sdk for Java Platform 11 and I’m trying to open my FXML, but when I try to run my program it gives the following error: static String uId; public static void main(String[]…
-
0
votes1
answer265
viewsJava - How to access a String vector of a Class in another Class?
Hello, I have a class called File.java, in which I read a txt file and put the phrases contained in this file in an Arraylist, which can be viewed in the code below: public void leitor() throws…
-
0
votes1
answer404
viewsHow to cast in Java?
This model is working, look at the figure! You may notice that you are concatenating two String variables as you can see in the figure below; My problem now is to be able to concatenate an Integer…
-
0
votes1
answer73
viewsHow to create parallelism in a specific multithreading?
My scenario is this:: Simulate a water tank associated with two taps: one used to fill the tank and another used to empty the tank. Rules: a) The total capacity of the tank is 2000 liters and each…
-
0
votes2
answers154
viewsValue selected by selectOneMenu comes null
I have a selectOneMenu that contains a list of document types, which I associate to the documents being attached in a p:fileUpload, however, the value selected by selectOneMenu comes null View of…
-
0
votes1
answer86
viewsDatabase Query with an Array in Hibernate
I have a method that takes as parameter an array of values(id) and I need to do a query in the database to return only the rows of a column with these values(id) I have this method: public…
-
0
votes2
answers703
viewsProblem comparing Strings in Java during the while loop
I’m with this college activity and I’m having trouble closing the loop of my while, because even after informing that the name of the city is Zimbabwe Mines he considers as different and continue…
-
0
votes1
answer219
viewsOpen fragment by clicking on Cardview
My home screen has 3 cardviews: main.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"…
-
0
votes1
answer177
viewsPost only the Manytomany relationship
I have the school entities and teacher. I mapped the Manytomany relationship. I have no idea how to save only the list by passing an array of ids. Teacher class @Id Long id; // não importa os demais…
-
0
votes1
answer86
viewsError using <f:Event>
I’m struggling with something that seems simple to solve, but I’ve already wasted considerable time on it, and I hope someone can help me.. , good. , in my View I use to call a method before…
-
0
votes5
answers153
viewsCall the Java method
I’m doing some POO exercises and I can’t call the method ligar of my code. public class Telefone { public String modelo; public int numeros; public boolean antena; void status(){…
-
0
votes0
answers27
viewsView Qrcode on screen in web application
I have this code that generates the Qrcode of the Zxing library: private static byte[] getQRCodeImage(String text, int width, int height) throws WriterException, IOException { QRCodeWriter…
javaasked 5 years, 12 months ago Alex Passos 51 -
0
votes1
answer430
viewsHow to manipulate buttons at runtime on android
I’m creating an app for a restaurant, where I can already list orders and create the interface, example: coca-cola - 0 + I use a for to go through one List, which generates the list of products. MY…
-
0
votes1
answer67
viewsI cannot show all lexical analyzer results
My teacher passed a paper on compilers. He wants me to do a Lexical Parser. I managed to do a good part of the code, but I can’t show the result. I’m a beginner in Java and I’m using Eclipse. The…
-
0
votes1
answer182
viewsWebdriver Chrome Selenium
I have the following code: System.setProperty("webdriver.chrome.driver", "C:\\libjava\\chromedriver2.exe"); ChromeOptions options = new ChromeOptions(); options.addArguments("--headless"); WebDriver…
-
0
votes1
answer31
viewsPassing map to method
I am a beginner in Java and I have done some little projects as tests. In this case, I’ve been reading and found interesting the map, but, I was upset when it came to applying. I thought it would be…
-
0
votes1
answer75
viewsUsing Struts 2 with Maven, Eclipse and Tomcat
I downloaded the Apache provided examples of Struts 2 projects into their repository here. I tried to run the example helloworld. If I run through Jetty for Maven with mvn jetty:run, the project…
-
0
votes1
answer81
viewsError trying to change Javafx application icon
Hello. I am developing an application in Javafx and I am trying to change the icon of my application according to the code below: public class Login extends Application { Image applicationIcon = new…
-
0
votes1
answer23
viewsI’m having trouble displaying my JSF project view -
no error appears and the screen is blank. I believe that it should not be anything very complex to solve but I am new in this language and I’m having difficulty to understand the syntax. In the view…
-
0
votes1
answer52
viewsErrors when entering data into table
This is a simple exercise to store 5 information in the bank: nomeCliente, nomeProduto, pesoProduto (informed by the client), valorProduto (standard value of 1.20) and valorFinal (final result of…
-
0
votes1
answer73
viewsLoad Json data via Ajax
Guys, how do I load the json data into a table in html? The table is mounted, the script I’m pretty sure is right, to print the data in the table, but I think there’s something missing, sap, maybe a…
-
0
votes0
answers46
views(hibernate) Tables are created, but data is not inserted
I am trying to create and insert data into a table through Hibernate, but when I run the code no data is inserted. I have a medical class that inherits from the Employee class. Staff Class: import…
-
0
votes1
answer30
viewsPass parameter in onItemClick
I’m having difficulty passing the parameter inside the repetition for in Android Studio. It lists the data coming from mysql, but I can’t pass the parameter to access the item. for (int i=0;…
java android android-studio android-activity android-adapterasked 5 years, 11 months ago Alexandre Gomes 45 -
0
votes0
answers147
viewsconcurrent transactions spring boot + Docker
I have an app on Docker with Jhipster(Spring Boot + Angular) where Gero protocols for service. I’m using the @Transactional in the class of generating the protocols for control in the generation of…
-
0
votes0
answers44
viewsCreate Form / HTML Screen with Database Coordinate
Good evening, My Doubt is the following, has a system where all the rule of business and the system itself is in database (SQL) including the screen, reports, etc, but it has a client to access,…
-
0
votes1
answer27
viewsTyping error when receiving foreign key from the database
Good evening, basically this is a list I did to show the data that were entered in the database, but I have been finding typing problems on lines 1 and 2 (marked as comment), as predicted, the…
-
0
votes2
answers666
viewsSimple Java chained list position change
I have to create a method that changes position two elements into a simple chained list, but I’m having difficulties in creating this method. In this case the method receives two elements of the…
-
0
votes1
answer187
viewsProblems with the method . getDownloadUrl( );
I’m having trouble updating the method. getDownloadUrl( ); from firebase, I’m trying to save an image in Storege and lego after taking the url and saving it as a path in Database. private void…
-
0
votes0
answers91
viewsError calling android studio java method
I’m having the error of: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.Resources android.content.Context.getResources()' on a null object reference when…
-
0
votes2
answers162
viewsFailure in dependency injection
I’m having a problem in a JSF test, basically I have the entity, the service and the view, I couldn’t find anything that would help me solve. In view, I want to call my service by Managedproperty…
-
0
votes1
answer195
viewsSpring jsp Failed to Convert value of type 'java.lang.String' to required type 'int'
Hello guys I have the following error when I try to delete something from my table WARNING: Failed to bind request element:…
-
0
votes0
answers38
viewscreate Selector with doGet mode
Can you help me do this exercise? I need to create a way doGet and then create another file to be the output of my Save the problem and I have no idea how I do this junction between the two...…
-
0
votes1
answer869
viewsHow to get back to the start menu of my program
Guys, here’s the thing... I am doing a project for the POO chair and wanted every time I chose some option and completed the form that is within the classes, I returned to the main menu, until I…
-
0
votes1
answer164
viewsJavafx textfield settext does not work
I have a registration screen, using FXML, and want to reuse this screen for the change button. But when I do: txtNome.setText("ola"); System.out.println(txtNome.getText()); Opens the registration…
-
0
votes1
answer46
viewsType and search in Combobox
I wonder if there is a way and how to do: type and appear the names in a Combobox, is already listing the database data in the combobox, but I would like to type the initial of the name and go…
-
0
votes2
answers305
viewsProblem with writing in hidden textbox with Selenium
I’m trying to write in a textbox and click on a button (these elements are initially hidden in the page) using Selenium (with Java), but I can’t find the element, I’ve tried searching for name, ID,…
-
0
votes1
answer57
viewsParser XML Webservice in Java
I am having problems with XML return from a webservice when trying to parse. Netbeans output complains this way: [Fatal Error] :1:13: White space is required between the destination of the…
-
0
votes2
answers436
viewsAdvancing Dates with Local Date
I’m trying to make the date the user enters in the constructor advanced in 1 day. However I am not getting the expected result, is being returned the same day. I tried to check by debug and simply…