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
-
3
votes1
answer244
viewsUse a class in another class
good morning. I’m new to Java, but come on. I have a java class and need to use all of its methods in another main class. There’s a problem, I’m already using a extends in both classes. I need to…
-
3
votes1
answer225
viewsWhich classes implement the abstract type of queue data?
Considering that there are classes java.util.Stack and java.util.ArrayDeque in the context of stacks, there are also Java classes that implement the abstract type of data queue?…
-
3
votes2
answers1783
viewsError starting Tomcat 9 as a service
I am having a problem starting Tomcat service. When I try to start the service, some problem happens and it is not initialized. The log in the C:\Program Files\Apache Software Foundation\Tomcat…
-
3
votes2
answers377
viewsDoubt regarding the management of JPA with Spring in JEE server
I’m starting in Spring MVC and in the book I’m reading the configuration and management of connections is all done by Spring, IE, Spring opens and manages connections with the bank and makes it…
-
3
votes1
answer642
viewsHow to format a number for String by placing points "."?
I was trying to format a number by placing stitches to make it easier to read. But with the dot it doesn’t work, but it works with commas. Ex: String s = String.format("%. d", 123456);…
-
3
votes1
answer74
viewsError creating thread inside a Handler
I need to delay 5 seconds in one of the parts of my application: final Runnable runnable = new Runnable() { @Override public void run() { // Encadeia trabalho serializado jobChain.append(new Job() {…
-
3
votes1
answer119
viewsJasperview closing the entire system
I don’t even know how to explain it but I’ll try. I have a system made in Javafx that displays reports with Jasper according to the selected item, until then everything quiet, when selecting an item…
-
3
votes0
answers74
viewsClient-Server, Threads, client error while online
I’m developing an application cliente-servidor, the server has two threads (one in and another out) well-implemented. I walk the server (all right), I walk the first client and I put it online (all…
-
3
votes1
answer95
viewsSave ifconfig to variables
It would be possible to execute the command ifconfig and save the result in variables (e.g., ip, network mask etc) in Java?
javaasked 7 years, 6 months ago Stephano Balbinot 51 -
3
votes2
answers162
viewsCapture through the Exceptionhandler
I’m trying to capture a javax.validation.ValidationException in my MB to later play an alert. I tried with the three examples below independent but nothing returned. Should I enter any more code ? I…
-
3
votes2
answers997
viewsPossibility to schedule threads in Java to run at different times
I have a system multithreading which is the same as the topic post link - Java Thread Sync (sync collections) in Java that allows scheduling threads to perform at different times. That way, the…
-
3
votes2
answers264
viewsJava + Firebird connection returning Null
My connection string with the Firebird database returns null. Follows below code: public class ModuloConexao { public static Connection conector(){ //criação da varáivel conexao Connection conexao =…
-
3
votes1
answer143
viewsHow to call the value of a variable?
How can I call the value of a function variable into another function? I’m using the jPanel, where I will add a text with: jTextArea.append("AREA = " + /*AQUI*/); Where it says HERE I wanted to put…
-
3
votes1
answer244
viewsHow do I know if a socket is "listening" on the server side?
When I use the function isConnected() of java.net.Socket, on the client’s side, and she returns to me true can I make sure the server is "listening"? How else can I know? Only with a waiting time…
-
3
votes2
answers374
viewsJava lambdas are equivalent to Javascript Closures?
I started studying functional programming and I’m a little confused about these two items. My point is: Java lambdas are equivalent to Javascript Closures? If they are not, what is the difference…
javascript java lambda-expressions functional-programming closuresasked 7 years, 6 months ago Bruno Peres 1,202 -
3
votes1
answer1432
viewsImage processing help (background removal)
I need to create a code to perform the frame processing of a video. In case the program will scan the pixels of the image and analyze the colors of the pixels and if you find colors close to the…
-
3
votes1
answer585
viewsGenerate file . txt with three columns
I have a system where I do some research at the bank and store everything in one Array, but I have to put together a layout with this data so that they can be printed as labels on a matrix printer.…
javaasked 8 years, 10 months ago DiegoAugusto 8,694 -
3
votes2
answers300
viewsAndroid: Saving Data in Files
I’m having trouble using files on android. Save the file and use quietly until close the application, when I open the app again the file is recreated and I lose the recorded data. I have tested…
-
3
votes1
answer314
viewsBy icon in Jframe
It would be possible to icons in the application executable through code?
-
3
votes3
answers606
viewsFind the element with the highest number
I’m doing a basic election system, but I have a problem telling which candidate was elected. In this case, I added three candidates (x, y, z) to a ArrayList, I put two votes on x, three on y and…
-
3
votes2
answers374
viewsError while subtracting with no value fields (Android)
I got two camps like double, where the values should be subtracted. But when I do not enter any value in the field, an error occurs and the application closes. How can I solve this problem? Follows…
-
3
votes0
answers382
viewsHow to change startup icon image of a . jar?
For example, exchange that cup of coffee for another icon.
-
3
votes2
answers321
viewsProblem with hasNext() Java
Hello, I have a problem, I scan a txt file, then I invoke a method to go counting the lines of this file, after returning me the number of lines (to give the size to the String Array equations)I…
-
3
votes2
answers1346
viewsCaused by: java.awt.Headlessexception: No X11 DISPLAY variable was set, but this program performed an Operation which re
When trying to run a report that contains a fixed image on an Amazon linux server. The exception appears below. Someone has already been through it ? Caused by: java.awt.HeadlessException: No X11…
-
3
votes2
answers762
viewsProblems to remove @Manytomany element with @Jointable
I’m having trouble deleting a @Manytomany relationship on JPA. In short, I have 3 tables: USER, PERMISSION and USUARIO_PERMISSAO which is the relationship of the previous ones, the relationship is N…
-
3
votes1
answer353
viewsAggregation and composition in various relationships
Given a class A, let us say that the relation between this class A and a class B is composition, where A is the class "all" and B is the class "part". Given a third class C, can there be another…
-
3
votes0
answers2685
viewsAlgorithm by Dijkstra
I’m trying to implement a maze, where one needs to find a better way to get to the exit (without running into the wall). The labyrinth has already been implemented, the structure is practically…
-
3
votes2
answers9108
viewsHow to insert multiple values into an array?
A student can take several courses such as "English", "Portuguese" etc. How do I put multiple course names in one array? I don’t want to set an example with ArrayList. It’s just to take a question…
-
3
votes1
answer227
viewsFire automated e-mail at a certain time with java
My system has the part of dental consultations and I need to send email to the client, if your consultation is on that day. For example: Run an automatic e-mail trigger at midnight every day. This…
-
3
votes5
answers23968
viewsHow to get and format current date and time?
I would like to know how to get the current date and time and then format them in JAVA. For example, I have these two values: 23062017 212010 I want to store each value in a variable, and then I…
-
3
votes1
answer1030
viewsHow to load picture graphicImage primefaces into different component
My idea at first is this: I have a component p:dialog header="Foto Funcionário" widgetVar="dlg" resizable="false", where I capture my image and crop, as soon as this image is cropped, I would like…
-
3
votes3
answers104
viewsAbout inserting names into an array. The user puts the course name as argument in the method
I have this method: public void inserirCurso(String nome){ System.out.println(" Cadastre seus cursos aqui."); for(int totalCursos = 0; totalCursos < cursos.length; totalCursos++){…
-
3
votes1
answer597
viewsJava String byte array with negative numbers
I’m having trouble figuring out the encoding of a string. The entrance is: São Paulo The original reading of this content is not my job, because the text goes through a Lua wrapper for Java. On my…
-
3
votes2
answers4919
viewsHow to change the color of the Statusbar?
How do I change the color of this part of the app? I wanted to put everything in the same green color as this one below.…
-
3
votes2
answers3704
viewsHow does the equals method work?
I stopped in an exercise of a book I’m reading and in this shows an example of overloading the method equals, I even understood the concept that he compares the reference between two objects, but in…
-
3
votes1
answer442
viewsConvert java.util.date to java.sql.Date
With this line of code I can get through java.util.Date for java.sql.Date? java.sql.Date sqlDate = java.sql.Date.valueOf(String.valueOf(date)); Taking into account that date this format : Sat Jul 01…
-
3
votes1
answer392
viewsJPA/Hibernate Entity with Collection for itself
Hello, I have an entity called menu in my system. A menu can be child of another menu and so on. The table has the following structure: The entity is mapped as follows: @Entity…
-
3
votes1
answer1699
viewsUpdate a Jtable within a Jframe through another Jframe
I own a JFrame, where inside it has a JTable and a JButton (Change) that makes the call from another Jframe. In this other Jframe, a data change is made according to the row selected in the table…
-
3
votes1
answer379
viewsHow to mount a link in JSP with the value of an input?
You can mount a link(href) or action(form) by taking the value of an input to pass to a @Pathvariable of a method in the controller? My code is next in the controller:…
-
3
votes2
answers222
viewsProblems computing on average in Java
I’m trying to make a program that calculates the average between 4 values. Code: private void botao1ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: int n1 =…
-
3
votes1
answer92
viewsChange of environment
I’m moving from environment, from VB.NET to Java (Netbeans), but I’m still not sure if some of the possibilities of . NET can be performed in Java with Netbeans. My first doubt materializes in the…
-
3
votes3
answers1794
viewsJava - Palindromic string inversion
I’m trying to do an exercise where I need to invert a word, phrase or number and check if it’s palindromic. For words and numbers, it is already working, but for sentences it gives errors depending…
-
3
votes1
answer50
viewsI get different results when I convert from Character to Decimal in PHP and Java
When I convert á to decimal I get the result 225 with this code in Java: public static int charToDec(String text){return (int) text.charAt(0);} When I convert á to decimal I get the result 195 with…
-
3
votes4
answers312
viewsCount distinct names saved in txt
I have a txt file with a line-separated user name below: diego sergio antonio maria diego antonio Notice that names can repeat, and I would like to count and list only the distinct names. I did this…
-
3
votes1
answer376
viewsHow to adapt Hibernate to the DAO standard?
I’m starting to study Hibernate and wanted to "start the right way". The doubt is as follows: For any transaction I need to use the following code: Session session =…
-
3
votes1
answer61
viewsFloat to Byte Array conversion
How can I be performing the conversion of float or integer (if possible) for a array byte in Java. Say: float x=180 Theoretically you would need to create 1 array 2 position bytes. Is there any way…
-
3
votes1
answer656
viewsWhy do packages start with the br.com prefix in Java?
I often observe examples on the Java code web where your class organization is always contained in packages with the br.com.algumNomeDecote prefix. Why is "br.com used" ?
-
3
votes1
answer1252
viewsAndroid Encryption and Encryption
I’m trying to learn how to use encryption to encrypt and decrypt messages. I’m with a class called Encripta which has the methods, the encryption works perfectly. My method of deciphering…
-
3
votes3
answers539
viewsByte separation
I’m building a system to communicate via Socket: The client system sends the following information: 1 - int - message size 2 - bytes - the message The message consists of: 1 - int - code of the…
javaasked 8 years, 9 months ago Rodrigo Lima 315 -
3
votes1
answer202
viewsError sending JSON by Socket
When the JSON string is too large, there is loss of part of the string in the upload. I am sending like this: private void btComunicarActionPerformed(java.awt.event.ActionEvent evt) {…
javaasked 8 years, 9 months ago Rodrigo Lima 315