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
-
6
votes1
answer3389
viewsHow to upload Dynamic Images to JSF?
What is the best strategy for uploading and using JSF images? I don’t want to use the field blob in the database, then how do I resolve the problem of the images storage folder, since the file . War…
-
6
votes1
answer1120
viewsHow to prevent the List.size() method from running lazyload with Hibernate and JPA
When I make a query in the bank and an object is returned, in this object has a collection, which by default is Lazyload, if I do object.getColecao().size() ai is run the lazyload to bring the…
-
6
votes2
answers982
viewsIs it possible to perform an assignment and comparison in if clauses in Java?
It is possible to assign and at the same time perform a comparison in an if clause in Java? For example: String linha = leitor.readLine(); String saida = ""; if (linha = leitor.readLine()) { saida…
-
6
votes2
answers1085
viewsSave image after upload
I am trying to save a cut image after the user uploads the image. The upload works well and I can save the image cropped too, but something strange is happening. The image is only cropped and saved…
-
6
votes2
answers944
viewsMock Static method with Demoiselle and Powermock/Mockito
I’m trying to mock a Static method, but Powermock requires the use of a specific Runner (Powermockrunner) for the Static mock to work! And for Demoiselle to work, you need to start Weld with…
-
6
votes3
answers6578
viewsHow to resolve the SLF4J failure in Maven?
Problem with Maven install: When I spin in the eclipse Run As > Maven install I always get that message: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to…
-
6
votes2
answers2854
viewsHow to view a PDF in the browser with an ajax request?
I make a requisition like this: $.ajax({type : 'GET', url : URL_APP_CONSULTA_BOLETO_DIVIDA_ATIVA + url}); I have a java method that returns something like this: return…
-
6
votes2
answers3464
viewsSecure authentication via REST
I searched and could not find solution to the following problem: How do I control requests on a particular REST service? For example, if I have a blog where I access my services (insert post, remove…
-
6
votes2
answers772
viewsError executing Cordova build command
I’m executing the command build cordova (after finishing the settings exemplified in this link: Phonegap The Command-Line Interface). But the Node.js returns this error: Generating config.xml from…
-
6
votes1
answer332
viewsSpring MVC + Joda Time + @Datetimeformat
Description: The Spring does not convert using the @DateTimeFormat, try to order the start of the two forms below and it returns to me a 404. When I send the object without this field it creates the…
-
6
votes4
answers2972
viewsConvert data to Timezone
new Date() in Javascript returns me this format: Tue Apr 01 2014 13:43:13 GMT-0300 (BRT) I need to convert this to a java.util.Date. That’s what I’m trying to use SimpleDateFormat but I couldn’t…
-
6
votes3
answers4083
viewsRunning jar in client from browser
I need to run a jar file that should be on the client’s pc over the web and pass some parameters to this jar, I managed to do this with the exec() php: exec('java -jar…
-
6
votes2
answers1880
viewsVariables with Bigdecimal
I am trying to add a value in a variable of type Bigdecimal, however independent of the calculation it results in 0. Sample code: BigDecimal valorTotal = new BigDecimal(0); public void…
-
6
votes2
answers11874
viewsHow to create an infinite array?
I’m having a little problem and need to somehow create an infinite array, or rather, undefined, the user can enter as much data as necessary... How could I do it? I’m using the JDK6.
-
6
votes1
answer3110
viewsDecoder for CAPTCHA
I need to turn a captcha into text, being specific, to perform the download of NFE on the site Receita Federal, and for this I have read about the OCR however, it does not seem to be 100%…
-
6
votes1
answer181
viewsJAXB - Tag repeating, instead of nesting
I have a problem that I can not store more than one element in the same TAG, look at XML: <ItemCardapio> <nCdItemCardapio>10</nCdItemCardapio>…
-
6
votes2
answers8155
viewsPush button by hotkey in Java
I have a java application created by Netbean IDE 8.0. In this application I created a Jframe and put a Jbutton, which when pressed displays a message. private void…
-
6
votes1
answer1447
viewsDifferences between Log4j and SLF4J
What are the vantagens and desvantagens of each one? They can be usados simultaneamente in the same project?
-
6
votes2
answers437
viewsHow to access jTextField statico created with swing?
So guys I got one jTextField that works normally but when I put it as static the setText no longer works, and I need it static because I pass the same to a function, I did it without the swing and…
-
6
votes1
answer1808
viewsRun another application as soon as you receive an SMS
I need to call an app already installed on my mobile as soon as I receive an SMS from a certain number. All the code of this application is already ready, but I do not know how to call it from this…
-
6
votes2
answers375
viewsDoubt with inheritance in Java method
I have the interface below public interface BaseRelatorioDTO extends Serializable { public BaseFiltroDTO getFiltro(); public List<? extends BaseRespostasDTO> getRespostas(); } And I’d like to…
-
6
votes1
answer624
viewsUnique key violated when I’m doing a delete. Why?
I have a problem that seems silly but I’m skating and I can’t solve it. I have a nice application made in Java using JPA 2 with Spring, Spring Data, JSF, etc... It works great. The basis I’m using…
-
6
votes1
answer7351
viewsHow do I popular a Jtable?
I have a very simple java application, which connects to a database, in the console I type the query I want that is passed by parameter to the Query. Now I need to move all this to a graphical…
-
6
votes2
answers804
viewsWhy does this code loop infinity?
Because if I put an invalid entry like asdf the code below enters infinite loop? After capturing the exception and writing the message he should not ask for another entry again? import…
-
6
votes1
answer374
viewsThreads running problem, using flags
I am having some problems in the complete understanding of the code because I am new to using java in thread. What code will do is control the flow, doing 55 iterations dividing between the thread…
-
6
votes2
answers2013
viewsHow to pass a JSP file to Servlet?
I have a page . jsp, where I have an input file. I need to open this file to use the information contained in it. Suppose it is a pdf. I receive this pdf, sent to Servlet for the purpose of using in…
-
6
votes2
answers1295
viewsCustomization of Jtextfields
Many professional programs use Jtextfields or Jbuttons customized with different edges. Someone would have code examples to change the design of these buttons and text Fields to something like the…
-
6
votes2
answers2098
viewsHow to close a Jdialog after you finish running a Thread?
I have a configuration window that opens on the first run of the application I’m developing. After typing the directories that the application will run the user click save, some tests are run and…
-
6
votes2
answers99
viewsHow to get the code from a Unicode General Category?
Java has the method Character.getType(char) to obtain the Category General Unicode of a character, but the return value is a int - corresponding to a constant defined in the class itself Character…
-
6
votes2
answers30147
viewsJoptionpane, for example?
Well, Joptionpane needs all these complements: JOptionPane.showOptionDialog(parentComponent, message, title, optionType, messageType, icon, options, initialValue); Could you give an example of all…
-
6
votes1
answer381
viewsJava program that comes with JRE
I want to create a program in Java, but that the person does not need to have Java installed on their computer. Can I put an JRE next to my program with only the necessary classes? An example is: I…
javaasked 10 years, 3 months ago Igor Costa Melo 729 -
6
votes1
answer7135
viewsHow to call the Arrays.Sort (array, new methodoOrd()) method in Java?
Knowing that I have a class with an array of objects and another class that implements the interface Comparator. I would like any example just so I can learn and sort an array of objects by their…
-
6
votes2
answers189
viewsAdd JNI Library Compilation with Maven or ant tasks
I am creating a Java project with native methods (JNI) without having to create three separate projects for it. My goal is to compile everything I need all at once. I use only one DLL/OS in this…
-
6
votes2
answers1364
viewsProblem with very large URL
I am trying to pass a URL by GET and the server is returning error 404 by the URL being too large (I am passing an XML through the URL). I have already tried to add the Maxfieldlength variables with…
-
6
votes1
answer340
viewsWhat’s the difference between serialized and non-sserialized objects?
I know an object is serialized when its class implements the interface java.io. but I would like to know what it means that the object is serialized and what difference there is with another not…
javaasked 10 years, 1 month ago Heidy Miguel 121 -
6
votes1
answer134
viewsWhat is the difference between variables declared as final and private?
What is the difference between these two types of variables and why can’t they be accessed in certain parts of the code? I read about private, public and abstract methods, but did not understand the…
-
6
votes1
answer5016
viewsInclude jar file in Maven project
How do I include a . loose jar in a Maven project? Obs: The jar I need to include has dependency on another 3 jar files. The jars in question are from the project Brunette Attempt #1 I created a lib…
-
6
votes2
answers1225
viewsMaven + Spring MVC + JSP project, how to share view files?
I’m trying to adjust a file structure to start a big project, an ERP to be more exact. Today, there is a good part of it made in PHP in a disorderly way. Let’s adopt Java Web (Maven + Spring MVC +…
-
6
votes3
answers1337
viewsIn what order is a Set stored? Random?
When I store something inside a Set, the order in which it stores is random? And how could I order a set Set?
-
6
votes2
answers1446
viewsRemove String Connectors with Regular Expression
How could I remove connectors: "e", "do", "da", "do", "das", "de", "di", "du". From a sentence without changing the whole name. Example the name: Daniela de Andrade. I wanted to remove only "from",…
-
6
votes1
answer156
views -
6
votes2
answers3795
viewsHow do I run a video inside Jframe?
I want to open a screen and contain a player to run the video that is attached to the project!
-
6
votes0
answers320
viewsAdd checkbox to a Jtree
I’ve looked around for plenty of examples JTreeIt’s checkboxes but it all seems very complex. Does anyone know a simple way, if there is one, to add to a JTree that I dragged to my frame, a checkbox…
-
6
votes4
answers3497
viewsHow to prevent the user to enter numbers for a given data?
How do I make my Java program not accept numbers as given by the user? I would like, in a field that requires the user name, if a number is inserted, such as a badge, make the program ask again for…
-
6
votes1
answer1189
viewsComparing Ides to java
Next semester I will have to choose between two Ides: Netbeans and Eclipse. I will need to develop desktop apps, and I’m having doubts about: Tools for graphical user interface Hardware Requirements…
-
6
votes1
answer1314
viewsSoftware for obfuscating APK
I do not know this question is valid to raise here according to the policies of questions but if it is not I will remove it, a short search on the internet found several tools including sites that…
-
6
votes1
answer1877
viewsProblem reading file . xlsx too big in Java
I am working in a web application using Java, where I have a method that should read a file .xlsx, using the apache-poi: public static void xlsx(String arquivo) throws IOException{ try {…
javaasked 10 years, 3 months ago Erico Souza 2,188 -
6
votes1
answer1796
viewsExceptions in Java
I am studying about exceptions in Java and would like to understand better. When declaring an object, if the programmer predicts that a failure may occur in the execution of the method, he will…
-
6
votes1
answer1441
viewsExecution flow of a Try/catch/Finally block
How the execution flow works in a block try/catch/finally in the example below? public class ExceptionTest { public static void makeException() throws ExceptionAlpha, ExceptionBeta, ExceptionGamma {…
-
6
votes1
answer1925
viewsHow to request a trial in the java android app?
What is the best way to request an android app review? Ex. if the user chooses to rate it is directed to make a review of the app in google play.