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
answer143
viewsAndroid & Firebase Async tasks
I have a class Java that I overwrote the method toString() within this method before returning I consult firebase and fill an object. My problem is the following return of toString() ends up being…
-
0
votes0
answers134
viewsHow do I use Fileprovider and Bitmap together?
I’m having trouble sending a photo to the server, specifically in the excerpt: "bitmap.compress(Bitmap.CompressFormat.JPEG, 100, stream);". Always when taking the photo it shows error in this line.…
-
0
votes1
answer695
viewsHow to get more accuracy in GPS using google Location on android
In my project, I need to get a current user location and address and constantly update my position because of greater accuracy. The problem is that when I got the location (Latitude and Longitude),…
-
0
votes1
answer174
viewsProblem with Spring Security configuration
Guys I’m having trouble in the following scenario: I have two projects, where one is the Resource project and the other project is the authentication server, both projects were built with spring…
-
0
votes1
answer2589
viewsCreating the JPA/Hibernate "persistence.xml" file
I wonder if there is a way to setup the creation(s) of the persistence.xml at the time of project creation. Example of the aqruivo: <!-- propriedades do hibernate --> <property…
-
0
votes1
answer1207
views(Android Studio) Odd or even
I’m a beginner in Android Studio and I need to make an app that gets a number in Edittext and then tell me if it is even or odd, follow my current code : I don’t know what and where to put to when…
-
0
votes1
answer538
viewsView Java Database Values
I’m a beginner in Java and I’m making a mini RPG-style program for Database Testing, and I want to display the data contained in the BD using a ArrayList, but the result of the exhibition is always…
-
0
votes1
answer159
views(Android Studio) Problems with Onrestart eating the main interface
Instead of the app showing the interface below, it pulls the Onrestart method directly and displays "Program restarted" when I open the app. How do I fix it ? Code : TextView tInforme; EditText…
-
0
votes0
answers40
viewsComponent Poll does not call the method
I’m wanting to call a method periodically but the listner of poll does not call the desired method. Below my codes: <p:poll interval="10"…
-
0
votes1
answer56
viewsSpinner returning Null and Void
My spinner is returning null, probably at the time of passing to the string there is something wrong and there is an error in these lines :…
-
0
votes1
answer1053
viewsWhat are/do these dependencies?
I started working with programming about three weeks ago, they gave me the code and I’m lost. Until yesterday I only knew how to leave the Eclipse terminal, and now I have all these libraries (I…
-
0
votes1
answer131
viewsReturn Spinner Value For String
I need to return the value of a spinner , to make a post , but the spinner is returning null ! catliv = (Spinner) findViewById(R.id.catergorialiv); List<String> list = new…
-
0
votes1
answer513
viewsProblem trying to request HTTP in Java
I have a problem and would like you to help me solve it. I created a java application to consume a webservice that I made in php. After a lot of searching I managed to create a class capable of…
-
0
votes1
answer277
viewsEclipse Debug - Classes with equal names in different projects
I was debugging here and I came across a curious situation. I already fucked, but I could not succeed in discovering the problem. On a project, I have the class EntidadeDAO in the project1. In…
-
0
votes0
answers86
viewsUltialize same component in Jtabbedpane
Before describing the problem itself, let me explain what I’m trying to do. I will need to use some buttons that will do basically the same thing, only the actions they will apply change from a tab…
-
0
votes2
answers207
viewsLogin comparing user input to encrypted data in Mysql
I’m having trouble finding a way to compare the data entered by the user in a jPasswordField on the Login screen and compare with the encrypted password in AES and saved in the Mysql database. Can…
-
0
votes1
answer70
viewsArraylist does not display correctly
I have a super class Person with 2 sub classes (Student and Teacher). However I made another class "List" to create Arraylist and later handle everything. When using the List the data is accepted…
-
0
votes1
answer1002
viewsUnable to start Activity Componentinfo{}: java.lang.Nullpointerexception
I’m having difficulty finding the solution to this problem, in the code I want to go from Activity "Mainactivity" to "Plantalist", but when testing the application in the virtual machine the app…
-
0
votes1
answer421
viewsWrite a file with the contents of an array
I have an array of char grid and I want to write a file with its contents. Here’s the code I made: public static String getGrid() { String text = String.valueOf(grid); return text; } public static…
-
0
votes1
answer77
viewsJava - Error: Cannot find Symbol after Try...catch (fileContent[0])
public class ShowDoMilhao { //constructor of the class public ShowDoMilhao() { } public static void main(String[] args) throws IOException { //string to hold name of txt file String file1 =…
javaasked 7 years, 3 months ago AndreSerafim 13 -
0
votes0
answers223
viewsPhilosophers' Dinner using Arrayblockingqueue
I have to solve the problem under the Philosophers' Dinner using synchronized; monitor (Condition, Lock); and creating a Semaphore class with ArrayBlockingQueue. The first two I managed to make, now…
javaasked 7 years, 3 months ago Savannah Ribeiro 1 -
0
votes1
answer34
viewsProblem opening a new Activity
I’m having trouble trying to change Activity, Just not opening my new Activity. public void Add(View v){ try { FormularioActivity.choise = 0; startActivity(new Intent(RolavelMainActivity.this,…
-
0
votes2
answers245
viewsError using a Static final String to build an SQL query
Good evening person, I’ve been searching around and I know that you can do CRUD organized... I know that the programmer creates a class with the strings, leaving for example public static final…
-
0
votes1
answer294
viewsJSP with Servlet
I’m trying to get Servlet to work as a controller I was following the booklet from Caelum but I can’t find the error the jsp to Servlet @WebServlet(urlPatterns = "/LoginInfo") public class LoginInfo…
-
0
votes0
answers92
viewsNetbeans with copyfile error
I am working on my tcc which is a website for my campus more specifically the fleet control of the same. So what happens is that I work on my campus and at home I just copy the projector from the…
javaasked 7 years, 3 months ago Murilo Antonio 1 -
0
votes1
answer234
viewsApply component focus
I have a component that is a JPanel containing two JTextFields, wanted to be able to apply borders and funds only for the JTextFields, without applying on the panel. I treat everything on the main…
-
0
votes1
answer46
views -
0
votes0
answers79
viewsHow to update object using Entity manager?
to create I used: public void adiciona(Produto produto) { em.getTransaction().begin(); em.persist(produto); em.getTransaction().commit(); } to remove I used: public void remove(Produto produto) {…
-
0
votes2
answers3232
viewsClient-server connection via socket
I need to make a connection via socket as follows: My Android app has a "Confirm" button - when you click the button it has to send a message to the server and after that the server has to return a…
-
0
votes1
answer184
viewsHow to pass the received data from an activity and put it into a recyclerview
Hello, I’m beginner in java programming and I’m having trouble passing some serialized information from an activity to a recyclerview. When the second activity is started it brings no information.…
-
0
votes1
answer939
viewsOpen Jinternalframe from another
I was learning to play with JDesktopPane in order to use in future projects because I find this function very interesting. I tried to call a JInternalFrame from one button inside another…
-
0
votes1
answer68
viewsProblems with the instantiation of the chronometer
Good afternoon guys, in my application I am creating a "simple" chronometer but I’m having trouble running application. I created a class that contains two methods one of start and the other of…
-
0
votes1
answer45
viewsApplication giving Crash on a button inside a custom Alertdialog
I am working with Alert Dialogs and I appeared an error where the application stops responding. The following code refers to a fragment where you are using the Google Maps API, and means that when I…
java android android-fragment listener alertdialogasked 7 years, 3 months ago Guilherme Vinicius 55 -
0
votes1
answer33
viewsError while editing through SQLITE
I’m trying to edit information that’s saved in the SQLITE gang. I’m working with fragments. But I’m making the following mistake: FATAL EXCEPTION: main Process:…
-
0
votes0
answers113
viewsHibernate: query performance drop after a few repetitions
I am developing a Farm Management system. One of the basic queries is to list the animals by type that are alive (inFarm = true). Below is the method that executes this query. public List<T>…
-
0
votes1
answer48
viewsExchange of information with Fragments
I have a CRUD to add users but I’m having trouble implementing the edit. User clicking edit wanted edittext to be loaded already filled. For that, I tried to implement something like: ImageView…
-
0
votes1
answer547
viewsScreen login SQLITE
I am trying to perform the verification of user existence and login when performing the access in the system. I’m using the following codes: public int login(String username,String password) {…
-
0
votes3
answers126
viewsDoubt in CRUD, I’m having trouble reading the keyboard data
I’m a beginner in Java. I am creating a CRUD from a library, but I have one question: when I create and install a new library in the main, how do I read the author’s data typed by the keyboard?…
javaasked 7 years, 3 months ago italo vinicius 59 -
0
votes0
answers62
viewsHow do I resolve the Arrayindexofbox exception in this program?
package projecto_algoritmia; import java.util.Scanner; import java.io.File; import java.io.FileReader; import java.io.FileNotFoundException; /** * * @author Jeje */ public class Projecto_Algoritmia…
-
0
votes1
answer56
viewsexception of reflect.Invocationtargetexception
hello, I’m trying to make an application that runs a song endlessly, but when the user clicks a button the music stops , that is my code public void tocar() { relogio = new Timeline(new…
-
0
votes1
answer54
viewsDoubt - Hashmap
I need to go through a list of hotel reservations and, for each such reservation, capture the Event that is associated with it. At the end of the process I need to say how many hotel reservations…
-
0
votes1
answer537
viewsRecycleradapter with different layouts
I would like to know how to use a different layout with the scheme below, If I am in Activity A showing Layout 1, if I am in Activity B show Layout 2, I saw that it is done with viewType , but I…
-
0
votes1
answer448
viewsHow to initialize a blank Jpanel?
I’m starting to work with the package swing and manipulation of events and I came up with an idea to test some program that would create rectangles of random sizes and colors. Code creation and…
-
0
votes1
answer62
viewsfindViewById returns null
I am receiving null from my findViewById call, and I cannot understand why. The code below relates to a Activity in my program: @Override protected void onCreate(Bundle savedInstanceState) {…
-
0
votes1
answer412
viewsRetrieve past information in a Bundle
I have a Fragment that calls another Fragment by passing login information to the other. I do this with the following code through the Bundle. Follow the code : ImageView editarBt = (ImageView)…
-
0
votes1
answer50
viewsDoubt - Hashmap & List
My need was as follows: A report that would bring the Event and the number of hotel reservations that was associated with that Event. And so it followed as the code below shows:…
-
0
votes1
answer658
viewsHow to order Jpanel in different positions?
Which Layout manager should I use to position the panels as in the illustrative image below. Edit: I have the Painelx Class, which I am in JFrame as position SOUTH, within that class I have 2 panels…
-
0
votes1
answer133
viewsList in Android Studio
I have a listview that brings data when I add it to mine ArrayAdapter. For example: adaptador.add("algum dado"). But I wanted this listview to bring data from a register of products, such as the…
-
0
votes0
answers66
viewsHelp with search screen
The query that mounts the screen is as follows : public List<Produto> listarProdutosDoGerenteRegional() { try { return manager.createQuery(" select p from Produto p where…
-
0
votes1
answer540
viewsMobile Player Problem - webview app
I created an app on webView and its player only works when we press the play button 3 times ( one to play the video, then pause and then press again it plays the video ) the app link to demonstrate…