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
votes2
answers470
viewsProblems opening connection to JSF and JPA
There’s something wrong with mine persistence.xml? I can’t open the connection. My Bean is like this: import java.util.List; import javax.faces.bean.ManagedBean; import…
-
3
votes1
answer169
viewsAdd classes to software at runtime
Question There is some feature that some language makes available to be able to add at runtime a class to the running software, that is, the software to recognize and thus be able to instantiate…
-
3
votes1
answer280
viewsCrud with simple java REST webservices. Problems with jersey client class
I have this class but it is giving many mistakes do not know what I do today that I try to solve. What I do? package manager.client; import javax.ws.rs.client.Client; import…
-
3
votes1
answer162
viewsError while switching Activity
Good evening, I have an app with two Activity that loads external data, and I’m having trouble changing Activity before it loads all the data.When I call Activity Category, it loads external data,…
-
3
votes2
answers553
viewsKnow how many ports are open in Java program
I have a program in Java to know how many doors are open but I’m not sure where to put the method to count the doors. I can create a method to count open doors within the class Porta? package…
-
3
votes1
answer73
viewsIs it wrong Methods to show something to the user?
Well I’m starting now in the area of Opoo, I saw in a class I’m watching on youtube that it was wrong Methods write something on the screen, and how I would show if something bad happened in a…
-
3
votes0
answers490
viewsExecution error Jasperreport
I have a problem with Jasperreport, I am developing an application for study, where I have a frontend that connects with a db (sqlserver) for registration, queries and reports. In the report part,…
-
3
votes2
answers2076
viewsCurl - Consuming webservice with PHP
I have the following code: $url_data = "http://localhost:8080/sistema/webservice/agenda/consultarHorariosDisponiveis"; $ch = curl_init(); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type:…
-
3
votes1
answer419
viewsInterleaved 2 of 5 Barcode - Increase string size in parameter
Good morning, my friends! I’m having a problem when passing the String with the bar code in the parameter of Barcodeinter25 , In this code is working but if I pass…
javaasked 8 years, 2 months ago Henrique Clerici 41 -
3
votes4
answers1482
viewsHow to change the color of the text in a Jtextpane?
I’m developing a chat and he uses a JTextPane to display messages in different colors for each user. However, I don’t know how to change the colors of the text of this component. Example: We have…
-
3
votes2
answers160
viewsAnnotation @Scheduled Spring check environment
I have a controller annotated with @Scheduled but when the test environment is active it also runs. It is possible to check the environment in which application is running so that the method is run…
-
3
votes1
answer325
viewsUse more than one variable in the same sentence(replace)
In a field I need to replace two words with any other two. Example: Mr(a) v1, the value of your invoice is real v2. As it should be: Mr(a) Joao, the value of your invoice is 10,00 real. So I have…
javaasked 8 years, 2 months ago Wagner Fillio 1,328 -
3
votes2
answers236
viewsHow to find a pattern to maintain the same data modeling between a JSON, POJO, and JPA object?
To facilitate the understanding of my question, follow the following example:: A POJO: public class Person { private String name; private String location; } String JSON: String json = {name:"Jose",…
-
3
votes2
answers112
viewsGrab Scrollpane size when set by anchoring - Javafx
I have a Scrollpane anchored on the 4 sides of an Anchorpane so that when resizing the screen, the scroll also resizes. So I don’t need to specify a fixed size. Until then it works as I want. The…
-
3
votes1
answer115
viewsProblems with Opensessioninviewer + JPA + Tomcat standard
Hello, I am using Tomcat + JPA + Vraptor 4 and I am using cdi to inject Entitymanager as follows. Entitymanagerfactorycreator: public class EntityManagerFactoryCreator { @ApplicationScoped @Produces…
-
3
votes1
answer1903
viewsBreak and Continue on Switch
What’s the difference of using the break and the continue within the switch?
-
3
votes1
answer98
viewsA Different Object with the same Identifier value was already Associated with the Session
When I will edit a reservation I get this error in the console: A Different Object with the same Identifier value was already Associated with the Session : [br.com.blumar.events.model.Route#3883]…
-
3
votes1
answer545
viewsChange Jtextfield value from another class or automatically
I found some similar issues in the English version, but I could not resolve. I have a boiler class, with the following attributes: Boiler temperature; how much; Fire temperature; In this program I…
-
3
votes1
answer384
views -
3
votes1
answer84
views -
3
votes1
answer476
viewsRead JSON and turn it into Java list
I have the following JSON: { "_status": "sucesso", "_dados": [ { "IdIntegracao": "H1xo7lOOX", "SacadoCPFCNPJ": "08896903912", "SacadoEmail": "[email protected]", "SacadoEnderecoNumero": "228",…
-
3
votes0
answers25
viewsApplication does not create file in external memory
I’m using the following code: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_pdftest); Button Btgerar = (Button)…
-
3
votes1
answer1007
viewsHow to solve this Spring Boot problem?
I’m learning to use the Spring Boot, following/adapting this tutorial from the official page, but whenever I try to run, these exceptions and errors appear: Error starting ApplicationContext. To…
-
3
votes3
answers386
viewsUse of the split method
Good morning guys, sorry my ignorance for the simple doubt. I’ll get right to the point. I have a list of alerts List<Alertas> alertas; This list there are several messages sent to some users,…
-
3
votes1
answer374
viewsHibernate, force table name in low box
I am using Hibernate 5.2.1.Final as an implementation to handle Mysql database. The problem is that the tables are being generated with the first letter in high box, would like to force to be all in…
-
3
votes1
answer48
viewsEntitiy framework for JAVA?
Good evening, guys, I’m new to programming. So, I’ve been looking at some articles and watching videos about the Entity framework for C #, I wonder if there are also some frameworks in Java that do…
-
3
votes2
answers138
viewsI am trying to extend Stringrequest from Volley package, but the import is not working, why?
This is the code I use to import. import com.android.volley.Response; import com.android.volley.toolbox.StringRequest; And here below is a print of my screen showing that I’ve installed the Volley…
-
3
votes1
answer2159
viewsHow to generate Timeformatter in YYYY-mm-Ddthh:mm:ss-TZ format
I got the string 2018-09-26T10:36:40-03:00 and would like to convert her to LocalDateTime. DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd-MM-yyyy'T'HH:mm:ss'Z'");…
-
3
votes3
answers580
viewsGrab a JAVA array
I am new in java, because of this I have the following situation, I would like to take the array in my case 2 of switch, the problem is that it says the value was not initialized, but I first enter…
-
3
votes1
answer277
viewsDoubt Regex functionality - Java
Could someone explain to me what this Regex allows? private static final String MAIL_PATTERN = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$";…
-
3
votes2
answers169
viewsWhen to use Stringbuilder and Stringbuffer instead of concatenating with "+" operator in Java?
What are the benefits of concatenating a string using StringBuilder or StringBuffer instead of simply using the operator +?
-
3
votes1
answer289
viewsHow to change the Encounter in Java?
I am consuming the IBGE API to get the municipalities by state. When I print the municipalities the accents get wrong. What can I do to fix it? Below the code that takes the name of municipalities.…
javaasked 5 years, 11 months ago Leandro Souza 75 -
3
votes2
answers67
viewsnextInt() after the third integer
Given the example.csv: nome;idade;10;21;32;43;54 I can use the class Scanner to read such a file. Using the method .useDelimiter() and taking advantage of the ; to pick up each value. So I use the…
-
3
votes2
answers588
viewsServlet with JSP does not insert into the database
I am doing my Interdisciplinary Project of the college and would be an e-commerce. Well, I was following the part of entering in the bank for a booklet of the course I did by Caelum, but I do not…
-
3
votes2
answers129
viewsKotlin for Creation and Apis: Only for Android?
I saw some features offered by the Kotlin tool, especially when it comes to saving lines of code and verbosity generated in Java. How is the tool to generate services and be consumed by web…
-
3
votes1
answer295
viewsProbability in data launches
Hey there, you guys! I’m learning to program java and came across two exercises: in the first, I should create a script that simulates a roll of a dice ; in the second, a script that would roll the…
-
3
votes1
answer616
viewsSort array alphabetically and show only first name of each item
I am totally layman in Java, wanted help to finalize an exercise. The statement is this: "write a program that receives an array with the name complete of 10 people and present an array with only…
-
3
votes2
answers249
viewsDo While enters infinite loop
I’m sure my mistake is in while, but I can’t understand what I did wrong. He goes into loop infinite. Follows the statement: Implement a program that receives 3 arguments from the command line. The…
-
3
votes0
answers216
viewsRmiregistry not found
I am programming a simple system, using RMI, to train programming. However I found some problems when creating the file .batch receiving the message on the windows terminal 'rmiregistry' is not…
-
3
votes1
answer335
viewsHow do I keep Look And Feel selected in Jcombobox after the window is closed?
I just created a simple JFrame no Neatbeans with some Look And Feel’s(LAF) available, using a JComboBox for the user to choose the LAF you want, and I also put the "Save" button for Action. I can…
-
3
votes1
answer304
viewsDifferences between Java and Scala
What are the main differences between Java and Scala? Both have these similarities: Both are object oriented Both compile to bytecode and run in the JVM They both have Amble (Java 8)…
-
3
votes1
answer1393
viewsSave.txt file
I’m having difficulties in a code I’ve built. I can’t find the error. My problem is this: I created a code that generates combinations of numbers and that should save these combinations in a file…
-
3
votes2
answers2034
viewsWhy doesn’t Spring boot use Entitymanager?
Some time ago I was studying Java EE with handouts. Wore JSF and Hibernate. Now I’m working with Spring and Hibernate. But different from Java EE, I don’t create any Entitymanager. It is not…
-
3
votes1
answer169
viewsHow to store the returned Strings of the split() method in different variables?
I have the following problem: register a person informing the Name and CPF, in this format "João Medeiros - 123456789-00", and stored in a variable of type String. I used the method split() to…
javaasked 5 years, 8 months ago Diego Kiyoshi 33 -
3
votes1
answer107
views -
3
votes0
answers107
viewsSubreport is not printed
I have a report and I need to use subreports, I can generate the report, but the subreports are being printed blank, as if they had no data XML of the Report <?xml version="1.0"…
-
3
votes1
answer164
viewsManytomany mapping. Bean problem
After doing the Manytomany relationship between tables I don’t know how to save on my bean. I have a class schedule that has one or more lawyers taken care of this term. The lawyer can also be…
-
3
votes1
answer252
viewsArray with dynamic ability and how to invalidate other characters in reading
I did the code below but found 2 problems: The value of the vector is set to 100 and must be the amount of numbers the user wants. Another problem I found is that the statement specifies that there…
-
3
votes1
answer11435
viewsWhat is java.util.Concurrentmodificationexception?
What causes this exception? How to prevent this exception? How to correct it? Example: I have an Arraylist where I keep several films in a table (Jtable) where I remove the films so as not to rent…
-
3
votes1
answer94
viewsStatic reference giving error while accessing
My code is giving a static reference error, what that information means? public class inicio { public static void main(String[] args) { System.out.println(soma(2,2)); } public int soma(int n,int m){…