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
answer188
viewsRefactoring for Spring Data returning List<Object[]>
I came across a project where I have several methods in Repository of this kind: @Query(value = "SELECT " + " i.uf, " + " i.cidade " + "FROM Imovel AS i " + "WHERE i.ativo = 'Sim' AND " + " EXISTS…
-
0
votes1
answer34
viewsCode redundancy in my . xhtml JSF - Primefaces
I have this table in 2 pages of my own and I ended up copying and pasting this code, the only thing I had to change was the "bean", in one I used "bean1", in the other I used "bean2". Is there a…
-
0
votes1
answer221
viewsToggle Tabs in Viewpager via the Fragment button
I wonder if there is any way to switch between tabs by the Ragment itself. I have a Viewpager with 2 tabs and I would like to switch via buttons because I validate some fields before switching tabs.…
-
0
votes0
answers89
viewsProblem with Hibernate and Wildfly server
Hello. I have a project with Hibernate 4.3.x + Postgresql + Wildfly. But I can’t run it. Follow the error: Iniciando WildFly Application Server WildFly Application Server iniciado Implantação…
-
0
votes2
answers36
viewsCreating a custom Writablecomparator class
I’m creating an application to process distributed video in Hadoop using the paradigm map-reduce. I have several videos stored in the cluster and wish from them to create a single video file. For…
-
0
votes1
answer207
viewsCreating Dynamic Jtextpane component
I had a problem with editing labels, that was solved by using the JTextPane. So, I thought of creating my own component of this type, so that I can pass values "dynamically", and writing a few…
-
0
votes1
answer898
viewsCreate a Java WEB application that also runs via desktop
Good night to you all. I’m thinking of developing an application with the following features: Backend: Java Frontend(Option 1): Javafx Frontend(Option 2): HTML5 + CSS3 I want to start the right way,…
-
0
votes1
answer213
viewsUsing database coordinates in google maps API
I’m trying to use in Google Maps, the data that is in a database sqlite, But I’m having trouble accessing the shuttle’s return. I used the same logic to call using the database number and it worked,…
-
0
votes0
answers335
viewsError creating multiple buttons in XML (Android Studio)
I’m creating an Android app that needs to have 20 buttons and each button of this will open a different screen. The application compiles correctly, but when arriving at the screen that has the 20…
-
0
votes1
answer120
viewsI think my table is not being created : no such table?
I am trying to make a check to know if there is something inserted in the table, but it always error in this row saying that there is no such table. my database: package…
-
0
votes1
answer44
viewsFailed to update field of all records with the file path using JDBC
I am migrating pdf files stored in the database to file systems. In the code as can be seen below, I use an algorithm that generates the name of the files and saves them in a directory generated…
-
0
votes1
answer37
viewsHow to store the last 5 opening dates of an Android activity in a list
public class Activity extends AppCompatActivity { Calendar c = Calendar.getInstance(); SimpleDateFormat sdf = new SimpleDateFormat("dd:MMMM:yyyy HH:mm:ss"); String strDate = sdf.format(c.getTime());…
-
0
votes1
answer83
viewsHow to let my Webview auto restart every 30 m
I wanted to know how to automatically restart my page every 30 minutes in the background. Who can help, thank you. Public class tela2 extends AppCompatActivity implementa tela2 { private Timer t;…
-
0
votes0
answers73
viewsHibernate does not save oneToMany
I have a 1 -> n relationship between Connection and Reporting. The classes are as follows:: @Entity @Table(name = "conexao") public class Conexao { @Id @GeneratedValue(strategy =…
-
0
votes2
answers221
viewsBoot Block
I’m studying for certification. The book says that the declaration order of attributes and initialization blocks should be considered. Scenario #1: while doing so: public class Teste { {…
javaasked 7 years, 2 months ago igventurelli 4,441 -
0
votes0
answers288
viewsJavamail How to change the sender’s email address?
I am making use of a very basic code for sending e-mail and I am noticing that the sender’s address differs from the one that was passed, and in the place this the email account address. I am making…
-
0
votes1
answer220
viewsError generating report with parameter id
I am making a small system to print a budget by passing the id as parameter. The following situation occurs; By netbeans step id when prompted and normal report appears. But when I do generate the…
-
0
votes1
answer193
viewsReport one object at a time with Jaspersoft Studio
I have a system of loose notes in jsf and primefaces. I was able to generate a set report of several notes at the same time, searching through two input parameters, initial date and final date. But…
-
0
votes1
answer1355
viewsMDI Javafx Window: how to make an Anchorpane responsive to Anchorpane Parent
I want to know how to make my Anchorpane internal responsive example: i have a main screen and on this main screen has a configuration button. When I click this button, opens another Anchorpane…
-
0
votes0
answers578
viewsNumerical recursive sequence in Java
I need to do a numerical sequence in recursive mode that, after arriving at the n number (5, in the example), starts to do the inverse sequence. Example: 1234554321 I’ve done what the normal…
-
0
votes1
answer76
viewsMethod malfunction Remove at position defined in Dynamic List
The following method performs a removal of an element at a pre-defined position in the test class but appears not to be working even if there are no syntax errors and errors in the teacher’s test.…
-
0
votes1
answer65
viewsImage does not update
I’m making an application where I use a Jfilechooser to choose an image, I take this image and copy it to a network folder. After that it executes a method that shows this saved image in a Label,…
-
0
votes1
answer250
viewsCalling element of one method in another method
When I run the program, in the method "exibirVetores(int[] vet, int[] vetInvertida)", as Strings "inverted" and "normal" are empty (null). public class metodos02 { public static Scanner sc = new…
-
0
votes1
answer1270
viewsHow to find position of occurrence of a String in a JAVA file?
I am having to implement a work for the college, where I need to read a text file, word for word, save them in a hash table and then, according to other words read in a second file, report the…
-
0
votes2
answers60
viewsProblem with inifnito loop Randomaccessfile
I am using this code to read a text file using the RandomAccessFile, character by character, and generating a string for each word formed, to save to a Hashmap. I need to use the RandomAccessFile…
-
0
votes1
answer101
viewsError in the interlayer method elements with Mergesort in a List<Integer>
This part of the algorithm has the function of bridging the elements of a List<Integer> (list of normal integers) using the Mergesort sorting algorithm. ERROR ON LINE 7 private static List…
-
0
votes3
answers422
viewsAllow only integers in a Jtable column
Below I have a model of Jtable. There is only one editable column for number (seconds). How to validate to accept only integers, and in case the user enters anything else except integer, return…
-
0
votes2
answers1220
views"Expression expected" error
I took it that code which to some extent worked. But the method updateLabel I can’t do it because of the problem: I need to get the selected calendar date. I’m using a way that by clicking on…
-
0
votes1
answer35
viewsIn the java folder I have three subfolder, is that normal?
I’m having trouble with: java/lang/Noclassdeffounderror : java/lang/Object. I’ve already done a lot of things that colleagues asked for and nothing. I updated PATH and JAVA_HOME and nothing. My…
-
0
votes2
answers154
viewsChange variable value within anonymous class
I would like to know why whenever within an anonymous class I try to change the value of an "external" variable it does not, change remains the same. There would be something similar that I could do…
-
0
votes3
answers421
viewsError passing from String to float and from float to String
I have a code that adds certain values to a list of Strings but it seems that when I convert them to float later to String again they are not added! What’s the matter ? Code in which they are added…
-
0
votes1
answer20
viewsBecause my countdowntimer treats the received time according to the mobile
I have a countdowntimer that gets a long value of 86400000 ( 24 hours ) on my emulator android 5.1 it recognizes 24 hours and starts counting since then, but on other emulators and on my physical…
-
0
votes1
answer13197
viewsHow to resolve the following error: HTTP Status 500- Internal Server Error
I am trying to make a web application using java,jsp,Servlets and database. But when I run as in addClient.jsp class this error appears: HTTP Status 500- Internal Server Error. I have looked on the…
-
0
votes1
answer62
viewsHow do I get the interfacial ad between an Activity and another?
I think I did everything correctly, but the application jumps to the next Activity without appearing anything. public class... private FirebaseAnalytics mFirebaseAnalytics; private AdView adView01;…
-
0
votes1
answer369
viewsHow to know the size of Jframe in the constructor?
I need to adjust the image size to the space provided by jframe. Error: Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: Width (0) and height (0) must be non-zero at…
-
0
votes2
answers1587
viewsClass is Managed, but is not Listed in the persistence.xml file
I’m having a problem that I wasn’t before I migrated to JPA 2.0. Receiving message that all my classees / entities are not listed in persistence.xml and even after adding them I keep getting the…
-
0
votes1
answer48
views -
0
votes1
answer130
viewsHow do I know if a file exists in Storage Firabase?
I’m using Firebase Storage to store a user profile photo, I made a method to search the image and place it in an Imageview. It works very well when the image exists in Firebase, but when it doesn’t…
-
0
votes0
answers390
viewsMaven plugin build error
I use the following plugins to compile and run my web project in Intellij IDEA: pom.xml //Código do pom.xml omitido . . . <dependency> <groupId>javax.servlet</groupId>…
-
0
votes1
answer248
viewsHow to move to the function which imageView was selected and save to Firebase
I have a User Registration Activity where he must fill in some fields( name, gender, age, etc) and two Imageview where the user can place photos of him by clicking on Imageview and selecting them in…
-
0
votes0
answers92
viewsHow to upload web images inside a Listview?
I have a json more or less like this (simplified the original): [{ image:"http://site.com/imagem.png", title:"Titulo", desc: "descrição" }] I would like to upload all the content, including the…
-
0
votes1
answer227
viewsPopular Spinner with firebase data
That’s the code for "Activity Sala" public class CadastroCursoActivity extends AppCompatActivity { private EditText nomeCurso; private ListView lv_Curso; private Toolbar toolbarCurso; private…
-
0
votes0
answers560
viewsJPA with "Detached Entity passed to persist:"
Hello, I have a problem because I use an intermediate table to save the Ids of other 2 tables. Except that the way that Mapeei, I can’t save in this table because apparently JPA understands that I…
-
0
votes1
answer494
viewsProblem implementing JSF Converter with p:selectOneMenu
I’m having problems implementing a convert to a simple selectOneMenu of Primefaces. When you pass the Convert getAsObject method the value parameter comes with the description of what was selected…
-
0
votes2
answers492
viewsString counter in Arraylist
I need the program to return the amount of times each String repeated itself within the ArrayList, but I could not think of a way in which my counter is reused for each item, because as it shows…
-
0
votes1
answer432
viewsArraylist, Collections
I have an exercise list on Arraylist , but only the first question has left me with several doubts : Implement an interface with abstract methods getName, getValor, which should be implemented in…
-
0
votes1
answer34
viewsDependency is not added to clojure project
I’m learning Clojure and created a simple spellchecker project. In this project, I would like to use the Stringutils class from Apache Commons, so I added the following lines of code to import it…
-
0
votes2
answers53
viewsAutomate sequential file opening?
I want to open several binary Java files at once, but I don’t want to instantiate them all manually this way as follows in example. Is there an automatic way, or a method so I can speed this up?…
-
0
votes1
answer1783
viewsHow to delete not only tables but a database in Sqlite
I would like to delete not only a table but the database as a whole in Sqlite. Searching, I was told of a method Context.deleteDatabase(), but I can’t use, if I try to call in a method, it says it’s…
-
0
votes1
answer659
viewsApply data from a txt to Arraylist
I need tips on how to create (where to start, what functions to use, etc). A generic project that receives a file .txt, read the data and store the words in a ArrayList<>. I’ve already created…