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
answer331
viewsTake last table value from bank and show in Jtextfield
I have a program here at the factory that, every 1 minute, an equipment connected to a supervisory launches a direct value in a table in the database (SQL Server). I wonder how do I always take the…
-
0
votes1
answer622
viewsHow to change the width and height of a Relativelayout by Java code
I want to know how I adjust the width and height values of each relative layout, independently of my XML through the respective Java class. I already know how to adjust the width, height and other…
-
0
votes0
answers246
viewsSmile detection using opencv on android
Hello, I’m having difficulties to detect smiles using opencv on android. I can make the detection of faces and eyes very well using Aar Cascade but only the detection of smiles is not working using…
-
0
votes2
answers841
viewsRetrieve and calculate programmatically generated Edittext values
I am creating an app pqra calculate an arithmetic mean of N values. There is a button add, when clicked it will generate a EditText programmatically. And it will have a calculate button, when it is…
-
0
votes0
answers252
viewsHow to send data from an Activity to a Fragment
I’m trying to send my data from Activity CorridaEsteiraActivity to the Fragment FragmentCorrida and save them in a listview, however I did not succeed in my attempts, below follows the two classes:…
-
0
votes1
answer271
viewsHow can I show a value in a jTextField when selecting a Jcheckbox at runtime?
private void btCalcularActionPerformed(java.awt.event.ActionEvent evt) { double salario = 0, irrf = 0, inss = 0, valorTotal = 0; FolhaPagamento pagamento = new…
-
0
votes2
answers541
viewsProblem in recovering data from firebase
I recently started working with Firebase and am still learning what can be done by reading the available documentation. But one problem I’m having is recovering the data within a function. The…
-
0
votes1
answer228
viewsCDI is not working with Tomcat7 by Maven + JSF
I’m not able to make CDI work, I’m using the tomcat7 plugin from Maven. Beans.xml is created and in the WEB-INF folder, context.xml is also in the META-INF folder, I also put the CDI dependencies,…
-
0
votes1
answer39
viewsSpecific entry of information
The goal is to make the program accept only numbers in the method numero() (cannot accept if it is letter, point, question mark, etc). Already in the method usuario(), letter only (cannot accept…
javaasked 6 years, 11 months ago Guilherme Passos 21 -
0
votes1
answer57
viewsHow to select memory file?
I am trying to make a video player, but not using "raw" or the internet, I need to get the file from the mobile memory, be it internal memory or sd card memory, I have tried through the path…
-
0
votes0
answers76
viewsHow to convert `data java.util.Date` to `java.sql.Date`?
The idea is to consult the data by dates in the database (Mysql): I have 2 fields JXDatePicker and I want the return of the data between the initial date and the final date. In Mysql, the field date…
-
0
votes1
answer43
viewsTransactions between several classes
Good, I’m relatively new to Java programming! The following is a Super Class named User of which there are 2 subclasses Citizen and Autarchy, within the Citizen class I have created an Arraylist…
-
0
votes3
answers75
viewsWhy in the second example (unlike the first) the result is concatenated and not summed?
example 1 final double BEGIN = 10.20, KM = 1.30, BAG = 2; Scanner s = new Scanner (System.in); double clientKm, clientBags; System.out.println("How many km?:"); clientKm = s.nextDouble();…
javaasked 6 years, 11 months ago Richard Kulikowsky 13 -
0
votes1
answer67
viewsERROR: this - cannot be Applied to
error appears in the part of the code where I have "this" private void sendEmail() { //Getting content for email String email = editTextEmail.getText().toString().trim(); String subject =…
-
0
votes1
answer86
viewsHow to display html content in a datatable
I have the message field in an Editor that after inclusion is shown in a datatable. <rich:editor value="#{solicitacaoImpressaoBean.solicitacao.mensagem}" toolbar="full" style="margin-bottom:…
-
0
votes1
answer314
viewsJava. how to display a string array from a menu option?
I created 3 vectors, one for name, and the others for day and month of birth. I fill the 3 through the first menu option I made with the switch case, the second option would be to display only the…
-
0
votes0
answers177
viewsSelect only a few columns from Hibernate-mapped objects
How can I select only a few fields of a related object ? How it works (taking everything): List<Participante> participantes = this.entityManager.createQuery("SELECT a " + " FROM Participante a…
-
0
votes0
answers397
viewsJava user authentication using Mysql database and Framework spring boot
good afternoon. I am in the development of a web application using the framework spring boot, Ibernate and jpa with the mysql database. Finally I have a question about the authentication of this…
javaasked 6 years, 11 months ago WeltonSistemas 75 -
0
votes1
answer580
viewsAccess a directory through a jar
I created a code that uses a file that is located in a given directory (Resources). When I run this code by eclipse, this directory is found and all code actions are done. However, when generating a…
-
0
votes1
answer225
viewsCalling foreach jstl DAO methods
I’m starting my jsp studies and came across the following situation: I want to use jstl foreach c:foreach and I want to use a list that is returned by my DAO method. <body> <jsp:useBean…
-
0
votes1
answer68
viewstype Enum field can be used for comparison?
I own an enum field: public enum StatusImpressaoEnum { PREVISAO(0 ,"Previsão"), EMELABORACAO(1, "Em Elaboração"), AGUARDANDOREPASSE(2, "Aguardando Repasse"), REPASSERECEBIDO(3, "Repasse Recebido"),…
-
0
votes0
answers155
viewsHow to implement the HTTP protocol DELETE method in a Java Web Service REST
I am wondering how I could implement the DELETE method of the HTTP web service REST JAVA protocol, when I run it says that I am running the GET and not DELETE method. //Method called in Web Service…
-
0
votes2
answers676
viewsHow to convert from hexadecimal to Base64?
I’m getting a hexadecimal image from the database and have to convert it to base 64, only I don’t know how to do that. I am currently setting it as string and returning to json: Model private String…
-
0
votes1
answer56
viewsDúvidas Abstract Factory
I have this exercise to do but I’m not able to do the implementation Using the Abstract Factory Standard, deploy Java clients from Process Manager and Memory Manager products to Linux, Mac, and…
-
0
votes1
answer360
viewsHow to show the connected user’s Firebase ID on the screen?
I need to take getUid from the connected user and set the id in an editText. I left it down just to show what I want to do, because that way it doesn’t work. How can I call a getUid connected to any…
-
0
votes1
answer245
viewsCheck the Boolean return of php function in java
I am developing a java application that requires a furlough to be activated. I’ve done the php function that checks the data in the database and returns a true if everything is right, or false if it…
-
0
votes2
answers418
viewsError . class expected
The program is supposed to ask for a number between 1 and 12. (I haven’t gotten to the part of certifying that it’s between 1 and 12 but this is the easiest.However I’m supposed to write the code…
-
0
votes1
answer52
viewsHow do I show the book with the most pages?
I’ve tried a lot of stuff and it’s just this Option case 4 which is to show the book with the most amount of pages that is missing. If you have someone to help me in this option I thank you because…
javaasked 6 years, 11 months ago user95454 -
0
votes0
answers131
viewsSave a frequency table to a file. (Huffman compactor)
Hello, I’m developing a work of Huffman’s algorithm, and I’m having some difficulty working with the frequency table. In short, I need to turn the characters of a text into a frequency table to…
-
0
votes0
answers19
viewsMake Global selection in the App
I wanted to know how to make the selection of the global year in the application and work with the data only with the selected year. Do I have to make Managedbean Applicationscope? How do I navigate…
-
0
votes1
answer30
viewsSlow vraptor application after upgrading java and Tomcat
I am working on a legacy application and the application to the natural is already a little slow, I believe that by the way it was developed, but after updating the version of java 7 to java 8 and…
-
0
votes0
answers30
viewsShow Result of an onResultScan in a Recycleview
I’m riding a APP for the course, it’s about Wi-Fi, precise list the search for Wi-Fi available and put on Recycleview, in the example I’ll show him listing in a Listview, and in the Recycleview I…
-
0
votes1
answer119
viewsDoubt about Filter - JSP
well I’m learning JSP and I’m trying to make a filter where the user is not logged in it redirects to a login page, and I’m not getting it. NOTE: I created a controller Servlet that makes Dispacher…
-
0
votes1
answer50
viewsError Returning Query Using Like
I am trying to make a jpql query with like using JPA. However, it is not working. User class repository public class UsuarioRepository extends RepositorioGenerico<Integer, Usuario> { public…
-
0
votes0
answers22
viewsFormatting date to save
Hello, I need to convert a date that is in String to save to a variable data_inicio of the kind Date in Mysql and I did it as follows: String data = "14/11/2017"; SimpleDateFormat formataData = new…
-
0
votes1
answer153
viewsIf the user accesses the home before logging in he must be redirected to the index using jsp
What verification should I do if the user directly accesses the home.jsp page without logging in? Noting that I am not using Servlet for this situation, only jsp pages. Code from home.jsp page:…
-
0
votes1
answer518
viewsError: java.lang.Nullpointerexception in project using JDBC
Could help me with the error below, it is a, I have error in lines 14 of the class Testalista and error in line 32 of the class ContatoDao. Exception in thread "main" java.lang.NullPointerException…
-
0
votes0
answers730
viewsChat between two different computers
I’m new to this socket thing and I’m having trouble connecting two computers that are on the same network. When I run the client and the server on the same machine, it works... but when I do it on…
-
0
votes1
answer1146
viewsProblems trying to change a nav_header_main.xml text view
I am working for the first time with Navigation Drawer Activity, and would like to change (by java) the text that appears in the nav_header_main.xml menu In red is the text I want to change. Below…
-
0
votes1
answer549
viewsSSLC0008E: Unable to initialize SSL Connection Websphere 8 error
I’m with the following error when I was climbing an application using WAS 8.0 and Eclipse Mars, I searched a lot of things on the internet, but I couldn’t find anything that would help, I even tried…
-
0
votes1
answer693
viewsDatabase Test with Spring Boot
I’m having an error, when running my application with profile test, Spring Boot does not create the same database in the local profile. Any suggestions? Follow my application-local file.properties:…
-
0
votes0
answers793
viewsError: Could not find or load main class Mainex1"
Previously questioned question that gave basis to this error The error in question is the use of a JAVA program using the Linux Terminal. I already have the compiled classes, the error appears when…
-
0
votes1
answer42
viewsAndroid Webservice Error while using Android 4.2
Hello ,I am developing a project where I need to pick up and send values to a server. I did everything and worked perfectly in the version 7.0 of android, but when going to 4.2,begins to give error.…
-
0
votes0
answers210
viewsFunction fecth: The CORS header 'Access-Control-Allow-Origin' is not present
I am trying to simulate an application I am running on a local Glassfish server. The IDE I am using is: Intellij. I built a method that consumes an API service from an address:…
-
0
votes0
answers57
viewsJsonobject does not add Arraylist
I use the code below to popular my arrays quietly, but when researching a topic here, I realized that for my problem I could use a generic class. The problem is that Jsonobject is not populating…
-
0
votes0
answers434
viewsMorse to Portuguese translator and vice versa
Hi I’m trying to make a translator from Morse to PT and vice versa. I want the program to know if the first character of my input is - or . It automatically assumes that I want to translate from…
-
0
votes0
answers85
viewsSocket connections
I’m trying to do a project where I transfer a file. I’m having trouble accepting the client’s connection. As I am trying to do in different packages the Talya class starts the server connection on…
-
0
votes0
answers47
viewsI want to get the same ID
Good afternoon I wanted to know if it is possible to get the phone ID for the same functions or as in the example below. I want to put the ID that’s marked black under the "SMS". Is it possible to…
-
0
votes1
answer134
viewseclipse - java - errors
someone can help me find the error of this code package trab; import java.util.Arrays; import java.util.Calendar; import java.util.Scanner; import java.util.TimeZone; public class tra { public…
-
0
votes1
answer73
viewsList 2 Tables in One Oriented Object
I’m doing some academic work. and I’m not listing the BD data, that is giving the error java.lang.Nullpointerexception I searched something similar found , I saw some examples however the way they…