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
votes0
answers285
viewsTraffic Light: Deadlock detection problems
I did some research around here and I couldn’t find anything to end my doubts, so hopefully someone can help me. I’m going to put the code here, so you can visualize the problem better. Ah, any…
javaasked 9 years, 3 months ago Alane Pontes 91 -
3
votes1
answer1696
viewsHow to configure Tomcat in windows 7?
How to set up Tomcat 7 in windows 7? You need to configure java environment variables?
-
3
votes4
answers7937
viewsHow can I increment a day to a Java date?
What is the best way to increase a date of the type DD/MM/YYYY?
-
3
votes0
answers682
viewsHow do you create PDF file from ZERO (without frameworks)?
Well, I’m analyzing some possibilities to generate PDF’s on Android (offline), and none is fully satisfying, either by the license, features, large size framework, or support version of Android…
-
3
votes1
answer428
viewsError trying to create a database connection (Mysql)
I tried to make a connection to the Mysql database using AsyncTask, but is giving error in the class responsible for the connection, the MysqlConnect: The constructor Log() is not Visible I’m…
-
3
votes4
answers822
viewsWhen is a string considered a primitive type in web development?
I was in doubt in a class when the teacher said that a guy String was considered as primitive! But I learned in Object-Oriented Programming that are only primitive: Byte: 1 byte. Short: 2 bytes.…
-
3
votes2
answers452
viewsCan I use a char in an arithmetic operation in Java?
The following code doesn’t work, but I thought something along those lines: char op = '*'; ... r = (y op x); I want to change the characters of op to do different operations, it would be possible in…
-
3
votes2
answers332
viewsWhat is the behavior of the reference variable and the primitive variable?
What is the behavior of a variable of reference type (null) and primitive type (0) in memory before they are initialized. Where they are in memory?
-
3
votes1
answer677
viewsHow to set background color on multiple lines of a Jtable?
I would like to know how to set the background color of multiple rows of the table. In the code below it simply arrow the background in only one line, that is, in the last element of the vector. The…
-
3
votes1
answer295
viewsJava Sockets - Beginner
I’m starting in java and I have a problem with sockets, I wanted my server to receive a value and then wanted to turn it into a String, in such a way as to be subsequently included under if.…
-
3
votes1
answer401
viewsWhat is the best repository for Maven?
Sometimes I can’t find the dependencies in a repository, so where should I look for those dependencies? Is there a core where all possible dependencies will be there?
-
3
votes2
answers1106
viewsHow to open an Activity from a java notification on android?
How to open an Activity by clicking on the notification. The detail is that I want it to reopen again even if it is open in order to update the data of it. I’m using: int icon =…
-
3
votes2
answers949
viewsAdd field by clicking button
I am developing a client registration project, in a form using Primefaces I would like to click on a button and with this appear an inputText, if you click again, another appears and so on. This is…
-
3
votes2
answers1044
viewsString corresponding to real number
I am trying to check if a String x corresponds to a real number (any one). For this I created the following method: public static boolean Real(String s, int i) { boolean resp = false; // if ( i ==…
-
3
votes1
answer181
viewsOrganize list based on an integer value of its elements
I have a ArrayList of a class of mine that contains variables String and integers, as a name and punctuation. When I display it through a Adapter I would like the list to be in descending order, but…
-
3
votes2
answers1346
viewsCenter Swing Window
I wanted to know how to call a Secondary Window in Swing and leave it centered with the Main Window of the program. At the moment, when I call him appears in the upper left corner.
-
3
votes1
answer2310
viewsREST with Could not find error
I am trying to create a REST application, in Java web, very simple, using Tomcat 8 as a server. However, when trying to access the application: http://localhost:8080/aplicacao/rest/teste She brings…
-
3
votes3
answers375
viewsDemoiselle Error deploying to Jboss
When trying to deploy the example application, registration, of the Demoiselle tutorials in Jboss, I got the following error: 11:34:16,873 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-7)…
-
3
votes2
answers3238
viewsFormatting text in a Jtextpane
Hello, I have a Jtextpane and would like to format parts of its content. It is possible to do this? JTextPane areaDeTexto = new JTextPane(); areaDeTexto.setText = "Este texto está formatado em…
-
3
votes3
answers797
viewsHow to consider an empty Edittext as "0"
I’m developing an Android app that calculates 3x3 matrices so I’m 18 EditText, however if I want to multiply a matrix 2x3, 2x2, 1x2, etc. I would have to fill the fields of the matrix size and leave…
-
3
votes3
answers126
viewsIs it safe to keep the context of an app in a Singleton?
I have the habit of keeping the context of an Android app saved inside a Singleton as follows: public class Global { private static Global instance; private Context context; public Global() { }…
-
3
votes3
answers368
viewsHow to prevent an application that runs in the background from being stopped by the user?
For example an application that needs the strings of the apparatus every 30 seconds and that runs in the background and, the user can not force its stop manually.
-
3
votes1
answer46
viewsDoubt about Select
Hello, I am doing a user/password verification in java and I need to perform a query in which check in the database there is a login and a password related to the typed in jTextFields. But I’m not…
-
3
votes2
answers251
viewsMap.Keyset() method does not return all keys
Friends, I have a problem and I can’t identify the cause. I have a property file here. I’m reading it normally but when will I get all his keys by the method Map.keySet() not all keys are being…
-
3
votes2
answers526
viewsI cannot install Tomcat and do not receive message when accessing localhost:8080
I’m starting with Java. I downloaded the e-book and started reading. I’m paralyzed, I can’t complete the installation of Tomcat. I downloaded into http://tomcat.apache.org. On the "Tomcat 8.0.20…
-
3
votes1
answer185
viewsWhat is Context and Generated Keys?
I’d like to know what exactly context class connection (I’ve seen methods in relation to this like getConnectionFromContext, or something like that) and Generated Keys as the Preparedstatment…
-
3
votes1
answer87
viewsCommunication between JAVA reporting software and main PHP software
I thought a lot if I would open the question or not (it may be out of scope or broad or based on opinions), but as I am with many doubts regarding the use of a correct structure and that meets my…
-
3
votes1
answer1145
viewsNetbeans + Github = git-receive-pack not permitted
I am using git to take control of a college project, we are using netbeans+eclipse and a friend who participates in the project sent me the git link, I cloned the project, but I can’t push in…
-
3
votes2
answers376
viewsPinch android zoom
Personal my problem is the second. I need to enlarge a ImageView with that movement of forceps well known, but I’m already in the third day researching on the internet how to do and banging the…
-
3
votes1
answer4660
viewsForeign keys in java
I’m having a little trouble implementing the foreign keys in my example. Can someone help me assemble the DAO class? Cidadedao.java public class CidadeDAO { private final Connection connection;…
-
3
votes2
answers1093
viewsWhat allows Java to find out which is the main class in a . jar
How Java Does to Figure Out Which Main Class in a File .jar
-
3
votes1
answer356
viewsMinimizar + Sytemtray
People are wanting that when clicking to minimize the program, its icon is next to the clock. I created a button that does this action. I confess that I didn’t do it, but the author helped me a lot.…
-
3
votes1
answer58
viewsJtree: Why does she lose focus when I edit a knot?
I am developing a PJC (Oracle Forms) component. I’m making a bean with a jtree inside it. In a standard java application, it works well, but in PJC there is a strange behavior with the focus. When I…
-
3
votes1
answer427
viewsProblem with Spring MVC + javascript
I have a problem related to Spring MVC and javascript/Jquery. Well I have a jsp with a form and I needed to do a test where when clicking a button jquery clears the text of some "input type='Text'".…
-
3
votes1
answer1776
viewsUnit test/ Mock of a JPA query
Hello, how do I generate a unit/mock test of a JPA/Criteria query ? What can I guarantee by mocking my objects? Table structure? What should I mock? The consultation is very simple, only one select…
-
3
votes1
answer1989
viewsChange the theme of Activity
I try to change my theme to @android:style/Theme.Holo.Light in Androidmanifest but when the app runs on an emulator it stops working. I followed a video lesson and it’s exactly the same. I don’t…
-
3
votes0
answers124
viewsPass Spring object to JSF
Well, I have a class that is almost entirely populated with Facebook data, but two attributes are missing that have to be filled from data coming from a form. Here is the form:…
-
3
votes1
answer275
viewsGeneral namespace for mapped class
Could someone help me with that question? Based on a Webservice result XML (OBIEE) I generated an XSD in a online converter and with this XSD I managed the class mapped through the command xjc. When…
-
3
votes0
answers32
viewsGAE: Managed Vms - Java 8 Support
[Rant mode on] It’s been a while since the community has been asking Java 8 support in GAE. This month Oracle’s official public support for Java 7 ends. It seems there will be no side changes in GAE…
-
3
votes2
answers2746
viewsHow to recover a string-array item within my Activity layout in the "xml" case?
I created an array of xml strings in my strings.xml folder, now I want to know how to recover a specific item according to its position, both in the Java source code itself and in the XML code...…
-
3
votes1
answer137
viewsEncoding and decoding passwords with character rotation
I have a database with a password field, which has a sort of "encryption". Analyzing the logic: I created users in the system and put the password: 123. When I went to check the password in the bank…
-
3
votes1
answer83
viewsJava input problem
The inputs of my program are overwriting itself. It ignores the first and already Lanca the second straight. System.out.println("Digite o nome do passageiro"); String nome = in.nextLine();…
-
3
votes1
answer398
viewsui:include with JSF rendered does not work the actions
have two ui:include within a template, follow the example below: /*Desse Jeito ele entra nos metodo corretamente!*/ <ui:include src="../home/dados.xhtml"></ui:include> /* com rendered…
-
3
votes1
answer411
viewsJackson - Circular dependency object conversion
Given the classes below, we need to solve the problem of infinite recursion (cyclic dependency) and, for this, we use @Jsonidentityinfo, from Jackson 2+: @JsonIdentityInfo(scope=Parent.class,…
-
3
votes1
answer43
viewsIterator in MVC pattern
I am doing a project and it was asked to build an iterator class. This whole project is being built based on the MVC standard. So what would this Iterator class be and how would I use it? By q I’ve…
-
3
votes1
answer471
viewsIs it possible to run class unit test with inheritance?
I need to do a unit test of PlanilhaReader but this extension ArrayList<String> and override the method contains. Is there any way to execute it? @Component public class PlanilhaReader extends…
-
3
votes2
answers4816
viewsJava, random numbers (no repetition)
I have a doubt in generating numbers without repetition. I can already generate random numbers from 1 to 8 which is my goal. The catch is that it generates repeated numbers (duplicated, triplicate…
javaasked 9 years, 7 months ago insyspower 183 -
3
votes1
answer149
viewsHow to leave space between images?
I have this layout: telainicial.xml <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"…
-
3
votes1
answer136
viewsUse the same getInputStream() for 2 different bufferedReader
I need to access a file on an HTTP server and pull information from two different places inside that file. Right now I can take away just one. My doubt is, I can just do: BufferedReader in = new…
-
3
votes0
answers53
viewsUse vraptor-brutauth in jsps
Expensive, I have a problem that when I put a rule with @GlobalRule, I can’t use it in jsps.. When I just put ${rules} to list the rule map, which has the @GlobalRule does not appear. When shot it…