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
-
0
votes1
answer555
viewsTake position of the arraylist that is in focus in Viewpager
I have an arraylist of images that is shown in a Viewpager, so far so good, this showing all the arraylist normally. But how do I get the Viewpager that’s in focus? That is to take the right…
-
0
votes1
answer568
viewsForm E-mail Validation in JSP
I am trying to validate a form of a JSP through Javascript but I am not able to apply the Script correctly, what I am doing wrong? <%@taglib uri="http://java.sun.com/jstl/core" prefix="c" %>…
-
0
votes0
answers294
viewsReference to objects
To what extent a reference to an object is exactly equal to it? I’ll explain my situation: Within a Adapter, i need to print a particular item in a list. The criterion for coloring that item is in…
-
0
votes1
answer106
viewsError in Embeddedid
I have the composite key below, the problem is that when creating the schema and save the values, Hibernate is reversing the values of TipoContrato with Distribuidora and vice versa. Someone has…
-
0
votes1
answer1359
viewsSomeone knows a library that calculates integral and derivatives in java
I wonder if anyone knows a library that calculates integral and derivatives in java.
-
0
votes0
answers92
viewsIs there a restriction of jsf 2.2.5 with the Collection interface?
I am running an application with jsf 2.2.5. I used the component h:dataTable to display an object collection on the screen. I added this two component h:commandLink, one that must execute an editing…
-
0
votes1
answer254
viewsHow to do a random search using JPQL script in JPA2
The idea is basically to search for an X number of entities persisted randomly, and these entities cannot be repeated. The question is, is there any way to perform this type of search by creating…
-
0
votes1
answer168
viewsfunction that clears the VALUE of the field in JSP
I need to insert in my JSP a function that cleans the input value when the user clicks to enter the value, but I cannot enter class in the input, nor is Placeholder and nor Onclick accepted, could…
-
0
votes1
answer663
viewsError when compiling Android Studio project with Gradle
I’m having a problem compiling my Gradle project. I have the following answer from the compiler: Error:Gradle: Execution failed for task ':mobile:processBroadcastHomologDebugResources'. >…
-
0
votes1
answer4184
viewsHow to get gps coordinates in java on android
What is the best way to get latitude and longitude on android. Ex. after the request (tap the button) the user waits for the gps to get the coordinates and after that displays them for the same.…
-
0
votes2
answers76
viewsStrange page after adding Primefaces
After adding Primefaces dependencies the project ignores my page /home.xhtml that is in xml and shows a url /javax.faces.resource/theme.css.xhtml?ln=primefaces-aristo every time I run the project.…
-
0
votes0
answers697
viewsTable with self relationship
Good morning. I have a table that uses auto-relationship, it turns out that not all names entered have parent, but I can not create a name with null parent, there is not be the first that was…
-
0
votes0
answers152
viewsForm with null values
My Vies is coming with only one null form, while the others are with the correct values here is my view: <h:head> <title>Novo Cliente</title> </h:head> <h:body>…
-
0
votes1
answer158
viewsProblem with Keyevent
I have these two classes: public class ArgentumUI { private JFrame janela; private JPanel painelPrincipal; public static void main(String[] args) { new ArgentumUI().montaTela(); } public void…
-
0
votes0
answers130
viewsIs there any way to change the manifest.mf directly from the eclipse?
Well, I need to set the manifest.mf Class-Path in the eclipse, so that when I Compile it already looks like this, because currently every time I compile I have to change in the jar. is it possible?…
javaasked 9 years, 6 months ago user22408 -
0
votes0
answers378
viewsCall Procedure sql server via JDBC which returns cursor
I am unable to call a Procedure SQL Server in java that returns a cursor. That’s possible, someone has some example ? Through Oracle, through the example:…
-
0
votes1
answer157
viewsWhat is the best way for an Activity to call itself?
The app displays random questions by following as template to QuestionsActivity, that is, the user chooses true or false and will only change the question (textView) and the screen design will…
-
0
votes2
answers89
viewsProblem sending email by app
I’m having trouble making a simple program to make my application send an email. Main public static void main(String[] args) throws EmailException, IOException { ConfiguracaoEmail emailConfig = new…
javaasked 10 years ago Leonardo Kallás 9 -
0
votes1
answer627
viewsHow to get current month with getDisplayName
I intend to get the current month and for that I am using the following code: Calendar calendar = Calendar.getInstance(); String mes = calendar.getDisplayName(Calendar.MONTH, Calendar.LONG,…
-
0
votes1
answer295
viewsHow to add a new Runnable to an Executorservice?
This is the first time I’ve worked with threads... The method below runs every 15 seconds by the EJB. I wanted that if there is SMS list in the bank it add to a new thread triggering these SMS But…
-
0
votes1
answer538
viewsHow to compose a Linear Layout in Activity using JAVA only
In my application has a vertical linear layout with id: @+id/items In this layout for each item contained in a list, I would like to create another horizontal Linear Layout called, Row containing 2…
-
0
votes1
answer88
viewsFetch value from a non-static method of the class itself, in a jfieldtextFocusLost method
I have a method created by me that makes the return of a Boolean: public boolean ValidaNumero() { long valor; if(NIPCC.isFocusable()){ if (NIPCC.getText().length() != 0 ) { try { valor =…
-
0
votes0
answers217
viewsStackoverflow in AVL Trees
The program I am running, intends to simulate a system that counts the passage of cars through gantries, for this the program receives several types of commands and does not end until receiving an…
-
0
votes2
answers2944
viewsHow to use the string created string.xml via code
How to use the string maid strings.xml via code example has how to call <string name="hello_world">Hello world!</string> at some point in the code (Activity).…
-
0
votes1
answer143
viewsHow to return to my Actionbaractivity?
For example, for example... I have an application that has a main Actionbar and I "Seto" an Activity that has a drawerLayout (which has a side menu)... In each menu option -case selected- I replace…
-
0
votes1
answer94
viewsAccessing different Webservices on Android
I have an app that I am developing for my company, that the first part, is to login, going through the webservices, after login, it automatically makes another connection to the webservice that…
-
0
votes0
answers750
viewsWhat’s the best way to queue
Guys, what’s the best way to queue in java. For example I select 3 files, these files stay in a queue until the process of reading and generating the report is finished, as soon as the report is…
-
0
votes1
answer485
viewsHow to insert a String variable into an hql?
I need to make a query in the database and return only the values based on the variable, my code returns the list with all the data of the city field, I want to return only the cities based on the…
-
0
votes1
answer1534
viewsHow to change the text color of Actionbar menu items?
In addition to changing the text of the menu item, how do I change the background of the drop-down menu? In this case, what only appears when you click on the 3 dots.
-
0
votes1
answer67
viewsLoops do not keep values
Hello! I am trying to develop a simple program that does an automatic accounting calculation, however, the condition within the for(while, while, if / Else, either) does not maintain its values. The…
-
0
votes1
answer130
viewsFile . java not found
This is my first time, I made a simple println. My code was exactly: class teste { public static void main(String[] args) { System.out.println("oi"); } } No error appears, but when I go to the…
javaasked 9 years, 5 months ago Henrique Bergs 3 -
0
votes1
answer263
viewsSet of 3 Java ports
I have to do an exercise in Java that consists in creating a matrix [3][3] and each line would be a phase of the game. The user should guess which door the prize is in. For this I need to make a…
-
0
votes1
answer512
viewsJava - random number buttons
I have a new doubt (which is a continuation of my previous question). I have a button (JButton) with the name "shuffle" which is already implemented. I wanted to do the following: when this button…
javaasked 9 years, 5 months ago insyspower 183 -
0
votes2
answers75
viewsWhat is the error in this return exercise: Object orientation
public class Matematica { /* * @param um * @param dois * return o maior dos dois numeros * */ int maior(int um, int dois){ if( um > dois) { …
javaasked 9 years, 11 months ago Leandro Ándreas 19 -
0
votes0
answers53
viewsInsert data into the DB and then change tab
How can I skip to tab after entering data into my database? private void botaoAvancarTab1ActionPerformed(java.awt.event.ActionEvent evt) { String inserirArtigo = ""; String nome = txtNome.getText();…
-
0
votes0
answers88
viewsListview search with custom itemView
I have a listView which has two text fields (nome and local) which are removed from an object Empresa. The examples spread on the Internet only show search in listViews normal with only one string.…
-
0
votes1
answer166
viewsProblem adding an element to a collection at runtime
In this my method I must fill a Collection, regardless of its type public void loadBeanCollectionItems(B bean, Collection collection, JSONArray collectionJson) { for(int index = 0; index <…
-
0
votes2
answers147
viewsHow to save app data to smartphone?
To not depend on internet connection, it is possible to save on mobile data related to the app? For example, when opening for the first time select the language and in the next uses of the app it is…
-
0
votes0
answers67
viewsManipulate Decimal Values in EXCEL + VB
I have an application that provides a webservice(Ws) (java) but I need to carry data to an excel sheet and print, my problem is, when I get Ws values depending on the operating system’s Reginal…
-
0
votes1
answer125
viewsUse of bitmap images in an application
As a trial for the development of a more advanced application, I was trying to make an application that consisted of a button and a component imageView, in such a way that when the imageView a type…
-
0
votes2
answers555
viewsgenerate java artifacts Maven project with Parent on Jenkins
I wonder if someone has already generated package artifacts of a module by the project Parent in Jenkins!? Well, I’ve tried every way I can think of, but so far I’ve only made mistakes! Remembering…
-
0
votes1
answer313
viewsError when trying to open a new Activity
Well, I have the MainActivity which has two buttons, I’m trying to do something simple: When you click one, go to a Activity, when you click on another, go to another Activity. This is the…
-
0
votes1
answer177
viewsproblem with spacing and starting with number
I have an application where there is a screen with an Edittext and a button. when I press the button grabbed the Edittext String game in a column of the Database in the table tables, and then soon…
-
0
votes1
answer71
viewsArraylist adding undue values
I have a ArrayList that should be receiving numbers from 0 to 15, within a for, however it seems that is getting recorded in all indexes the last value 15. ArrayList <PaginaPrincipalSO>…
-
0
votes0
answers366
viewsWebservice Restful Jersey
I am starting the development of Webservice Restful Jersey in Java and I am not able to connect to realize a simple Hello World. I added the jar: asm-3.1jar jersey-core-1.19jar jersey-server-1.19jar…
-
0
votes0
answers46
viewsError while converting Android project to Maven
I created an Android project and right-clicked on the project > Configure > Convert to Maven Project. But soon after doing this the application does not start anymore, it presents the…
-
0
votes1
answer34
viewsError while running this page
import android.app.*; import android.content.*; import android.os.*; import android.util.*; import android.view.*; import android.widget.*; import java.util.*; import org.apache.http.*; import…
-
0
votes1
answer175
viewsProblem retrieving item clicked on Listactivity and return it to previous Activity
I have an Activity where I call another Activity using the startActivityForResult. In the Activity that was called, I have a list filled by products already registered. In this list, I needed to,…
-
0
votes1
answer35
viewsSwingdialog Error Fatal
I am studying Swing with the Java Programmer’s Guide book, and this code does not validate. import javax.swing.*; @SuppressWarnings("serial") public class Main extends JFrame{ public Main() {…
-
0
votes1
answer1988
viewsList returns only last element
Eae guys, after a lot of work I managed to get several xml tags to play in an Excel report. But when I populate the list with my object and step into the report only the last element is listed. I’ve…