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
-
1
votes2
answers51
viewsI am trying to solve an exercise with arrays in java my difficulty is to print the average of odd and odd Indian array
Make a java program do the following: a) Fill the array with the heights of 30 individuals; b) View the array; c) Using the array, calculate and print the average of all the heights in the array’s…
javaasked 3 years, 8 months ago Enoque Tembe 11 -
1
votes1
answer27
viewsDoubt how to display the result using Joptionpane
I’m looking for a program to find part of a string in an array. I just wanted to do it and show it in a window. The way I did it worked, but when I search for "notebook", it generates a window with…
-
1
votes1
answer15
viewsBitmapfactory.decodeByteArray Returning null from Sqlite
I am creating an application that I register a search image from the mobile gallery, saving it in SQLITE, and searching later to show in a view Recycler, however, debugging realized that the bitmap…
-
1
votes0
answers28
viewsDomain Error UNAUTHORIZED_DOMAIN:Domain not whitelisted by project
I am developing an application in which I wish to authenticate (login), via e-mail without password. I didn’t get much current documentation on this, so I took the firebase example itself on github.…
-
1
votes1
answer49
viewsBuilding a Rest api to recover data from a base using spring batch
I am trying to build a Rest api to recover data from a table using spring batch. Below my service Rest: @RequestMapping(method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE +…
-
1
votes0
answers31
viewsProblem passing parameters to a Java controller
I am having a problem trying to pass parameters to any controller, using as example two of my controllers: The controller1 has the following function to navigate to controller2: public void…
-
1
votes2
answers115
viewsHow to send a formatted Zoneddatetime in JSON?
I need to send the following: "tempo": { "inicio": "2019-06-24T20:00-03:00[America/Recife]", "fim": "2019-06-25T00:00-03:00[America/Recife]" } I created the two dates in my pojo: @Data…
-
1
votes1
answer39
viewsError entering data in Sqlite
Hello. I’m having trouble with this personal project. When trying to save a product, Sqlite did not like Price, which is set to float, but when saving in db (which is set to REAL, I even changed to…
-
1
votes2
answers103
viewsMemory organization when there is inheritance
When I declare funcionario as Pessoa in the main(), where the attribute value "goes" to salario, since the class Pessoa does not have that attribute? public abstract class Pessoa { private String…
-
1
votes1
answer204
viewsJava converts accented characters to "strange" characters
I am facing a somewhat strange problem. I have a Mysql database in version 5.6 and a table with field of type longblob that stores a text in compressed HTML format (ZIP). When my website makes a…
-
1
votes1
answer39
viewsError using local time as a condition
This method I use to validate the entry of a student, and it is not running. The idea is to use local time to validate a student’s entry. If he is from high school, can enter only in the hours…
-
1
votes1
answer105
viewsJava Spring Rest does not work with separate packages
Personal my spring Rest application only works when I put the classes(models,controllers) all in the same application class package, this way it works but imagine the disorganization of it !!…
-
1
votes2
answers89
viewsBalancing parentheses, how to check if they are in the correct position?
I’m making a program that takes a string and checks if open parentheses are closed. I have the following code: int abertos = 0, fechados = 0; //conta os parenteses parens =…
-
1
votes1
answer23
viewsSpring Security Override Problem
I’m trying to implement Spring Security...only that I’m having trouble with its configuration, @Override doesn’t work at all, and because of that it doesn’t take the user created in memory, let…
-
1
votes0
answers20
viewsProblem showing and hiding element with JSF and Richfaces
I am trying to use a selectOneRadio, when performing an exchange action should show an element and disappear if it was another option, however, there is no exchange. ***<h:panelGrid…
-
1
votes1
answer52
viewsIs there any way to instantiate an entire class that is within the main class?
public class mainPrime{ public static void main(String[] args) { //----------------------- new mainPrime().instancePrime2(); //------------------------ } public void instancePrime2() { new…
javaasked 3 years, 6 months ago Texy's Randoms 13 -
1
votes1
answer40
viewsCreating matrix with the Scanner class
I’m trying to fill a 5x5 matrix but when I run the ORDER in the finish entry, the code returns me the matrix filled with the word END. public static void main(String[] args) { Scanner sc = new…
-
1
votes0
answers20
viewsHow to use left Join fetch in Criteriabuilder by returning a dto
in the implementation below, in which return a dto built with the entity Lancamento, in which it has uni-directional relationship with category. To avoid the n+1 problem I tried using left Join…
-
1
votes2
answers96
viewsProblem when performing HTTP request on Android
I can make an HTTPS request normally in an app, but it doesn’t work when it’s HTTP. You would have to configure something in Android Studio to be able to make the HTTP request? The code of my class…
-
1
votes1
answer29
viewsThere is [Fromuri] equivalent in Java Spring MVC
In ASPNET MVC, we have the following code snippet that sends information through queryString and is received in an endpoint which has a parameter of type Dtorequest and through the attribute…
-
1
votes0
answers30
viewsDelete some elements from a list and concatenate attributes
Good afternoon, I have a list of Pessoa where class is like this: public class Pessoa { private String nome; private String idade; } I set up the list like this: List<Pessoa> pessoas = new…
-
1
votes1
answer32
viewsSimpledateformat am/pm format returns "afternoon" instead of "PM"
Using a solution to this question: https://stackoverflow.com/questions/6907968/how-to-convert-24-hr-format-time-in-to-12-hr-format In doing the following: Int hour = 13; SimpleDateFormat _24HourSDF…
-
1
votes1
answer72
viewsRegex for a valid YYYY year in java?
I am using these regular expressions for a future date check: Pattern padraoDia = Pattern.compile("([1-9]|0[1-9])|[1-2][0-9]|3[0-1]"); Pattern padraoMes = Pattern.compile("(0[1-9]|[1-9])|1[0-2]");…
-
1
votes1
answer23
viewsSpring boot application.properties problem
This is my application.properties file. ############################################################################### # PORTA…
-
0
votes1
answer260
viewsDetected an untreated exception. Generated code: [68MJGTMV] and [XJEL5QC6] - Expected exception
Caught an unhandled Exception. Generated code: [68MJGTMV]: javax.faces.Facesexception: #{classeBean.save()}: I checked the specified class that expect an Exception value, but it doesn’t. The problem…
-
0
votes2
answers653
viewsHow to increase the width of a Jcombobox?
How do I increase the width of a JComboBox in Java? The layout I’m using is as follows:: setLayout(new FlowLayout(FlowLayout.LEFT));
-
0
votes2
answers596
viewsHow do I know if the user really wants to come back, when click the back button of the phone?
I have a activity which stores certain data, and when the user presses the back button (Avd Hardware Button, for example), the application does not return to the previous screen, but rather open a…
-
0
votes1
answer307
viewsWhy is Activity instantiated twice?
I am implementing the facebook sdk to log in to my application. I have two activities that I call Login and Home. When I click the login button, the login is performed perfectly and the Activity…
-
0
votes1
answer114
viewsCode running in background on Google App Engine
I am making a "website" in GAE Java version to serve as a notifier when a source with results that I am waiting for goes online. You’re supposed to check the link in question every 24 hours. I…
-
0
votes1
answer62
viewsSet construction project JRE input path to 'Javase-1.7'
I am trying to make a connection to Mysql database, but when I use PreparedStatement, eclipse returns: Definir projeto de construção JRE entrada caminho para 'JavaSE-1.7 Yes, I changed the compiler…
-
0
votes1
answer129
viewsQuerydsl with Abstract class
I need to do a query that returns an Abstract object. In this case when my code arrives in ". list()" it launches an Exception, on the other hand, if I use the ". list" but returning an attribute of…
-
0
votes1
answer1030
viewsAutocomplete Jcombobox
I have a JComboBox that the autocomplete is only searching for the beginning of the word and need that when the user type search for any occurrence within the word, which is the way that the…
-
0
votes2
answers183
viewsMake two items in a Listview change position
I’m creating a button called Up, to make an item in the listview go up, while the one above. But I’ve tried everything and it won’t, I don’t know if I’m wrong about logic. But I’ve tried it in two…
-
0
votes1
answer1314
viewsjava.lang.Nullpointerexception on chat system
I am doing a chat project Helpdesk with JSF 2.0 and Primefaces, but an error is generated when I try to connect the Attendant or user in chat. In atendente.xhtml and index.xhtml has a form that…
-
0
votes1
answer109
viewsHow to change the style of a vertical group in JGRAPHX?
I am working on a UML project and using JGRAPHX, or mxGraph as you prefer. In this case, when I have a group of vertices, a dotted line is added to mark that that vertex is a group. How can I change…
-
0
votes3
answers2797
viewsHow do I use Actionbaractivity in an application that runs on android 2.2 or higher?
I want to use Action Bar in my application that will run also on devices with Android 2.2 or higher. I know that I must use the Class ActionBarAcitivity, which is the API provided by Google. I’ve…
-
0
votes1
answer879
viewsAdd and remove percentage
On a certain screen I take a value and add 10% on top of that value. 100,00 + 10% = 110,00 I save the final amount (110.00). I’m having difficulty in picking up the final amount (110.00) and taking…
-
0
votes3
answers12987
viewsUsing a hashMap
I have a hashMap and inside it I have an Arraylist. How do I know if an element is in this list via the hashMap? List<Carteira> carteiras = ArrayList<Carteira>();…
javaasked 10 years, 7 months ago Johnatan Dantas 93 -
0
votes3
answers2192
viewsIncompatible date format when importing data from Excel to Mysql (00-00-0000 VS 0000-00-00)
I am trying to import data from an Excel spreadsheet to Mysql, the problem is that I have a column in Excel that dates are in format dd-mm-yyyy and the format accepted by Mysql is yyyy-mm-dd. I want…
-
0
votes1
answer313
viewsError - You must Supply a Resource ID for a Textview
03-17 08:31:32.283: E/ArrayAdapter(1085): You must supply a resource ID for a TextView 03-17 08:31:32.283: D/AndroidRuntime(1085): Shutting down VM 03-17 08:31:32.283: W/dalvikvm(1085): threadid=1:…
-
0
votes1
answer561
viewsJboss stops during JSF 1.2 startup after project conversion to Maven
I have a project running perfectly on Jboss AS 5.1, however that same project was not designed using Maven. This means that the dependency management process is still manual and the build is made by…
-
0
votes1
answer1723
viewssetOnClickListener (Unfortunately Myapplication has stopped)
Whenever I try to use setOnClickListener the application to, I have tried several methods to try to fix this problem, but I could not. the Login button is properly set in R, also in the layout, the…
-
0
votes2
answers3301
viewsHow to "capture" Webservice (XML) data in Java SE?
I am a layman in the subject webservice and need to capture the data of a webservice that returns some little information. The webservice is this:…
-
0
votes4
answers3330
viewsHow to use Asynctask on Android?
I’m trying to get my application to download an XML (RSS Feed) and read your tags to display it on the home screen. But the application closes after downloading before trying to start the method…
-
0
votes1
answer254
viewsIs there such a thing as nhibernate Fluent for java Hibernate?
I know that fluent nhibernate(Hibernate version for . net) uses lambdas and that java just implemented now in version 8. But there is some form of configuration of hibernate of java through code?…
-
0
votes1
answer400
viewsOverwrite Primary Hibernate Key Generator
I would like to know if you can overwrite the generator of a primary key in Hibernate, in my case I make a superior class where the id, and the rest extend from her. In my case this subclass, which…
-
0
votes2
answers2314
viewsThe method openOrCreateDatabase(String, int, null) is Undefined for the type Bancodedados
I’m having trouble creating a class that creates and manipulates the database! But in the method criar() gave a problem saying that "The method openOrCreateDatabase(String, int, null) is Undefined…
-
0
votes2
answers2156
viewsEclipse Startup Problem
I just downloaded Eclipse (because I will handle Android development), but when trying to open appears the message below. JRE is installed on my machine as I can use Netbeans normally without…
-
0
votes1
answer344
viewsJsoup in Android
I’m having trouble running my Android application with Jsoup. It’s a simple example, but it’s returning nothing. Java class: import java.io.IOException; import org.jsoup.Jsoup; import…
-
0
votes1
answer1009
viewsRead text file via HTTP
I’m creating an app for Android with Android Studio and I’m having trouble reading a text file that is hosted on the Internet. Whenever I try to execute the method checkVersion() it returns the…