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
votes0
answers1284
viewsHow do I import third-party libraries for an Eclipse project?
I’m trying to use two third-party libraries for a Java project in Eclipse: iText (to generate a PDF) and Javamail (to send this PDF by email), but I’m not able to or import them... I’ve tried…
-
1
votes1
answer1306
viewsHow do I generate random numbers between 5 and 30 in Java?
I need to use the Random method and store it in a distance variable, then show the distance from city A to city B, and from city A to city D, that is, a different random number for each distance…
-
1
votes1
answer2246
viewsIs there a way to change a default program by java, cmd or regedit?
I am developing a java system, but from it I should change the default program to open . pdf in the switch. In Windows 10 it opens by default in Edge, but from the system it should change to Adobe.…
-
1
votes2
answers509
viewsHow to view object information from my Arraylist?
I want to create a ArrayList to store information about students (name, number and status) but I’m not getting Arraylistadicione the information. The code I have is this:: Java class. package turma;…
-
1
votes1
answer283
viewsHow can I take a specific item from a listview and place it in another Activity?
I am creating an app for students at my school, where students will log in with their enrollment, the subjects will be placed in a listview and when the student clicks on an item from listview will…
-
1
votes0
answers702
viewsHow to write objects to a file and read these objects
I need to record the created objects in a TXT file and then read the recorded files and show the recorded objects. I searched in several places but I’m not able to solve my problem. I have a class…
-
1
votes0
answers88
viewsAJAX request returning error 415
I am new to WEB development and I have a small problem I created a Java Webservice with only one test method that sums two values received by request parameters. follow it: import…
-
1
votes1
answer1296
views -
1
votes1
answer920
viewsThymeleaf templates error in Heroku
I implemented my application on Heroku, just for testing... Locally everything works well, but in Heroku after I log in with the credentials I am directed to the page sac/index, what is right, but…
-
1
votes0
answers151
viewsHow to resolve Fat Jar Export: Could not find class-path entry
I’m having serious problems exporting a program made in Eclipse and I’m starting to hate myself for trying to be organized. I imported two third-party libraries (Javamail and iText 5) into my…
-
1
votes1
answer306
viewsUsing Progressidialog when Logging in
I am trying to insert a Progressdialog in the login screen of my Android APP. In parts it is working, only when the login is successfully done, but when something is wrong as password for example,…
-
1
votes1
answer1217
viewsinsert data from an array into the database - java
I am creating a system that at a certain point should create an order and this request has several items that I put inside an arrayList. I have an order table in the database, in which way I will…
-
1
votes0
answers668
viewsPOI: Read from specific line and send to BD
Hello. I am working on a TCC in JAVA and one of its functions will be reading EXCEL files and sending the data to the Database. I’m starting little by little in JAVA and some things still confuse a…
javaasked 7 years, 4 months ago Wilian Silva 15 -
1
votes3
answers992
viewsError "Binary XML file line #22: Error inflating class Fragment"
I believe the error occurs due to lack of memory. I get the following exception. When I enter the application and minimize the same, then I enter several applications minimizing the ones that were…
-
1
votes1
answer205
viewsConvert string to Static?
It is possible to be converting string to Static ? String prefix = getConfig().getString("prefix"); String sufix = getConfig().getString("sufix"); Cannot make a Static Reference to the non-static…
javaasked 7 years, 4 months ago Natanael Nicolas 53 -
1
votes2
answers5200
viewsNosuchelementexception error when capturing data input with Scanner
I’m having problems with data inputs using Scanner with Joptionpane works well. Exception in thread "main" java.util.NoSuchElementException at java.util.Scanner.throwFor(Unknown Source) at…
-
1
votes1
answer53
viewsHow can I separate items from a sharedPreferences into an Array?
I have a question, I made a checkbox on items in a listview that when marked are stored as Sharedpreferences. So I created a button (Favorites) to access the items marked by the checkbox, but the…
-
1
votes1
answer59
viewsThe app crashes every time I click the calculate button
It is an application to calculate IMC, save the data and display them in another interface. However, when I click the button to perform the calculation and display, the program crasha. Other classes…
-
1
votes1
answer201
viewsAnnotation or method to ignore field (Xstream 1.3.1)
I have a Circularreferenceexception problem when I try to do this: XStream xstream = new XStream(new JettisonMappedXmlDriver()); xstream.setMode(XStream.NO_REFERENCES); xstream.alias("resultList",…
-
1
votes1
answer83
viewsProblem with using Java lists
I have a file loaded with 300,000 prices. I need to put prices in ascending order in a list. If I put it in standard mode, analyzing in a linear way where to insert each price, my algorithm is very…
-
1
votes0
answers51
viewsMenu/submenu using get
I have a submenu menu very similar to the image. I also have a database storing categories/subcategories. I’d like to make a Get at the bank, so it would appear on my menu. Code I’m using : private…
-
1
votes1
answer160
viewsPass Firebaserecycleradapter values
How do I pass an object by clicking on a Recycler view item while using a FirebaseRecyclerAdapter? The way I’m doing it is working, I create a list, and in the method populateViewHolder i add the…
-
1
votes1
answer171
viewsTable names in Hibernate are created with lower case letters
I am trying to turn the following Entity into a table in Postgre using Hibernate @Entity @Table(name="Usuarios") public class Usuario implements Serializable { ... } the problem is that when the…
-
1
votes2
answers255
viewsError while receiving Firebase data
I’m having problems with my TCC, I’m not getting the data from Firebase and display them in a listview, it presents error, I’m using the ValueEventListener to try to get the data... to listview this…
-
1
votes0
answers196
viewsJava swing - exercise
I’m having doubts about Container, I’d like to know if the form I’ve made is correct. public class Exercicio2 { public static void main(String[] args) { JLabel lblTitulo = new JLabel(); JLabel…
-
1
votes1
answer548
viewsReading File in Java
I’m trying to read a file (arquivo.txt) which is in the same folder as my class, but I run the code an error appears that did not find the file. Could someone check what’s wrong? I thank you in…
-
1
votes2
answers8760
viewsHow to create a list with some attributes in java?
I’m having trouble creating a list where I can enter different values. I use the following codes: public class avaliacaoMensal { private String questao; private char potencial; private int…
javaasked 7 years, 4 months ago Lucas Charles 127 -
1
votes2
answers1511
viewsReading data from a Java file
Good evening, I have a text file like the image I need to read this file and take the data and store it in an object array. For example, I have a ROOM object, this object has the following…
-
1
votes1
answer84
viewsQuestion about filling arrays and functions inside arrays
insira o código aquiArrayList<Player> players = new ArrayList<Player>(); for(contador=0;contador<x;contador++){ Player p1 = new Player(); p1.setId(contador); p1.setSaldo(valorinteger…
-
1
votes2
answers86
viewsWhat is wrong with this method?
I’m doing a method of adding Users, and just one thing isn’t working, the function that: "Adding friends with the same mobile number will not be allowed." Ai need to check the users already added,…
-
1
votes1
answer145
viewsHow to fix the buttons in Alertdialog?
I’m having a problem with the buttons created in Alertdialog. I am making a phrase APP and at certain times the sentences are very large and causes the buttons in Alertdialog to drop. Is it possible…
-
1
votes2
answers1709
viewsWrite and print data in an Arraylist
I am doing a college job and I need to save in an arrayList the name and age of 10 people and then print the data of the person who is at position 7, but when I print returns null. I do not know if…
-
1
votes2
answers203
viewsExit warning on Webview
I’m very beginner on android, so I made my application by Android Studio using Webview, but I’m having a question, when I press the back button of Android it already leaves the app, I would like to…
-
1
votes1
answer487
viewsInsert a submenu into a Jmenu
When I click on the woman or man icon on JFrame, is called a JPanel where I enter the data such as weight and height. But by clicking save, I cannot call another JPanel to show the result of the…
-
1
votes1
answer576
viewsBack to Webview
I have an application with webview and I wish that when I click the back button of the mobile phone it goes back to previous page, I do not know how I do, someone helps me? Below follows my code.…
-
1
votes1
answer271
viewsJSF problem in Logoff method
Good night I have the following problem, I have a JSF application and I need to do a logoff command, I did several and all gave the same result, it "kills" the user’s session (logs in), but does not…
-
1
votes3
answers1055
viewsJava error - Square root calculation
I was doing some basic exercises in Java and one of them asked: In this example, we will use the method sqrt class Math to extract the square root of the number that is typed in a text box, a 'Text…
-
1
votes1
answer41
viewsWhy some actions give error if I do not specify the View as parameter in Android?
I’m creating a test app with the basic knowledge I acquired on android since I was a java programmer before. All the tutorials I researched people put the class View as a standard parameter in your…
-
1
votes1
answer609
viewsWorking with Hexadecimal in Java
I saw an example of code on the Java documentation site on bit that can be checked here. This class belongs to the example cited in link above: class BitDemo { public static void main(String[] args)…
java characteristic-language operators int hexadecimalasked 7 years, 4 months ago Pena Pintada 4,678 -
1
votes1
answer3314
viewsclassnotfoundexception error
Good afternoon, which means the mistake to follow? Class not found stancedriver.StanceDriver java.lang.ClassNotFoundException: stancedriver.StanceDriver at java.net.URLClassLoader.findClass(Unknown…
-
1
votes0
answers117
viewsComparison Methodthe Comparable interface allows encapsulation breaking?
The Student class has its private attributes and to access or modify them it is necessary to use the get and set methods. In addition, the Student class implements the Comparable interface. class…
-
1
votes0
answers79
viewsHow to start an array in another class - java
I’m trying to implement the Depth first algorithm to solve a maze, like the one below, where the starting position is S and the output is E _SW______\n _WWW_W_WW\n _____W__E\n In the Mazereader…
-
1
votes2
answers325
viewsHow to verify which result will appear more often in a chronological sum of an established sequence?
I have this sequence of numbers: 7, 14, 21, 28, 35, 42, 49, may have more or less numbers. I need to add them all up as follows: 7+7=14 14+7=21 21+7=28 28+7=35 35+7=42 42+7=49 49+7=56 That was 7,…
javaasked 7 years, 4 months ago Felipe Cortez 21 -
1
votes1
answer1041
viewsMaven Project Relative Path error
I have to maintain a system in java with Maven. However the system has 3 projects where one refers to the other, I tried to change the build path adding projects and etc. So far nothing below…
-
1
votes1
answer116
viewsProblems with Alert Dialog
I have a problem capturing a text input in a dialog box on Androidstudio. I want to receive the quantity of a product and add in a ArrayList, but the function does not wait for the insertion in…
-
1
votes0
answers80
viewsDisplay database image in datatable
I saved an image in the database and want to display in dataTable PS: I know that it is not good practice to store image within the database, this practice was done for study purposes. <h:form…
-
1
votes1
answer115
viewsGenerate grid with random characters - java
I intend to create a grid that is filled randomly or with "W" or "_" and I did the following: public class Gerador_grelha { public static void main(String[] args) { int row = 5; int col = 5;…
-
1
votes1
answer52
viewsAdapt user input to array size
I created a program that generates mazes that can be solved, but now I’m not able to implement a way for the size of the generated maze to be defined by the user. The code below is ActionListener of…
-
1
votes2
answers703
viewspass several parameters in the ireport
I have the following problem: I created in java a selectcheckbox, where the person will select multiple objects; when sending to the managed bean, I can receive these listed objects. I now want to…
-
1
votes0
answers1438
viewsjava.sql.Sqlexception: ORA-01000: maximum open cursors exceeded
I’m making the following mistake: java.sql.Sqlexception: ORA-01000: maximum open cursors exceeded From what I researched, the error happens when the maximum number of cursors is exceeded, and to…