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
-
2
votes1
answer347
viewsValidate with object Annotations within a method
I have a Javabean with several attributes that need to be validated. It has an attribute of type Enum, and according to the value of that attribute, the object needs some specific validations, and…
-
2
votes1
answer226
viewsNetbeans Java Error: "error: Diamond Operator is not supported in -source 1.5"
I’m trying to use a List of Lists in Java in Netbeans for the first time: List<List<String>> listao = new ArrayList<>(); But it presents a compilation error on the line where I…
-
2
votes2
answers156
viewsCalling an internal class method from outside
I have a class B and in that class I need to call a method, getSomething(type, option), which is defined in a class A which is a class which extends AsyncTask and which is within Class C. My Class C…
-
2
votes1
answer163
viewsJAVACV with Ma Ven?
I made the JAVACV clone https://github.com/bytedeco/javacv I’m trying to run the project build: clean install But when I run I find the following error: Exception in thread "main"…
-
2
votes2
answers79
viewsAndroid - How to access an Activity through a Papplet?
I have a class with extends PApplet and I want to migrate from it to another with extends Activity I tried through a Intent but I couldn’t. Body of the Papplet class: public class CamMain extends…
-
2
votes2
answers1011
viewsProblem running project - Special characters
Good afternoon, I migrated my project to Intellij IDEA and when executing a code that should print an accentuated string, I got the return: "m? all" (method). Classes display the accent correctly…
-
2
votes1
answer163
viewsJSP for developers . NET
I’m a developer . NET who needs to understand a bug that occurs in a JSP application. (I don’t need to compile or fix, just understand how it is using the database and etc.) I already have Eclipse,…
-
2
votes1
answer57
views'mvn clean Compile package' runs Phase Compiler 2 times?
Once if I run mvn clean package i know that consequently will run all phases of the default Lifecycle from Maven prior to package (Compile, test, package), so it is: calling for mvn clean Compile…
-
2
votes1
answer341
viewsCustom Spinner showing Resource and non-text
I’m having trouble setting up a custom spinner in my application. Follow below picture of how it appears: Follows my code: Java adapter. public class ProfissionalCategoriaAdapter extends…
-
2
votes1
answer235
viewsTransaction control between two different applications
I am working on an application that is divided into two modules, each one in a language (.NET and Java). Application A (.NET) will manipulate the records of a table while application B (Java) will…
-
2
votes1
answer989
viewsCamera problems: Fail to connect to camera service
I have a problem in my application that uses the camera of a device. However, whenever I try to use the Camera.open() he makes an exception java.lang.RuntimeException: Fail to connect to camera…
-
2
votes1
answer817
viewsJava threaded timer
Good night, you guys! I am developing a multithread client/server system. Multiple clients connect and when they send the string "Ocupada" 3 times, the code leaves the while, starts the time count…
-
2
votes1
answer1096
viewsApply Mask to Java back-end
Does anyone know how to include a mask from a regex in a string? For example, I own the following regexString pattern = "\\d{2}[/]\\d{3}.\\d{3}[/]\\d{4}";and a variable with the following value…
-
2
votes2
answers836
viewsJSF - How to pass a Bean function as an argument to a Javascript function?
I’d like your help. I am developing a system in JSF, and I have the following need: I would like to pass a bean function as an argument from a function of mine in JS, so that I certain future moment…
-
2
votes2
answers116
viewsWord problem with same letters
I’m solving a problem where I get one array of strings with different words, I have to find out for each word (string) which are your friends. Friendly words are those that have the same letters in…
-
2
votes1
answer726
viewsIt is possible to create a list of generic Object
I need to generate a generic list List<?> listaGenerica; having as parameter a string with the class path, as shown below. Class class = Class.forName("com.teste.Endereco"); That’s possible?…
-
2
votes0
answers136
viewsModify Joptionpane
People, I’m customizing my swing components, is there any way to modify Joptionpane? so that I was quite different ? ex: remove the titlebar and the close option etc...…
javaasked 6 years, 2 months ago Luca Henrique 21 -
2
votes1
answer128
viewsHow to create video through an image sequence?
I want to create a video using a image set of the same type and size. I researched some examples but did not succeed in performing the algorithm. Of the examples, this link was the most complete:…
-
2
votes0
answers155
viewsOne table is not being created - JPA/Hibernate with Mysql
I’m having a problem running my test class: import javax.persistence.EntityManager; import br.com.teste.jpa.c_mapeamento.model.Conta; public class PopulaConta { public static void main(String[]…
-
2
votes1
answer203
viewsError while removing Object from Arraylist
When I try to remove a int of arrayList he simply of error. Code: ArrayList<Integer> colors = new ArrayList<>(); colors.add(Color.rgb(119, 103, 141)); colors.add(Color.rgb(33, 10, 208));…
-
2
votes2
answers2915
viewsCompare dates using Localdate
I need to make a comparison of dates as follows: dat_envio_shopping + 2 dias úteis < [data hoje] Until then I have done so: boletoSerasa.getEnvio().isBefore(LocalDate.now()) My question is in…
-
2
votes6
answers3996
viewsCheck if Edittext is empty
Hello guys I’m making an app on android studio but I don’t know exactly how to check if the text fields are empty, I tried the following solution in the code below : public class MainActivity…
-
2
votes0
answers20
viewsError with Commons Mail "Sending the email to the following server failed : smtp.googlemail.com:465"
Hello. I’m trying to send an email through java and I’m using Commons-mail and javamail for this. Más está dando erro... It follows method. I already changed the .." Allow less secure apps" in gmail…
-
2
votes1
answer1905
viewsSet the shortest path in graphs
Hello, I’m starting to see graphs now, I’m trying to create a program where the user enters with an adjacency matrix and the program calculates the shortest possible path from the initial node to…
-
2
votes1
answer58
viewsHold the image and send to link in Android Studio
Hold the image and send to link in Android Studio I use an Imageview that when I click performs a function, but I would like when the image was pressed, another action was done, which would be…
java android android-studio android-activity android-eclipseasked 6 years, 2 months ago Deodoro Júnior 21 -
2
votes3
answers131
viewsMultiple query values with JPA/Sprint and Rest
Good morning, I need to make a query via REST where multiple ID will be sent for example (ID: 1, ID: 2, ID:3, etc). To search only for an ID I use findById(codigo), but I don’t know how to use…
-
2
votes0
answers545
viewsHelp with java RMI, how to use the rebind method and lookup with the client class?
I’m doing a job in college where I feel lost. I don’t know how to indicate the server with the method rebind and make lookup with the customer class. I wish you could look at the code I’m writing to…
-
2
votes1
answer757
viewsConfigure the spreadsheet created by java with jxl
I am developing an application that generates an excel spreadsheet with data collected from other files, for this I am using jxl, the application is already generating the spreadsheet correctly, but…
-
2
votes1
answer1207
viewsHow to concatenate variable names in Java
I’m having a question. I’m wanting to generate a total of variables, from a for, to not have to write all of them, but I’m not able to concatenate the names of variables. I’m trying this way:…
-
2
votes1
answer72
viewsHow to make my image appear inside the ui:repeat tag?
I have a question. I am using JSF and Primefaces to make a website for ebooks and need to display the ebooks that are stored in the database. I can register the ebook normally, but when it comes to…
-
2
votes1
answer250
viewsApply Syntheticablackeyelookandfeel to the application
I would like to know how I can apply new look and Feels that are not part of JDK. In trying to apply, is giving an error in which I did not find an answer that could solve the problem. For example:…
-
2
votes1
answer221
viewsCall methods and catch exception
I created three classes, an abstract class called Form, a class Retangulo extending Forma and a class programa, containing the method Main. My intention is in the "program" class to receive the…
-
2
votes1
answer312
viewsNosuchelementexception error when executing application
I wrote a simple code in the online java ide (follows code below): import java.util.Scanner; public class HelloWorld { public static void main(String[] args) { String nome = "Filipe"; final double…
javaasked 8 years, 3 months ago Filipe Teixeira 37 -
2
votes1
answer384
viewsWhat happens internally when running a Spring Boot application?
Recently I have been studying Spring Boot, I wanted to know what happens internally when an application is started, because every project has a main class that is always noted with…
-
2
votes1
answer104
viewsDo not allow date 50 years back in the database
I have a JSF system and Primefaces 4.0 and I have a field <p: calendar> in which I did the treatment to not load dates in the current day Calendar up to -50 years. But still the user can type…
-
2
votes1
answer103
viewsHow to set a string coming from a sqlite database to display in a Textview?
I’m trying to display a string value in a textview via a query in sqlite, but when I run the code a numeric log of the Android sqlite class is displayed randomly. I’m just trying to display the…
-
2
votes2
answers80
viewsButton does not work when code is added to Abstracttablemodel
I created a test project to implement in a larger table project with a button as one of the row elements. It works perfectly, but when I try to add to my code the button does not perform the action…
-
2
votes1
answer794
viewsWhich Scene Builder container can I use to make my desktop application responsive?
I’m starting to study Javafx and I have a question. Which Scene Builder container can I use to make my desktop application be responsive? The only container that came close to what I wanted was…
-
2
votes2
answers2921
viewsHow to resolve JPA Hibernate error
You can help me with this mistake? Exception in thread "main" javax.persistence.PersistenceException: No Persistence provider for EntityManager named bsewebservicePU at…
-
2
votes2
answers65
viewsHow to capture the action of a click on a title that is inside a container and that container is inside a scrollContainer?
How to capture the action of a click on a title that is inside a container and that container is inside a scrollContainer? public void onEvent(Event e) { if(e.type == ControlEvent.PRESSED &&…
-
2
votes1
answer200
viewsArray to Arraylist conversion difference with "asList" and constructor
What is the difference between these two ways of converting a array? If there is any difference, the same impact on performance? List<String> list = Arrays.asList(meuArray);…
-
2
votes0
answers80
viewsCDI Beans inside . jar file are not found by container (Unsatisfied dependencies)
I created a Java project to lib other projects, decreasing code duplicity between projects. This lib project is exported to jar to be included in Web projects. In the Web projects (from which these…
-
2
votes2
answers186
viewsRemove item from a collection
Why is it considered incorrect to remove an object from a collection in this way? And why the exception launch ConcurrentModificationException? for(String item: list) { list.remove(item); }…
-
2
votes1
answer404
viewsJava error "constructor 'X' in class 'X' cannot be Applied to Given types;"
When compiling the code below I get the following error: Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException: Uncompilable source code - Erroneous sym type:…
-
2
votes0
answers343
viewsJasperprint Ireport
Why the following statement runs on Windows and not linux? JasperPrintManager.printReport(relatorio, true); In the window open the printer dialog, but under Linux show the next error:…
-
2
votes1
answer44
viewsI cannot update my dialog via commandLink on a datatable
My goal is to display the selected element in the datatable in the dialog, but I can’t update my dialog via commandLink, whenever I try, the application screen gets all messy and this error happens:…
-
2
votes1
answer397
views@Onetomany without Primary Key
There is the possibility of making a relationship @OneToMany without Primary Key on the daughter table? Follow my two entities. Entity Noticia: @Entity @Table(name = "NOTICIA") @NamedQueries({…
-
2
votes1
answer474
viewsError when converting XML to Object using Xstream
I simulated in a smaller project the same error you are presenting in my original project to make the problem clearer. Follow Code and Error Log. Xmlconverter import…
-
2
votes1
answer139
viewsTake view position on the screen and apply in another view
I’m trying to make a transition effect when I open a DialogFragment but for that I need the photo(CircleImageView) of DialogFragment is in the same place as the photo of Activity which opens it. If…
-
2
votes1
answer65
viewsAdding an object to a collection returns "cannot be cast to java.lang.Comparable"
The code is this: public class Catalogo { SortedSet<Produto> lProdutos = new TreeSet(); public void addProduto(int cod, String desc, float preco){ try{ Produto p = new Produto(cod, desc,…