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
votes0
answers26
viewsError compareTo Key
Save people, I have the following problem, I am implementing a code that returns me the median of a sequence, using max-heap and min-heap. Even before completing the code the compiler returned me an…
-
0
votes2
answers638
viewsWhile inside other While in Java
I am trying to do a while inside another while and after executing the code within the second while I ask if you want to continue or not, if yes, the program should loop from the first while. It…
-
0
votes1
answer47
viewsFATAL EXCEPTION main when using service on android
Good night ! I’m trying to generate a service that can identify when the screen of the mobile phone is erased or access, so I followed some tips to get to this point that is a simple test code, but…
java android broadcastreceiver android-serviceasked 6 years, 6 months ago Eduardo Rafael Moraes 710 -
0
votes1
answer20
viewsDexarchivebuilderexception with Guava 21.0
I just received an Exception when I went to update the versions of the frameworks and run an application that was long stalled. My dependencies are these: dependencies { compile fileTree(dir:…
-
0
votes1
answer146
viewsMount recursive function for Treetable
I’m trying to build a tree of folders and questions with Java, Jsf and Primefaces. I have two lists, one is the one that saves the folders and subfolders, and another list is the one that assembles…
-
0
votes1
answer296
views403: Access is denied / Spring security
I’m working with Spring Secutiry. When I add this line below, I get 403 status when I try to access the url. @EnableWebSecurity @EnableGlobalMethodSecurity(prePostEnabled = true) public class…
-
0
votes1
answer75
viewsUpdate values in a matrix keeping elements already modified earlier
I’m creating a game board, using a 2d array array. During the game players hit or miss and this has to be printed on the board. I would like to know how I can update the matrix without losing and…
-
0
votes1
answer495
viewsHow to generate a dynamic link within a condition in Thymeleaf?
I would like to know how I can generate a link within a condition in Thymeleaf. In my situation, if the condition is not satisfied, I wanted to create a link that would direct to a new form, in…
-
0
votes0
answers68
viewsDoubt about Insert, Query, Class BD
good night. I am developing a college job, which asked me to create a Student class, implement a graphical interface, with name, address, course options, list of choice and etc, and I made button to…
-
0
votes1
answer132
viewsPreorder Iterative - Binary Search Tree
I have a function that runs through BST (Binary search Tree) recursive pre-order. The function is the following: public Iterable<Key> preOrder() { Queue<Key> queue = new…
-
0
votes1
answer88
viewsError 415 - Upload files
pom.xml <dependency> <groupId>commons-fileupload</groupId> <artifactId>commons-fileupload</artifactId> <version>1.3.3</version> </dependency> Angular,…
-
0
votes1
answer303
views -
0
votes2
answers65
viewsNullpointerexception error on execution
Hello. Once again I’m having Nullpointerexception error. I can’t identify why. The activity is as follows : Create a Java app to control the weekly menu of Nutrition Clinic patients. You should…
-
0
votes1
answer107
viewsError trying to access JAVA WEB database
When I run the program the following error: HTTP Status 500 error - Internal Server Error. java.lang.Runtimeexception: java.sql.Sqlexception: No suitable driver found for…
-
0
votes0
answers198
viewsSpring Boot query does not return records
I am developing a system with Java 8 and Spring Boot with JDBC accessing an Oracle base. When I do a query, using Namedparameterjdbctemplate, it does not return any record, but if I copy this same…
-
0
votes1
answer787
viewsHow to create and authenticate email and password in firebase?
I’m taking a class and I try to register the email and password, from this code, in firebase, but it is not created. I can’t get this authentication. The database I created to test if I was able to…
-
0
votes0
answers275
viewsHow to save checkbox on sqlite using recyclerView - android
So I have a project that has a checkbox list that when clicked would record in a column in the bank that items were marked, so far so good. Only I did not take into account the size of the list and…
-
0
votes1
answer83
viewsHow can I do this more intelligently and without conflict?
In this way, it is returning some errors and it seems that it may present conflicts in the cases of 2-character operators. Example: "++" being replaced by "#++#" while the next replaceAll() it will…
-
0
votes0
answers48
viewsSymbol > appears at the end of XML
I have an XML document that serves for a program in Java save some values that will be read by another in C#. It’s not the best way to exchange values between languages (that’s what happened, but I…
-
0
votes1
answer928
viewsListener refused the Connection with the following error: ORA-1251 JAVA ORACLE
Hello, I’m having an error when I try to connect to an oracle bank. someone I was able to help. code private static Connection ObterConexao() { Connection conexao = null; try {…
-
0
votes1
answer1911
viewsInsert Json within Json
In a client-server structure (in JAVA), I have the following Json structures separately (example): Structure of Students: {"idAluno":1,"nomeAluno":"Teste da Silva","listaDeTurmas":[1,2]} Structure…
-
0
votes1
answer167
viewsHow to use the Javascript pdf.js library in Selenium with Java via the Javascriptexecutor clase
I found this library that does exactly what I need, extract the text from the PDF and turn into a String. http://git.macropus.org/2011/11/pdftotext/example/…
-
0
votes0
answers45
viewsSelect from 2 Java tables
Hello guys I am having problems to bring data from 2 different tables of HSQLDB database my DAO class this so: @Override public List<Animal> listar() throws Exception { List<Animal>…
-
0
votes1
answer82
viewsKotlin + RX Observer without Anonymous
I’m studying Kotlin Android and RX and I only see examples like : val api = StarWarsService() api.loadMovies() .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe( {…
-
0
votes0
answers44
viewsMove Image to Jrdesignimage
I have a barcode image being generated by barbecue , this image is stored in an instance of Graphics2D. I wanted to know how I put this image in an instance of JRDesignImage for it to be compiled…
-
0
votes0
answers176
viewsDomain masking with Tomcat and Springboot
I’m developing a web application using Springboot, and other technologies. This application will be unique, that is, an application must serve multiple users (customers). Each user will have a page,…
-
0
votes1
answer90
viewsHow to list all Jsonarray data using JSF?
I’m having trouble listing all the data from JsonArray in a JSF, always remains only the last value, already when I use System.out.println(variavel) I can list everything without problems. Page JSF…
-
0
votes2
answers98
viewsReflect java caching, how to do?
If I can instantiate a new object with Reflection, how can I caching for the type it belongs to? newInstance() returns a type Object but I need the primary object, which I can get the guy by name.…
-
0
votes1
answer245
viewsBeanutils.copyProperties (Ignore more than one field)
all right? I am using java and spring-framework in a restful project, so I created the following class: Categoria (id, descrição, dtCadastro, dtAlteração) In class I am using the annotations…
-
0
votes1
answer543
viewsHow can I kill a Thread
I’d like to know how to kill a Thread. public class thread { private static void metodo(){ new Thread(){ @Override public void run(){ while(true){ System.out.println("Executando..."); try {…
-
0
votes1
answer37
viewsString replace is not performing swap
I am not able to alter the character of my string with that of the map value, if they are equal: key and character. import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; public…
-
0
votes2
answers47
viewsSocket does not receive or send message to the server
I am implementing a Java multi thread server that receives messages from clients and broadcasts them to others. But I’m having problems. The server only receives messages sent to users when the…
-
0
votes1
answer202
viewsProblem to list directories with java
I’m trying to list all the files in the C: directory on my PC. Smaller directories with 11 thousand files is picking up normally, it takes a while, but it’s no problem. The problem is when I will…
-
0
votes1
answer102
views(JAVA) Error in foreach
Why is there an error in executing the code below if I remove the break? The value of Arraylist clients is not updated every time it ends? for (Cliente cliente : clientes) { if…
-
0
votes1
answer68
viewsProblem with Accessdeniedexception
I am trying to go through all the files in the C: directory of my computer. Before I was using the IO library, but it was giving some problems and now I’m using the NIO, With the NIO is going well,…
-
0
votes1
answer462
viewsRetrofit: Could not locate Responsebody converter for
I’m working on a system and I need Retrofit2 (with Spring Boot) but I’m not getting. Follow the source and error. @JsonIgnoreProperties({"codibge", "codestado"}) public class CEP { private String…
-
0
votes1
answer217
viewsSpring boot error - Liquibase
18-04-15 23:10:21.452 INFO 9464 --- [ restartedMain] o.apache.Catalina.core.Standardservice : Stopping service [Tomcat] 2018-04-15 23:10:21.470 INFO 9464 --- [ restartedMain]…
-
0
votes0
answers201
viewsReport with parameter in Jaspersoft Studio
I have a java class in netbenas that was to generate a report, according to the Service Order (ID) entered by the user. But Netbeans returns an error "File or report not found". private void…
-
0
votes1
answer117
viewsHow to convert a Jsonarray to a Strings array?
String mensao = "[\"brega_falcao\",\"SamiPietikainen\",\"TecRahul\",\"gpantuza\",\"mkyong\",\"mkyong\",\"YouTube\"]"; Mensao is the Jsonarray I want to convert. I tried that but it didn’t work:…
-
0
votes1
answer384
viewsHow to interrupt a while loop
I’m developing a system with Jframe from a pharmacy. It’s a college issue. In the cashier operator comes in with the quantity X of product that the customer chooses from a list of n products and…
javaasked 6 years, 6 months ago Wesley Luiz 315 -
0
votes2
answers308
viewsIs it possible to filter a p:datatable when the filterBy attribute is a list of obejtos?
I’m using the P:datatable component of Primefaces and I’m having trouble with the filter. I have a list of Email Sectors and within that list I have another list with the aliases of each email.…
-
0
votes0
answers337
viewsDouble format with two house
I’m treating a file .csv with a id, value (1,214.45) and I need to format a final sum of these values with only two boxes after the comma. I developed the following code snippet: `DecimalFormat df =…
-
0
votes1
answer50
viewsIs it possible to simplify the Runnable command on an Android function?
I have created a class to facilitate the use of Dialogs, and I would like to know if it is possible to simplify further. My class is like this: public class FVRDialog { private Activity act; private…
-
0
votes1
answer337
viewsRecover user name and email in Navigationdrawer?
How do I recover the name and email of the logged-in user? I’m using Firebase BD. public class MenuActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener {…
-
0
votes2
answers127
viewsConvert class to generic
I need to convert the code class below into a generic implementation using a Arraylist. Can anyone suggest a better way to do this? Code: public class ArrayStack { private int maxsize; Retirar essas…
-
0
votes2
answers653
viewsHow the.setOnClickListener(view -> method() item works)
How does this item.setOnClickListener(view -> method());? I’ve never seen that kind of call, I saw it today and I was curious about that view, where does it come from? How does this type of call…
-
0
votes1
answer28
viewsEclipse has stopped claiming the need to declare the serial default Version ID. in the serialized classes
Hello, using Eclipse IDE when we create a class that we inform you should implement serialization (Serializable Implements) is common for the IDE to claim the default serial Version Id. I created a…
-
0
votes0
answers31
viewsDisplay the values of the android accelerometer in degrees
I am developing an android application that uses the ACCELEROMETER sensor. I need to measure the inclination in degrees. I was able to instantiate the sensor to measure it, display the X, Y and Z…
-
0
votes0
answers137
viewsHow to convert a JSON to a generic class
In a project with multiple client-server applications, I have a number of configuration files in JSON, which contain the connection port, host, etc. For each application, the information in JSON is…
-
0
votes2
answers100
viewsNetworkonmainthreadexception error while recovering local IP from device
String netAddress = "000.000.000.000"; try { netAddress = InetAddress.getLocalHost().getHostAddress(); } catch (Exception e1) { e1.printStackTrace(); } ipLocal.setText(netAddress); I am trying to…