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
-
5
votes2
answers960
viewsHow to make a Scheduledexecutorservice launch a new task while the previous one has not yet finished?
I am implementing a Scheduler to run some threads on my system at x time intervals. The big problem is that if thread 1 has not yet finished running, 2 does not start, even though its time has come.…
-
5
votes1
answer950
viewsHow to put a <div> inside an iframe?
So, I’m trying to get only one part of my HTML page updated, every "X" time. I was trying to accomplish this through AJAX, but it was giving many problems. So I decided to change the plan. This is…
-
5
votes2
answers239
viewsGET request is not answered correctly by backend
The project is an Angular 6 front-end, which connects to a Java back-end for communication with a SQL Server BD. The server that receives the file .war, containing both the back and the front, is…
-
5
votes2
answers190
viewsRestart the layout
I made two buttons that set Adapter in recyclerview, each arrow button a different layout, but only doing so findViewById(R.id.layout2).setOnClickListener(new View.OnClickListener() { @Override…
-
5
votes2
answers1055
viewsIf, Elseif and Else with Java 8
I would like to build a method using Java 8, replacing the conditional IF, ELSE-IF and ELSE. For this, I built a sequence of code, I do not know if it is ideal and would like to hear better opinions…
-
5
votes1
answer44
viewsConfiguration of the Hibernate!
Hello I’m having a difficulty regarding a Hibernate configuration hibernate.hbm2ddl.import_files i believe q am doing everything right to find the sql path, I am using the same to insert some data…
-
5
votes3
answers232
viewsHow to overlay a superclass method using a polymorphic parameter?
I have an abstract superclass Service with an abstract method onExecute(ServiceData data) that is superimposed in the subclass EchoService. However, in this overlaid method, I need the parameter to…
-
5
votes1
answer496
viewsDisable Flyway migrate on startup and run only when requested
I’m just getting started with the Flyway in the Java along with the Spring Boot and I currently have an activity that tells me to do the Flyway execute the migrate() only when a certain endpoint is…
-
5
votes1
answer221
viewsWhen is the standard model request/Answer required in the context of a REST application?
If possible, let’s imagine a context where Spring Boot and JPA are used. During the construction of some REST API, I always wonder if I should perform the standard model request/Response. For…
-
5
votes1
answer621
viewsPrime Numbers in JAVA
I’m doing a job in Java, where the user must enter numbers smaller than 20, and then this program must tell which numbers are prime. I don’t know if my logic is right, but on the console nothing…
javaasked 5 years, 2 months ago ayanami001 53 -
5
votes2
answers219
viewsRegex to search for word inside tag with CDATA
I have a file that contains the following string possibilities: 1st Case: <text><![CDATA[Casa]]></text> 2nd Case: <text><![CDATA[Qualquer texto que tenha Casa no…
-
5
votes1
answer187
viewsCreate more specific or more generic custom exceptions?
Taking into account that in a project is used the practice of creating custom exceptions, which makes more sense? I mean, make an exception for every possible error predicted in the code by…
-
5
votes2
answers1699
viewsHow to compare each character of a Java String?
I’m creating a Java application where I travel through one String with a bow for and I need to check every character of that String. Example: for (int i = 0; i < texto.length(); i++) { char…
-
5
votes1
answer42
viewsIn Java Swing, should I extend Jpanel and top-level containers like Jframe?
Has in the Soen but I was not satisfied with the answers, and temporarily I am not able to ask IF.. Top-level containers like the JFrame I guess there’s no need, but a JPanel kind of made to be an…
-
5
votes2
answers213
viewsLike "clone" an Inputstream?
Often I need to read a InputStream more than once. For example, to pass on the content of stream for multiple methods. void readStream(InputStream input) throws Exception { var result1 =…
-
5
votes1
answer73
viewsHow to format a string to add spaces to the right in a printed table?
I am trying to print a table in Java using the method System.out.format, where the exit should be this way: (Dados apenas de exemplo. Não são reais.) SBGR -> BCO | 9,0 m | 5,0 NM | 1400 Ft/m |…
-
4
votes2
answers323
viewsHow to disable JVM domain name resolution (hostnames)?
An application is trying to access a remote EJB. Regardless of whether the configuration uses the address servidor.empresa.com.br or an IP to access the service, an error occurs:…
-
4
votes2
answers379
viewsTomcat only reads Log4j.properties when restarted
Until recently I made file changes log4j.properties (ex: change the level of the Testemb class) and simply redeploy the application. Now, the changes only take effect when I restart Tomcat. I wonder…
-
4
votes2
answers1204
viewsFixed column of a Jtable in a Jscrollpane
How do I leave a fixed Jtable column (no scroll) inside a Jscrollpane? I want to leave the first column of a fixed table, the scroll bar will only scroll from the second column onwards, the first…
-
4
votes5
answers6040
viewsWhat tool to use to convert a visually developed UML to code?
I need an Eclipse tool/plugin that allows me to develop diagrams of classes, activities and sequence in UML and that manages the code. I usually use Eclipse with Omondo plugin, but it seems to be…
-
4
votes2
answers1164
viewsHow to identify if an XML is GOOD?
I have the following problem regarding XML encoding: Erro: Byte inválido 2 da sequência UTF-8 do byte 3. This error occurs when trying to canonize an XML. I don’t know exactly what the error might…
-
4
votes2
answers606
viewsView Listview with available networks
I’m trying to popular a ListView with List returned by method getScanResults() class WifiManager. However, I would not like to have to go through this list, after all, all the information I need is…
-
4
votes1
answer3825
viewsHow to color specific lines of a Jtable?
I’m developing a Java application that involves a JTable, i need to paint some red lines depending on the age and status of that line. I’m wearing a DefaultTableModel to popular my table. I don’t…
-
4
votes2
answers4977
viewsUsing the JPA repository
Last Saturday I presented my TCC in college and saw that I need to improve the presented project. The system receives tax notes in format XML and manipulates them. I based the system on the company…
-
4
votes1
answer1385
viewsHow to change the value of a string in XML?
There is a way to change a string value in XML. I know how to get the value through getResource().getString(R.string.value); but I don’t know how to change the value directly in XML. Is this…
-
4
votes2
answers437
viewsWhen do I use Objectoutputstream the parent class attributes are also saved?
When I use the ObjectOutpuStream to write to file, parent class attributes will also be saved?…
-
4
votes1
answer832
viewsHow to implement a chart using amCharts?
I am trying to implement a bar/column chart using the tool own amCharts that uses XML, but I’m not able to edit it to get a specific bar. What would be the simplest solution for implementation using…
-
4
votes2
answers12377
viewsDecoder for Open Source CAPTCHA
I am looking for an API for decoding CAPTCHA, one that is free to use and open source. I understand that this is a complex process that uses OCR scans and advanced techniques of analysis and digital…
-
4
votes3
answers1015
viewsSend e-mail on behalf of the client
I have a system that serves several clients and sends emails to their users (clients of my clients). Today I use my own email account (from my domain), and in the composition of the email I inform…
-
4
votes3
answers1327
viewsPlace information in field fields of a URL and send to the server with a program language
You can, using a programming language, access a web page with login and password data, set the login and password information and "click" the send button, and can enter the site with your…
-
4
votes1
answer218
viewsHow to set position of a cursor in the Onchanged of a Customview in a Listview?
I’m wearing a customview calling for android-spinnerwheel. I inserted her into a listview connected to a CursorAdapter. If I use the OnitemClickListener from Listview, the cursor goes to the…
-
4
votes3
answers589
viewsIs there any way to run batch files during the build of a Maven project?
I have a. bat file that performs some prerequisites during the build of my Maven project. I want to run this file . bat automatically when I build the project I developed Is there any way to…
-
4
votes3
answers370
viewsHow to perform TDD using Hibernate
I would like to know how to perform TDD using Hibernate. I have been informed that this ORM stores memory before recording into possible, so I wanted to know how to test a data that is in memory.…
-
4
votes2
answers132
viewsHybrid Android Apps. Is the performance loss that big?
Someone there has developed hybrid apps for Android and can you tell me if the loss of performance is great? I have read in various articles on this web that there are problems such as delay in the…
-
4
votes3
answers271
viewsGet List Help (Code Refactoring)
I have a class with 2 attributes: public class Classe(){ private String conteudo; private String tipoConteudo; getters...setters.. } So I have a Arraylist with 3 or more objects of this class, as I…
-
4
votes1
answer2848
viewsHow to Convert UTF String to ANSI and Create ANSI Text File on an SSD?
I wrote an Android application using Java, so that users answer questions, which are then saved in a file. The problem is that this file is saved in UTF8. The end user will open this file on IBM…
java android character-encoding file-systemasked 10 years, 9 months ago Please_Dont_Bully_Me_SO_Lords 516 -
4
votes1
answer455
viewsHow to set time to silent mode
I have a school schedule app and put the option to mute the device during the time stipulated by the user. However there is only the option to enable and disable silent mode, as I can do this…
-
4
votes1
answer435
viewsUsing BASE64 in Java
Problem: I can’t import the classes BASE64Decoder and BASE64Encoder, there are N code that use them and when I use them everything that is related does not work precisely because they are not found.…
-
4
votes1
answer985
viewsDynamically add layouts
I created an XML with Linearlayout, in it I have a Spinner and an Edittext. On my screen I have a Linearlayout that should receive this other layout I created. My question is: how to add this custom…
-
4
votes1
answer967
viewsWebrtc Javascript with Java/PHP server
Someone ai has some example or documentation, of how to create a Webrtc client (browser), using a Java or PHP server to make the "Handshake" between both? I cannot use Node.js, and the documentation…
-
4
votes2
answers6870
viewsJboss - "Unable to get Managed Connection for java:/Appds"
The following exceptions are occurring in my application: 10:52:34,506 ERROR [br.com.app.dao.NotificacaoDAO] (http--0.0.0.0-8080-77) java.sql.SQLException: javax.resource.ResourceException:…
-
4
votes2
answers939
viewsHow is the java project separation?
Well, I come from . net and there we have projects that we can divide them into class library and web project I have my design just for my models Another only utils project and my web only project…
-
4
votes2
answers4107
viewsHow do I pass parameters from the last Fragment to the previous Fragment?
I have the following situation: the Fragment A and from it, with a button click event, goes to the Fragment B. When you’re in the Fragment B and press the back button in order to return to the…
-
4
votes1
answer1994
viewsGrouping in the Ireport
I am developing an application in Java where I extract PDF and EXCEL reports, using Jasper with Ireport(3.7.2).One of these reports needs to have data grouped by a certain element. I did some…
-
4
votes2
answers2530
viewsMaven - Configuring the Mainclass
Problem: When I create a JAR for eclipse it works smoothly, but I’m trying to enjoy the JAR that the Maven is creating and I realized that it does not perform, because my class main is not in the…
-
4
votes1
answer1449
viewsError inserting into Hibernate database
How do I insert the Product object into the database that is composed of an Ingredient object that already exists in the database, without duplicating the Ingredient object in the database. If I…
-
4
votes2
answers117
viewsDoubt object orientation + java ORM
I am wanting to store the data of my program via ORM and am separating cute each object. My User object, for example, has its basic attributes and is also composed of other objects such as Address,…
-
4
votes1
answer2089
viewsEdge effect of a Jbutton component
How do I create a smooth transition(Fade Effect) from the edge of a Jbutton by hovering the mouse? My code is like this: @Override public void mouseEntered(MouseEvent e) { Object temp =…
-
4
votes2
answers2008
viewsHow to pre-process a text for the application in the Weka classification algorithms in Java?
I am doing my TCC where the idea, roughly, part of the collection of tweets and a training of an algorithm machine Learning to classify this data. How I would pre-process this tweet, and the idea…
-
4
votes2
answers621
viewsHow do I access the indexes of a vector returned by a java method?
I have a method called vetorVoos which returns a vector of the type NodeVoo and I want to access the indexes of this vector through the method in another class. This is the method: public NodeVoo[]…