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
votes1
answer367
views"cannot be resolved to a variable percentage"
I need to set the variable value porcentagem as defined in Spinner. The problem is that I need to use the value of porcentagem out of method setOnItemSelectedListener(), on the line int r =…
-
4
votes2
answers312
viewsProgramming for Android with multiple screens
When I program for Android, I think of portability with the most diverse devices on the market. Seeing the layout of my Activity principal, I noticed that in devices with small screen (I did the…
-
4
votes1
answer1566
viewsPrint integer combinations in ascending order
"Given two nonnegative integers m and n, generate all combinations of integer size m from 0 to n-1, in ascending order. Example: m=3 and n=5 (0 1 2); (0 1 3); (0 1 4); (0 2 3); (0 2 4); (0 3 4); (1…
-
4
votes1
answer153
views -
4
votes1
answer370
viewsHow to display an html page in a Jtextpane?
People I’m trying to display/integrate a php page into a JtextPane, works but I have no control of HTML, it just displays the text that the page generates and I would like to display with HTML,…
-
4
votes3
answers1363
views"Decode error - output not utf-8" in Sublime Text
I’ve looked at several websites, several questions (including in stackoverflow itself) I did a lot of research and I couldn’t get this error out of Sublime Text 2 yet: [Decode error - output not…
-
4
votes3
answers821
viewsWhat is an object returned in parentheses?
} return (carro); } Does it have any behavior other than the object without parentheses? I was in doubt, apparently the code works normally.
javaasked 9 years, 5 months ago daniel12345smith 2,120 -
4
votes1
answer240
views -
4
votes1
answer611
viewsHow to read a Json without knowing what is inside it or the amount of data?
I’m developing a dynamic form for Android in which you get a Json file and create the forms. Everything is automated, except for the part where I have to pick up a string in Json’s hand. There is a…
-
4
votes1
answer294
viewsVery slow listview on scroll bar
I have a problem I don’t know how to solve, I have a ListView customized with images and the scroll bar keeps crashing, even with the list loaded. It slows down the list to scroll. Adapter: public…
-
4
votes1
answer1034
viewsSpring Security without authentication
I have a system that already authenticates the user, and controls access to pages that require authentication, I need to use spring security to control access to pages by user rules and to control…
-
4
votes1
answer3441
viewsError creating Java Virtual Machine
I was running an rmi application on Eclipse Luna and appeared the following message : "Could not create the Java Virtual Machine. A fatal exception has occurred. Program will closed.". The operating…
-
4
votes1
answer368
viewsHow to solve DIRTY_WORKTREE
I’m trying to merge the gitusing the eclipse, but it presents me with an error: DIRTY_WORKTREE "file name". I’ve tried to reverse the commit and resetar, but neither option works.…
-
4
votes1
answer7264
viewsTake values separated by spaces in Java
Could someone explain to me how I can take values separated by spaces in Java? For example, the user informs all at once the following values: 1 2 3 and I have to put each value into a variable.…
-
4
votes2
answers528
viewsWeb application chat with Java and Primefaces
Well I would like to ask a question. I have to do a sort of chat where people can talk to each other. It will work like a chat of Facebook or WhatsApp for example, but I have no basis or reference I…
-
4
votes1
answer859
viewsHow to convert String that contains String quotes even using replaceAll?
I have a String as in the example below String a = "Meu pai é um Grande "baio" de fada"; I want to make it a string like this String a = "Meu pai é um Grande \"baio\" de fada"; how do I do this…
javaasked 9 years, 5 months ago Tiago Ferezin 1,567 -
4
votes2
answers1969
viewsHow do I check the status code of the server http response in java?
Good morning, you guys. I would like to know how to do in java to check whether the response received from the server was successful or not. Can someone help me with that?
-
4
votes1
answer964
viewsHow to create a Java directory using NIO.2 - Java SE 7
The API java. is part of the Java SE platform since its version 1.4. Now, from Java 7, we have several new Enhancements in this API and new features, which provide better management of the file…
-
4
votes1
answer138
viewsNashorn Project, javascript + java?
I found the approach interesting after studying more deep bytecode instruction Invokedynamic. But I have doubts about design and practical use. The javac natively will understand the javascript…
-
4
votes1
answer702
viewsHow to properly reuse business rules using Ejbs?
I am refactoring a system where the greatest concern is to decrease the coupling and complexity of the various levels of inheritance, so the examples are illustrative. I have the entities Contrato,…
-
4
votes2
answers2734
viewsRegular expression to retrieve strings starting with colons (:)
I need a regular expression to retrieve a list of strings starting with the two-point character (":") and ending with the space character or end of parentheses (")"). Example: String texto =…
-
4
votes1
answer330
viewsCan enumerations contain methods?
I don’t know if that’s the term, "abstract methods in a enum". My doubt arose after seeing this implementation in code review. Until then I had never seen this kind of thing in any tutorial or…
-
4
votes2
answers314
viewsJasper Reports 5 to 6 Obsolete methods
I created some relays through the TIBCO Jaspersoft® Studio - Visual Designer for JasperReports and I am using the lib below in my project. <dependency>…
-
4
votes1
answer624
views"The resultset is closed" error with Preparedstatement
I’m getting it when I’m walking through a ResultSet and get other ResultSets: public class BpaDetDao extends DaoAbstract<BpaDetBean> { public static final String // TODO Colocar campos no…
-
4
votes1
answer785
viewsN-N relationship with additional fields (problems to persist data)
I have an N-N relationship that works as follows: Destination.java (N)-(N) Customerservice.java Within this relationship there is an entity that keeps the relationship Ids, which has some more…
-
4
votes1
answer566
viewsDemoiselle 2.4.0: Error running test with Junit
I have a project built from the archetype of Demoiselle for Maven. The generated application is the one that exemplifies the Demoiselle, containing a register of bookmarks. The programmer who…
-
4
votes1
answer1518
viewsCompare two dates
I have two string containing dates dataSalva and dataDoDia and I’m wondering if the dataDoDia and 5 days longer than dataSalva how do I do this SimpleDateFormat dateFormat = new…
-
4
votes2
answers516
viewsShould the Domain layer depend on Infrastructure?
I’m reading Evans' book on D.O.D., and I came across the following quote:: The Infra layer does not perform any action on the domain layer, because it is below it, because it is below it it should…
-
4
votes2
answers755
viewsWhat does the dereferenced compilation error mean in Java?
In a test code (in Java), whose goal was to convert a string in one another string between upper and lower case letters, I received the following error at the time of compilation: error: char cannot…
-
4
votes1
answer1912
viewsCompile multiple Java classes in cmd?
How to compile multiple files .class in java by cmd? I tried and he informs that it was not possible to locate the main.
-
4
votes2
answers1415
viewsHow to authenticate a user via HTTP request?
I’m trying to authenticate users in a forum Vbulletin by means of an application desktop using components of the package swing, the code is working but I believe that this is not the best way to do.…
-
4
votes3
answers2948
viewsHow to add contiguous numbers from an array?
I have a array of numbers being typed by the user, and need to add the numbers of this array. import java.util.ArrayList; import java.util.Scanner; public class Questao3 { /*3.Fazer um algoritmo…
-
4
votes1
answer180
viewsJMF, Java Media Framework, is there a replacement?
A few years ago, around 10 years ago, I started a road data collection project, this project was being done in Java and used the JMF, a framework to deal with various types of media in particular…
-
4
votes1
answer1560
viewsFetch of children with JPA+Hibernate not working
I have two classes, Terminal (who is the father) and Portaria (son). I’m using JPA and it’s working, but there’s a bug I can’t fix. I upload a list of Terminal and when testing the t.getPortarias()…
-
4
votes1
answer57092
viewsHow to resolve java.lang.Nullpointerexception?
I created the class Server! However an Exception of the type is launched java.lang.NullPointerException! I wonder if someone could help me with this problem? The class is as follows: public class…
-
4
votes1
answer1542
viewsJava Dictionary API
Hi, I’m looking for a dictionary API in Java to create the program in the following steps: User enters with a string, in this case a word; I print on the screen the invocation of a method of this…
-
4
votes1
answer123
viewsMethod with foreach only returns false
I have a method that will check whether the debt is equal to zero(divida == "0"). If it is he returns true, else it returns false. Code: for(String divida : dividas){ return divida == "0";…
-
4
votes3
answers14619
viewsjava.lang.Noclassdeffounderror: Caused by: java.lang.Classnotfoundexception: When run . jar
I am developing in Netbeans IDE when running through the IDE everything works fine but when I do clean and build and create . jar while executing casts me this exception: I tried to compile package…
-
4
votes0
answers890
viewsFill CPF + Data field with java webdriver Selenium mask
I’m having trouble filling in Date and CPF fields with mascara via id or xpth in Selenium+java+Junit. Does anyone have any idea how to do?. NOTE: I don’t want to generate CPF...I want to fill out…
-
4
votes1
answer462
viewsHow to test the service layer
I’m developing a multi-layered, multi-module web project. For the persistence layer I am using JPA 2.1 and Hibernate 4.2 and for Junit 4 tests. In this architecture my project was divided into…
-
4
votes1
answer488
viewsHow to make my own commands and shortcuts in Eclipse?
What I mean by my question is that, for example, when I use sysout and Ctrl+Space the method line System.out.println(); is ready for me to use, reducing my time to type everything. I wonder if you…
-
4
votes1
answer317
viewsHow to make Regex to a "serial" number format?
How to make Regexp of the following format: 2015.1.123.5432 Does anyone have any idea?
-
4
votes0
answers136
viewsStackoverflowerror - Infinite loop when deploying Ear with ejb and Demoiselle
By doing the deploy an EAR with an EJB that depends on the Demoiselle-core, an exception to Stackoverflowerror is launched. It happens that when trying to create a Resourcebundle…
-
4
votes1
answer366
views -
4
votes1
answer464
viewsError when using required inputs in Primefaces
I have some inputs from Primefaces inside a Wizard, showing only one of them: <p:inputText id="inputTitulo" value="#{editalBean.edital.titulo}" required="true" requiredMessage="Informe um título"…
-
4
votes2
answers24752
viewsWhen executing "java" command in CMD it is not possible to locate or load the main class
After executing the command javac normally and create the file .class, I try to execute the command java plus it gives this problem of not being able to locate or load the main class. I think it…
-
4
votes2
answers220
viewsDeclare Set<double> - JAVA
I wanted to know how to declare a generic type set that is not a class. Example: Set<double>. All the examples I’ve seen set is from a class. I’m starting to see sets now. I need to make a Set…
javaasked 9 years, 2 months ago MarlonJhow 645 -
4
votes2
answers541
viewsHow do I check if my application is open on mobile or web?
I need to do a.css style for mobile and another for web .
-
4
votes1
answer115
viewsProblems with using JSTL
I’m implementing a WEB application with J2EE, but I’m not able to list the data coming from Servletlistarcursos to the Listdecursos.jsp page that uses JSTL. public class ServletListarCursos extends…
-
4
votes1
answer566
viewsHow to create a circle of progress?
I’m looking to make progress in a circle like this: In Java, I could only find something about JProgressBar.…