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
-
4
votes2
answers7146
viewsHow to make buttons of various formats in java?
I am creating a little game using Swing, and would like to make buttons with different formats, the way I choose. For example: a round button, or an eye-shaped button, for example. And if you know,…
-
4
votes2
answers2192
viewsDecimal places when using Println in Java
I have the following problem when I have this function printed System.out.println("Area do Tetraedro = " + c1.getArea()); the value of it is very great, example: Tetraedo area = 389.71143170299734…
javaasked 10 years, 6 months ago IMoonBlackI 364 -
4
votes3
answers29445
viewsHow to check if the String is null or blank in Java / Android
I went through this problem implementing a simple library of database queries sqlite in android and would like to share the solution with the community, I believe it will be useful since I have…
-
4
votes1
answer112
viewsThread Safe and its link to Collections
What comes to be thread safe, and what is your connection to data collections?
-
4
votes1
answer3396
viewsJava Regular Expression
I am programming in Java and need to filter a String from a regex using the method matches(). I can accept letters (a-z) or numbers (0-9), where that number can have 1 or n digits. I am using the…
-
4
votes2
answers178
viewsHow do I get the values of a date in the "dd/MM/yyyy hh:mm" format and compare it to the system date after setting it in this same format?
I wanted to make a comparison between the date contained in the hora1 object and the system date, as I can do? import java.text.SimpleDateFormat; import java.util.Date; public class MainTarefas {…
-
4
votes4
answers222
viewsReturn null by breaking the code
When I search right the name of the person on the list of people it returns the person but when the return is null it breaks the loop of the code and shows it: Exception in thread "main"…
-
4
votes1
answer2476
viewsWhy is Pattern Open Session In View considered an anti-pattern?
I wonder why many developers and architects consider the standard Open Session In View one anti-pattern?
-
4
votes3
answers474
viewsMap java.time properties with Hibernate and/or JPA
Is there any way to map properties like java.time.LocalDate and/or java.time.Instant through JPA and/or Hibernate?
-
4
votes1
answer2392
viewsGenerate private certificate APK using Eclipse Android
When I click "Run" in the eclipse it generates the APK, sends and installs on Android, but it installs using a Debug certificate, I’m using Google Games Services and it only works if the APK is with…
-
4
votes2
answers4463
viewsHow to view a browser’s http request, and the server’s http response
I would like to get this information to study full examples of https protocols with Cookie and Sessions, either through Socket Java, PHP. If possible through the browser itself.
-
4
votes1
answer263
viewsIntegration between Spring and JPA
I recently started studying one of the most amazing frameworks I’ve ever known, Spring. I always make good progress in my studies, I’m already studying the integration of Spring with data access…
-
4
votes1
answer138
viewsSQL method for login
I have the following scheme: JdbcRowSet myrs = new JdbcRowSetImpl(); myrs.setUrl("jdbc:postgresql://localhost:9999/teste"); myrs.setUsername("postgres"); myrs.setPassword("");…
-
4
votes3
answers5429
viewsCompile jar for exe and no longer need to have a JRE
One more problem here, and I need your help. I downloaded a program that converts jar files to exe. The only problem is I still need the JRE. Is there any way to convert the program to exe and then…
javaasked 10 years, 3 months ago Igor Costa Melo 729 -
4
votes1
answer9073
viewsSend and receive image via Webservice
I’m developing an app where I need to convert an image to JSON and send it to a Webservice. Later I will need to perform the reverse path, IE, receive a JSON image of a Webservice to present it to…
-
4
votes1
answer824
viewsSSL Socket Java encryption
I’m having doubts about the Java SSL Socket. I saw on several sites that the connection of SSL Socket is encrypted, but none of the sites gives me information on how this works right. How do I know…
-
4
votes1
answer242
viewsAttempt to update registration ID not allowed with JPA and Eclipselink
How do I allow updating the ID of a record with JPA and Eclipselink? The following exception is thrown when I try to update the ID: Caused by: Exception [Eclipselink-7251] (Eclipse Persistence…
-
4
votes1
answer3184
viewsSize of a Java + Hibernate String
Is there any way to persist a string with no size limit for the bank using Hibernate? If I map my class and don’t limit the field, Hibernate automatically creates a limit of 255 characters. I could…
-
4
votes1
answer1498
viewsHow to replace characters from a String?
I have a small problem. My application receives a numeric string representing a value from the server. But the server sends, for example "100.00" and I need to put a comma in place of that point.…
-
4
votes1
answer616
viewsThread problem
public class ThreadTest implements Runnable { private String word; private long time; public ThreadTest(String word,long time){ this.word = word; this.time = time; } public void run() { try {…
-
4
votes1
answer551
viewsIteration gives Concurrentmodificationexception error by including more than one button
I have this little game that I’m developing where the character goes through buttons that will remove barriers so that it can access other areas of the maze. I created two lists, one for the fences…
-
4
votes2
answers5399
viewsMaximum number of characters in a String and Stringbuffer in Java
What is the maximum limit of characters that the types String and StringBuffer support in Java?
-
4
votes2
answers1762
viewsHow to return the position of an element in the Hashset?
I have the following structure: HashSet<Contato> contatos = new HashSet<Contato>(); How to return the position of a particular Contact element that is contained in the Hashset? I was…
-
4
votes1
answer1078
views"No suitable driver found" in Java database connection
Well, I use the eclipse and I’m trying to connect a Mysql database with my project, my code, compared to other tutorials I found, it’s perfect, and it’s this: package pack; import java.sql.*; import…
-
4
votes1
answer641
views -
4
votes1
answer121
viewsPossible causes for a Session Leak
Through a monitoring tool, I am noting that my application has a considerable user session Leak. Every day, about a thousand user sessions are created, without any being destroyed. To take sessions…
-
4
votes0
answers178
viewsProblem with Ubuntu window focus setting when using Java
I was making a program in which a circle is drawn on the screen and it is walking around the screen, using the classes JFrame to create the window, a thread to control the circle I insert on the…
-
4
votes1
answer306
viewsObject-relational mapping (JPA + Hibernate) using XML
For a specific reason, I need to do object-relational mapping (JPA) of my entities with XML. [Unfortunately,] I cannot use annotations to do this. It turns out that in certain properties, I need to…
-
4
votes2
answers3558
viewsHow to view a. txt file in a Jtextarea automatically
I’m tired of searching and can’t find how to display a.txt file in a Jtextarea automatically. I made a program that opens a window and then wanted it to display the contents of that file without…
-
4
votes2
answers1316
viewsHow to Inhibit Display of Information on the Eclipse Console using Hibernate
I would like some help. I am developing a system using jpa-Ibernate, jsf and primefaces. Whenever I run the application the following appears on the console: 0 [http-8080-2] INFO…
-
4
votes2
answers649
viewsJava alternative to code-Climate
I wonder if anyone knows any tool/service for Java for the service code-Climate The service provides an analysis of the code under various aspects of good practice, potential security risks and many…
-
4
votes1
answer4628
viewsIteration VS Recursive Methods
What is the difference between recursive methods and iteration and what are the advantages of using the two approaches in a java program?
javaasked 10 years ago Eric Shussan 171 -
4
votes1
answer80
viewsIn-app purchases through the carrier
Nowadays in my application I use the in-app-Billing system, but I would like to know if it is possible to make sales and charges for the credit of the user’s device operator. Is it possible? In one…
-
4
votes2
answers360
viewsPut method return before a "Finally" block
Considering: try { System.out.println("Parte 1"); return false; } finally { System.out.println("Parte 2"); } What will be the output and what happens behind the scenes so that the output come out…
-
4
votes1
answer822
viewsImplement serializable in JSF
Why to implement serializable in the JSF bean Managed? When to use and not to use? What is the serializable interface for?
-
4
votes3
answers2716
viewsIs it possible to create a MAP<> within another MAP<>?
It is possible to create a MAP<> within another MAP<>? like this code: private Map<String, Map<String,Object>> mapTESTE = new HashMap<String,…
javaasked 10 years, 3 months ago jsantos1991 2,397 -
4
votes1
answer588
viewsJtable, add multi-lines[Cell span] +Format table
I need to do something like this: Right now I have a table like image 1, but I wanted to create a table like image 2. How can I create something like this? Any ideas? The closest example I saw was:…
-
4
votes2
answers909
viewsConvert List<T> to T... dynamically in a method call
I’m in need of something that seems to be simple, but I’ve been doing some research and trying and I haven’t found anything that helps me. Problem I have a list of the kind List<T> I receive…
-
4
votes1
answer339
viewsHow to create button in Android Behind code?
I’m developing an app where I download some images from the internet when the app opens. I want, when I have these images downloaded, to create a button for each image and put it in the background.…
-
4
votes1
answer423
viewsTry/catch does not "catch" to Exception
I’m using JPA and was trying to create an Entitymanager, and was testing some expcetions treatments in a class of mine. However, I have a problem, that Exception is not being "caught" by catch.…
-
4
votes1
answer721
viewsHibernate + Inheritance
I’ve been trying for some time a solution to my problem. I’ve done a lot of research but nothing clearly explains what I need. So I created an example application and am making it available from…
-
4
votes0
answers80
viewsView video with Javacv using applet
I’m using an applet that displays a security camera image through Javacv. Running alone, the applet displays the video perfectly. When I run the applet in my web application, it even renders the…
-
4
votes2
answers1659
viewsWhat is and what is the reserved word "strictfp" for?
I don’t know this keyword, I’ve never seen an example of code in which it was used. Until today I discovered her existence by reading some books about Java, however it was not clear what the utility…
-
4
votes1
answer2596
viewsCreating Automatic Tables by Hibernate
Good afternoon, I am trying to create the tables automatically, and I think I must be missing something. someone can help me? this is my line of code Java office. package br.com.teste; import…
-
4
votes3
answers4171
viewsTime in Java counting seconds in real time
I want to show the system time and the seconds counting in real time in Java.
-
4
votes2
answers1804
viewsRunning program in the background
How to run a program in the background, and when the user presses a key the program does something? I only know how to do with the program in focus.
-
4
votes1
answer108
viewsProblem in Context and Sharedpreferences on android with service
I’m trying to create a service on android, it is ready however in running the application to. If I comment on the variables ctx and prefs, it works but I need them, can you tell me if there is…
-
4
votes1
answer286
viewsApplet does not run in browser
Do not run Applet. Just give this return. This is my java class. public class SiteSelector extends JApplet { private HashMap<String, URL> sites; // nomes e URLs de site private…
-
4
votes2
answers851
viewsIs it possible to limit the number of lines in a class attribute that is a list via JPQL?
I have the query below in JPQL FROM User u INNER JOIN FETCH u.enderecos e WHERE u.id =:id ORDER BY e.id DESC A user can have more than ten addresses, so we want to bring only ten addresses and if…
-
4
votes1
answer7881
viewsData saving on Android
I have a project based on the following 'folders' structure that will be saved some data in the external memory: /AppName Example1 [ Text files and etc. ] Example2 [ Text files and etc. ] Let’s say…