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
votes1
answer123
viewsLog4j with multiple Jvms
Context In the project I am (production environment) has a server that is installed with 4 java applications, being: 1 application deployed Jetty 1 application in Tomcat 2 jar generated with Spring…
-
1
votes2
answers532
viewsButton to display and/or hide keyboard
A EditText numeric will receive input by external keyboard, so display the default keyboard, should be optional. How do I make to: By clicking on EditText to position the cursor, the keyboard does…
-
1
votes1
answer914
viewsProblem calling class inside Switch
I’m developing a facul project that’s a basic clinical system. After the user logs in, they choose an option in the menu where the responsible class will be called. The problem that when I choose…
-
1
votes0
answers38
viewsConfirm email signup in an automated SNS topic
I use the SNS service in an application, the following process is done: User informs their location, and if there is no city inserted in the bank is created a record in the table regarding the city…
-
1
votes1
answer1943
viewsHow to print a table-shaped array in nodejs on the console?
How do I get the same output from this matrix, written in Java, on Nodejs? public class Matriz { public static void main(String[] args) { int[][] m = new int[4][4]; for (int i = 0; i < m.length ;…
-
1
votes1
answer790
viewsRun function with ENTER in Edittext
I need to execute a function with the keyboard "Enter" on EditText. Did not work: android:maxLines="1": he jumps fields android:imeOptions="actionNext": it runs with the "next" button of the virtual…
-
1
votes1
answer215
viewsProject error: JSF does not respond or display Message
I’m on a JSF study project from the book Java For Web. It was going well, but I put the following code in JSF which, according to updates, should not work because the library…
-
1
votes0
answers58
viewsSpring security
I would like to know how to configure the spring security so it can have two authentication profiles. When configuring in my application the same when uploading the application generates the…
-
1
votes1
answer429
viewsInject CDI is not working with producer on a project . jar
I created an Entitymanager producer in a project .jar but the same does not work. I configured POM.XML with the dependency below <!-- CDI --> <dependency>…
-
1
votes2
answers364
viewsDatatable of the first faces does not update selection variable
Based on the first example of the site Datatable Selection where a variable(linhaSelec) receives the value selected by clicking on a <p:commandButton/> I decided to mount my implementation but…
-
1
votes0
answers47
viewsTLS 1.2 in Spring Java
Does anyone know how to configure for the Java application to use TLS 1.2 ? This configuration is done in the Java application or on the server ? I’m wearing Spring 3.1 Thank you…
-
1
votes1
answer112
viewsReplace in empty line
I have a variable with the following content: 10 20 30 40 50 60 70 80 90 100 There are spaces (can be 2 or more in a row) and line breaks (also several in the sequence), and I want to replace to…
-
1
votes1
answer823
viewsWildfly 10 + Spring Security + JSF + CDI Does Not Inject Dependency
I’m trying to implement CDI in a WEB project I have where I use Wildfly10 with Spring Security (custom login) and JSF and I’m not being able to inject dependencies. In the Example below the User…
-
1
votes1
answer86
viewsEntitylisteners @Transactional Demoiselle - Id null
I’m setting up audit on a project with JSF + Hibernate + Demoiselle. Item class: @Entity @Cacheable(true) @Table(name = "itens") @EntityListeners(value = PersistenceAuditor.class) @XmlRootElement…
-
1
votes1
answer470
viewsJasper does not open outside the IDE
Within the Netbeans IDE the code works and the report is presented. But when generating the executable, it is not possible to open the report, receiving the null message. It’s like he can’t trace…
-
1
votes2
answers97
viewsString to int conversion
my xml ` <android.support.design.widget.AppBarLayout android:id="@+id/appBarLayout" android:layout_width="match_parent" android:layout_height="wrap_content"…
-
1
votes1
answer321
viewsAndroid - Is it possible to play videos on a Webview?
I am developing a browser for android with java. It works fully through webviews. But the app is not able to play videos via stream... I wonder if it is possible to do it. Thank you. Webview in xml:…
-
1
votes1
answer87
viewsHow to declare list in class?
I have a class Usuario you will have a list of the class Pastas, and this class will have a list of the class Questão. public class Usuario{ String nome; ArrayList< Pasta > listaPasta; } My…
-
1
votes1
answer163
views -
1
votes0
answers84
viewsKnow the duration of an MP3 song with native java classes?
Is there any way to know unique attributes of an mp3 file with native Java classes? Just need the duration of the song in case.
-
1
votes0
answers124
viewsJava Session, Jsessionid changes
I have a web page that requests a Servlet via Ajax. In Servlet I create a Session to keep the employee authenticated and to identify him within the system. However, when I leave the system, I put…
-
1
votes1
answer55
viewsAdd Class Size to Product
I need to do something that when you register a product, make a pizza equal in size and each size in price. So I created a size class. public class Tamanho implements Serializable { @Id…
javaasked 8 years, 5 months ago Bruno Nicoletti 81 -
1
votes1
answer39
viewsExceptions and database connection
I have a code that query a database. If a timeout exception occurs for example during the execution of the query, the connection closure code and consequent return of the connection to the pool will…
-
1
votes1
answer89
viewsHow to view Tomcat log on screen
I am creating a functionality using jsf with primefaces, to display the application log (Tomcat), on the screen (view xhtml), but I have not found any plugin or append to do this, and before…
-
1
votes1
answer74
viewsValidate a Matcher
Good afternoon. I would like to know how to check whether the matcher found something. Because I am searching for information inside a PDF file and when it does not find anything I would like to…
-
1
votes1
answer620
viewsHow to make a greedy algorithm to solve the java backpack problem
Remembering that I am not able to calculate to solve this problem
-
1
votes2
answers108
viewsEclipse error installed on Deepin linux
My eclipse is showing an error on the console screen, despite running blz the program. I am using Deepin linux 15.5 and Eclipse Oxygen.3a Release (4.7.3a). The mistake:…
javaasked 6 years, 6 months ago MoraisWancley 11 -
1
votes2
answers123
viewsAndorid - Open Activity only once
How do I have an Activity open only the first time the app starts?
-
1
votes1
answer11
viewsHow to use the AS operator with the Library Room?
I’m not getting the variable total, how do I do? @Query("SELECT SUM(item_valor) AS total FROM Itens WHERE total =>:data") Itens getMes(String data); The IDE warns syntax error in the full…
-
1
votes1
answer122
viewsSimpleformatdata returning null HH:mm:ss
I need to take only the time informed by the user, but the method I did returns null when I try to change the format to HH:mm:ss public static Date formataData(String data) throws Exception { if…
-
1
votes1
answer658
viewsTCP/IP communication using Socket
I need to do a college job where it is necessary to do a TCP/IP communication something like a "chat chat" is what I have in mind to do. But some questions arose, I don’t know exactly how to ask…
-
1
votes2
answers64
viewsAndroid - Open Random Activity
Well, my question is this: is it possible to make a function call a Random Activity?
-
1
votes1
answer87
viewsFill in a jCombobox using Join and Hibernate
I’m doing a job at college where I’m supposed to create a scheduling system for car dealerships. The technologies used are Java, Swing, and Hibernate. I divided the project in layers to facilitate,…
-
1
votes1
answer1300
viewsCustom Json Spring Receipt
Hey, guys. All right? Currently in my system I am mapping the objects in a Spring standard way, but I would like to do a custom mapping: Current controller @RequestMapping(value = "", method =…
-
1
votes1
answer63
viewsAndroid - Share Preferences for another device
My question is the following: it is possible to share information saved by Sharedprefences to another device, either by bluetooth or another connection ? Mainactivity.java: SharedPreferences.EDITOR…
-
1
votes2
answers71
viewsString search in file . log in Java
I need to create a program where I can search a file . log and can find certain strings in it, for example: Network path not found. Among others that would represent errors in this log file, they…
javaasked 6 years, 6 months ago Matheus Henrique 39 -
1
votes0
answers198
viewsI can’t upload images to Chrome - Play! Framework
Hello, I’m using Play! Framework and I’m having a problem trying to upload images, especially in Google Chrome: [error] play - Exception caught in RequestBodyHandler…
-
1
votes2
answers362
viewsIs it possible to store user inputs by the Scanner Class in a database?
I have an application made in Java, and I need to store the user’s registration information in the database: Cpf, password, name, address, telephone System.out.println("Digite seu CPF"); cpf =…
-
1
votes2
answers1127
viewsValidation Login and Password Primeface and JSF
I have a very simple system of Registration and Login, I made a validation in both fields. I want to adapt this validation to something more specific like: Login does not exist Password invalidates…
-
1
votes1
answer1315
viewsHow to make a Jframe return an instance of a given object?
I have a JFrame called Jframecadastre person which has only two fields name and surname, as shown in the image : Jframecadastre person: public class JFrameCadastroPessoa extends javax.swing.JFrame {…
-
1
votes1
answer227
viewsHow to implement Abstract Data Type?
Good evening, I need to do a point TAD implementation, I’m managing to do in Python, but the problem is that it should be implemented in Java and I have no idea how to start. import math class…
-
1
votes0
answers274
viewsDifference between method and function?
Because in Java it’s called method and in Kotlin it’s called function, it’s just a different nomenclature, or is there a significant difference? Java: public class Teste { public static void…
-
1
votes0
answers374
viewsCalculation of derivatives in Java
Hello, good day. I am here asking for a light for a problem that I have, my teacher of programming asked us to make a code that calculates the derivative of a function in java, but I am without a…
-
1
votes1
answer261
viewsHow to return the second lowest java value?
How to return the second smallest value given a series (of indefinite size) of numbers in java? I have the code that returns the smallest value, which looked like this: import java.util.Scanner;…
javaasked 6 years, 6 months ago Andrade Lucas 19 -
1
votes2
answers256
viewsWhat tools should I use to create an android app
I’m starting in mobile development that will be done in Java or Kotlin and my question is what tools I can use both in the design part and in the database which are the main technologies ?
-
1
votes2
answers224
viewsHow to recover a previous value typed by the user?
I am not able to recover a value typed before by the user. The program asks to enter with notes and the end to be indicated by the entry of the number -1; public static void main(String[] args) {…
javaasked 8 years, 5 months ago Matheus Guedes 13 -
1
votes1
answer81
viewsCalendar variable updates the other when the second is updated?
Hello, I’ve been messing with the Gregoriancalendar class and I’ve come across the following problem: You had to go from one point in the calendar to the other, then set the first point as the…
-
1
votes3
answers450
viewsAccess modifier protected
A common class (which is not subclass) and has no inheritance, can use an attribute protected of a superclass that has a subclass? If so, this attribute will be visible (no need to use the…
-
1
votes1
answer431
viewsJPA / Hibernate - Lazyloading Onetomany duplicating records
Well, I have the following structure: public class FinCxaTransacaoGrupo { @Id @GeneratedValue(generator="gen-uuid") @GenericGenerator(name="gen-uuid", strategy = "uuid2") @Type(type="pg-uuid")…
-
1
votes1
answer483
viewsSpring/Jackson Json - Problem in deserialize
This question is a continuation of another question, a user answered found the solution to my other question (Custom Json Spring Receipt), but I’m now having trouble mapping using Jackson. I want to…