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
-
2
votes1
answer62
viewsHow to know if a certain actor does not exist
I’m working with Akka/Java A reference to an actor who doesn’t exist, simply nay returns exception and/or do not know how to capture information that the actor does not exist in the actor system.…
-
2
votes2
answers145
viewsI used an array in a method parameter and do not know how to run
import javax.swing.JOptionPane; public class Cliente { private String nome; private String telefone; private int codigo; private String rua; void setRua(String z) { rua = z; } void…
-
2
votes1
answer4116
viewsHow to extract information from an HTML document with Jsoup?
I’ve been studying the Jsoup example for data extraction and extracted an example from this link Jsoup But I tried to manipulate the example to extract the data from a Div instead of a Meta…
-
2
votes1
answer91
viewsAvoid overlapping of Listview
I have a problem with ListViewI work with 2 ListViewAnd I want that when I click one, that the other disappears and that they don’t overlap as they have been. I just want when I click and open the…
-
2
votes1
answer877
viewsLeakage of connections with Hibernate
My system presented sporadic crashes and I ended up discovering that this happened due to processes that opened a connection but, due to some error, did not close it (Connection Leak). I solved…
-
2
votes1
answer62
viewsException in Java Uithreadingviolationexception
I did a project with the LookAndFeel Substance, in it I have a thread which periodically updates a JProgressBar, the problem is that in function JProgressBar.setValue(1) and…
-
2
votes0
answers571
viewsReply XML does not display accented characters
I am using Jersey in a WEB application. In this application, I return an XML file to client requests (which are web-browsers). In order to ensure accented character display, I wrote the Produces…
-
2
votes2
answers1212
viewsHow to make a Listview "Clickable"?
I have a simple phone book system where there’s Activitys to: Register; Edition of the register; Removal of the register; And one last to see all contacts within one ListView. All records come from…
-
2
votes1
answer860
viewsHow to use jQuery + Ajax with Java EE
I’m creating a connection to the Java database like this: try{ Class.forName("org.postgresql.Driver"); Connection con =…
-
2
votes2
answers5290
viewsHow to use onActivityResult when there is more than one startActivityForResult
I need to check user status yes or in the, when requesting bluetooth. Only I already use the same method for voice recognition. Just follow my code: package com.example.audio_auto; import…
-
2
votes1
answer77
viewsIf string starts with "www" automatically insert "https://"
Here’s what I’m trying to do So the user doesn’t need to type https:// I’m trying to make sure that when the text of EditText start with www. will automatically insert the https:// I tried to: if…
-
2
votes3
answers4417
viewsJava 8 (Stream) - Grouped sum
Good morning. I have the following function below: private List<Object[]> calcularTotal(List<Object[]> lista, int chave, int valor){ return lista.stream() .map(l -> new Object[]…
-
2
votes1
answer793
viewsAccess to Database using Java
How do I access a database (I’m using Postgresql) through Java? I’ve seen a way that uses objects like Connection and PreparedStatement. [link] Can someone explain to me about these objects or give…
-
2
votes1
answer562
viewsFacebook login on desktop applications
I wonder if there is a Facebook API for desktop applications, so I can integrate in it, login using facebook account etc. I registered and created my application on the site of facebook developers,…
-
2
votes1
answer503
viewsRemove selection color from Jtable’s line?
It may sound silly, but I can’t find the method to remove the color from the selection when the mouse clicks on the line. I have a table with red and blue lines, blue colors are lines that mean an…
-
2
votes1
answer524
viewsThe method that sends email works, but how to prevent the amount of incoming emails from becoming spam?
I have a method that sends emails in back Ground that works well, but I need to find a way that as the amount of incoming emails do not turn to spam. I’ve researched the JMS (Java Message Service)…
-
2
votes1
answer270
viewsHow to open another java program in java and get all the information it sends on the console
Well I was researching but I was not very successful, I wanted to open a java program, a jar, she does not have Jframe, she only sends information on the Console, I wanted to run her and take this…
-
2
votes1
answer115
viewsHow to include current date in a generated Javadoc?
I’m using jAutodoc to automatically generate Javadocs, here an example: /** ## type: class|interface|enum * The ${e.getType().fu()} ${e}. * * * @author Edson * @version 1.0.0 * @date 11/09/2015 * */…
-
2
votes2
answers971
viewsRead files in reverse way
My goal is to read a file (line by line), but starting from the end of the file (last line) to the beginning (first line). One could give a possible idea of performing this procedure? Was using…
javaasked 9 years, 2 months ago Alexandre Barreiro Neto 64 -
2
votes1
answer83
viewsEAD: Configuration error while running tests
I downloaded the videos from the site for studies, in the video of Modulo3_video3, about Configuration, I got an error running the test after using the Configuration feature. 1 - I added the file…
-
2
votes1
answer311
viewsBuild report in Java
I’m doing a system with swing as a college job and at the end of each cycle of days the program wanted it to generate a report. Does anyone know how to compile a report in Java?
-
2
votes2
answers6461
viewsError opening emulator in Android Studio
I have an error here in Android Studio when I go debug the App in the emulator, it does not open and the following error appears: "ERROR: x86 emulation Currently requires hardware Acceleration!…
-
2
votes1
answer8737
viewsHow to fix "Sqlexception: No suitable driver found" error while making a connection?
I am trying to make the connection to the database in my code, however it appears the following error: Exception in thread "main" java.sql.Sqlexception: No suitable driver found for…
-
2
votes3
answers467
viewsWhat is the best method for exceptions?
What’s the best method to pick up exceptions in an Android app, like try/catch, throws or throw. Type exceptions, fields the user left blank in a form.…
-
2
votes2
answers5153
viewsHow to calculate distance from the user’s location to another address?
What I need to do is very simple, but I don’t know how to do it. It works like this: I pass an address to the user and once he is in place he presses a button, while doing this the application must…
-
2
votes1
answer467
viewsHow to separate a string into several in java?
My problem is basically the following, I have a JSON code that takes the data from a URL, and returns it to me (The values are in Long) 528593 444218 5693595 2466912 2466435 However, it returns this…
-
2
votes3
answers240
viewsHow to know which servers are waiting for connection on my network?
I’m developing a multiplayer (LAN) game with Sockets in JAVA. Players will start a lobby, and in this lobby there will be a list of servers (game rooms) waiting for connections. How can I list the…
-
2
votes0
answers116
viewsError terminating the java android service
I have a service running in the background that ends after a while after closing the app. I don’t want the service to end when closing the app Service: public class GpsService extends Service {…
-
2
votes2
answers387
viewsHow to return strings that are in crescent date format in Sqlite?
I took a long and recorded on the bench in this format SimpleDateFormat("dd/MM/yyyy") which is a string and now I need to organize the dates. I tried to use this command but it comes in descending…
-
2
votes1
answer930
viewsHow to create variable dynamically?
I would like to create a variable for each iteration of a for. Example: for(u=0;u<tamanho;u++) { int variavel[u] = "valor" } It is possible? UPDATE This is the real code. SearchConstraint c1 =…
-
2
votes2
answers1170
viewsFormat Phone number in Textview - android
I have a TextView that displays the user’s phone number, I would like to display in my application a mask that leaves the phone number in the format (xx) xxxx-xxxxx. How could I do that?…
-
2
votes2
answers173
viewsHow to create Pojos with annotations quickly?
I have a database with many tables, I have to create the Pojo of each table? If yes, have to automate?
-
2
votes1
answer657
viewsGenerating a hexadecimal string
Good afternoon guys, I’m generating a random hexadecimal string in this pattern: 81c1328d-4dae-4af7-9974-893bb8ec90d4 But I would like to optimize this code here: public String geraKee(){ String…
-
2
votes1
answer1040
viewsJfreechart - Java Swing charts do not appear on the screen
Hello, I’m developing a Java swing application for a university project. Basically it is a program that reads XML files from another application (mobile game) and generates graphic reports from the…
-
2
votes1
answer121
viewsPlay Framework - Which version is the most recommended to use?
I started trying to learn play framework and saw that until version 2.2.x everything was done from the concole by typing the command "play new, play run, etc" and, only that to run this version…
-
2
votes1
answer89
viewsWhat’s the difference between creating a Socket via Socketfactory and creating one with new Socket?
I was studying about Sockets and saw that some people created sockets with Socketfactory (javax). I’ve always created like this: Socket skt = new Socket(host, port); In the example I was like this:…
-
2
votes1
answer40
viewsJava - Disk Reader (Linux)
Good night, I was looking like we can open the disk drive on Windows using Java there are various means like even using vbs. I wonder if I need to use some library on Linux or if I can do it…
-
2
votes0
answers175
viewsAlertdialog with internal keyboard
I would like to know how to create a AlertDialog like the one in the image (with keyboard) on Android. Thank you. Keyboard: <Button android:id="@+id/dois" android:layout_width="wrap_content"…
-
2
votes1
answer144
viewsNullpointerexception occurring
My teacher uses the technology of EasyAccept as validation of errors. In one of the tests it is necessary to use Exception. In the code below, I managed to treat in a way that I THINK is…
-
2
votes1
answer437
viewsSave Arraylist to the external memory of an Android phone
have how to save an Arraylist by Fileoutputstream in the memory of an android phone? Or have some better method? For example: FileOutputStream fos = openFileOutput("Foto_Imovel",…
-
2
votes1
answer1537
viewsHow to change the standard source of Swing components?
I wonder if there’s any way I can change the font pattern from Labels and Swing buttons, if possible, for general design. All the Labels that I create I have to keep changing the font to one that is…
-
2
votes1
answer1507
viewsSelect Multiple Lines in Jtable in Java
Good evening Guys, my doubt is how to select several lines in an action, is that I intend to create a condition in a column if the value is higher select the row, more if have equal values have to…
-
2
votes1
answer716
viewsProblem with encoding in Excel file reader for Java
I have a relatively "common" problem. I have a program in Java that imports an Excel spreadsheet and one of the column fields has words with accents, cedilhas, etc. When reading the variable, it is…
-
2
votes2
answers865
viewsI can’t save to the database in a Spring MVC project
I will explain the project because I believe that most people usually create projects using XML, and I created the Spring MVC project by dispensing the files that configure the project as XML. The…
-
2
votes1
answer1342
viewsHow to make a program in Java search in a certain information file and return a string
Hello. I have a program that would have to search in a text file like this: ovelha animal gato animal joão humano arvore planta I need a method, which receiving a string, evaluates based on that…
javaasked 9 years, 1 month ago pedrocarboni 117 -
2
votes1
answer1476
viewsERROR Could not open Connection and user root
Is happening these errors below in my application: Note: I am using Maven. Follow an image of how the project structure looks in the eclipse: Follow the mistakes below: out 22, 2015 11:03:58 PM…
-
2
votes1
answer746
viewsProblem running runnable JAR: Unable to load class [com.microsoft.sqlserver.jdbc.Sqlserverdriver]
I am facing the following problem: we are in the development phase of a project, which involves the following technologies, SQL Server, Hibernate, Maven, Quartz and java. After finishing one of the…
-
2
votes2
answers5551
viewsHow to play sound on android
Good morning, I would like to know how I can make a code so that by clicking a button it plays a sound
-
2
votes1
answer1252
viewsOpen Folder to select File
How do I open the file selection box and only choose songs with the extension .mp3? I am using Windowbuilder but the menu does not provide such option for quick creation.
javaasked 9 years, 1 month ago Júnior Nascimento 679 -
2
votes1
answer59
viewsConvert Datetime to unixtime
Good morning guys, can anyone help me? I have a Java application and I need to do a conversion.. Where is localDate for unixtime.. How can I do that? This is my localDate: for (Telemetry telemetry :…