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
votes2
answers397
viewsRename large mass of files
I am trying to create a java script to rename a large amount of files by applying a pattern in formatting that would be: First letter uppercase and rest lowercase. Compound names with more than one…
-
2
votes2
answers51
viewsHow to inform data in a vector
I’m not getting to report 10 student grades. import java.util.Scanner; public class exer { public static void main(String[] args){ Scanner scn = new Scanner(System.in); double[] N = new double[10];…
-
2
votes1
answer77
viewsHow to tell whom a class will extend at runtime?
I have the class public class Conhecimento{} This class extends from another class "Cteproc" Only this Cteproc class has "versions" example. V200.Cteproc V300.Cteproc My problem is that in creating…
-
2
votes2
answers405
viewsError sending email using Javamail
Could someone help me fix this error? I can’t send the email to the inbox. Follow the code below: @Service public class EnvioEmailServicoImpl implements EnvioEmailServico { @Override public void…
javaasked 9 years ago Marquin Ferreira 362 -
2
votes1
answer51
viewsHow to catch serial fields with Javafx reflecition API?
I have a form with several Checkboxs, which I named C1, C2, C3, C4, C5...until C66. So: @FXML private CheckBox c1; @FXML private CheckBox c2; . . . @FXML private CheckBox c66; Now I want to do an…
-
2
votes1
answer1118
viewsOpen new window from button
I want to create a new window when the user clicks on a particular button, while that new window is open, the main window cannot be used. How can I do this in JAVAFX? I thought to make the following…
-
2
votes1
answer364
viewsProblem Keypressed Javafx
I wanted to fire an event by pressing the F12 button, but I’m not able to make it fire any action even having created it in code. Here is an example below. F12.setOnKeyPressed(event -> {…
-
2
votes1
answer464
viewsSearching for documents with mongoDB
I am using mongoDB 3.2 with Java. You can save a mongoDB query to a list of objects in a class of mine? I want to save the query directly on a list of people. class Pessoa{ String nome; Date…
-
2
votes1
answer8352
viewsHow to catch the current date on Android?
I am developing an application and need to pick up the current date only, I used the Date data = new Date(); only it doesn’t work. I tried localdatetime also more was not, someone has some…
-
2
votes1
answer982
viewsTwo GIT Projects
If I have a project already being done in git and at some point I need to unite with another project but keep the histories of commit has as?
-
2
votes1
answer224
viewsDoubt about the functioning of the Audiorecord class
I’m a beginner and I was trying to understand how to record an audio using android and how it processes this audio. And during the searches I found this site:Audio Record The example works…
-
2
votes1
answer220
viewsService Discovery Eureka Netflix
I have an architecture SOA with two stacks different with java and other with ruby, I have a microservice using spring boot and other Rails, and I’m trying to set up a Discovery Service with Eureka…
-
2
votes2
answers96
viewsSave a page from an Htmlpage (java)
I have a method that generates an Htmlpage, I would like to save to disk. public void gerarPaginaIndex() { try { final HtmlPage paginaIndex = WebClientFactory.getInstance().getPage(URL_INICIAL);…
-
2
votes3
answers1110
viewsMultidimensional array of different types
I have a view in my application database where I account for the user’s name, his sector and the total number of records issued (another table’s count): Table(View) Totalporusuario Columns:…
-
2
votes2
answers98
viewsEclipse creating getter with prefix is
I created the methods using the Eclipse Getters and Setters command, but when creating the Boolean attribute getter status, it was automatically created as isStatus. It should not be created as…
-
2
votes1
answer482
viewsHow to insert icons in JSF?
In a registration form I have to insert edit and remove icons in a form made in JSF. <h:commandLink action="#{clienteController.editar}">Editar…
-
2
votes0
answers108
viewsPlugin Execution not covered by Lifecycle Configuration
I have implemented unit tests in my application using Jasmine and I want to configure a continuous integration in Maven so that the tests run automatically. Already working, however an error is…
-
2
votes1
answer1978
viewsJava regular expression (validating password)
I need a regular expression to validate the following password: The password must contain at least one element of each: More than 6 characters; Upper and lower case letters; Numbers; Special…
-
2
votes2
answers1031
viewsEvent click button
I add a few buttons like this: JButton bt; for(int i = 0; i <= 10; i++){ bt = new JButton("BT : " + i); bt.setPreferredSize(new Dimension(80, 80)); bt.addActionListener(new ActionListener() {…
-
2
votes1
answer797
viewsOrder of class initialization/instantiation
class Bird { { System.out.print("b1 "); } public Bird() { System.out.print("b2 "); } } class Raptor extends Bird { static { System.out.print("r1 "); } public Raptor() { System.out.print("r2 "); } {…
-
2
votes0
answers48
viewsProblems with HTTP Response
I’m studying the use of sockets and multithreading to mount an HTTP server in Java, but I’m going through some complications. When I run the server code, it opens correctly in Internet Explorer, but…
-
2
votes1
answer461
viewsIn java, a Void that sums, returns value?
My doubt is about what exactly is a java return. Because I think the sum answer would be a kind of return, this is correct? void soma (int a, int b) { int s = a + b; System.out.println (s); }…
-
2
votes1
answer576
viewsHow does content-type work in java?
I saw a video of a guy wearing the connection.setRequestProperty("content-type", "aplication/x-www-urlencoded"); But I don’t understand how it works, especially the "aplication/x-www-urlencoded".…
-
2
votes0
answers101
viewsHow to open a PDF using Totalcross?
In my application made in Totalcross, I make a call REST and the same returns a byte[] where I convert it to a PDF and save it to a specific directory within the device. In this flow, everything is…
-
2
votes1
answer205
viewsReason for Incompatibleclasschangeerror
I recently noticed some error messages in my code, the message that appears is this: Exception in thread "Thread-3" java.lang.Incompatibleclasschangeerror The strange thing is that it only happens…
-
2
votes2
answers2499
views -
2
votes1
answer1148
viewsHow to call different methods in different Switch Case conditions?
I have this code, and I’d like to know how to call a method from the switch...case. public static void opcoes(){ System.out.println("Selecione o Algoritmo de Substituicao Desejado");…
-
2
votes1
answer174
viewsJava window size
When I open the project in Javafx in Windows OS, it opens right, but when I open the same project in Mac Retina, it opens with another dimension, the windows are all misaligned and I have to fix in…
-
2
votes1
answer87
viewsAuthentication in different databases
Hello, I am developing a web service (in java) of integration in different databases and I ended up falling into a problem in which I am not finding a solution. Queries are entered manually and will…
-
2
votes1
answer246
viewsError 400 when creating Inputstreamreader for URL with spaces or accents
Hello, I have a problem when I use Inputstreamreader to read some Urls that contain spaces or accents. What happens is that I am reading a URL that contains a JSON (one of the League of Legends…
-
2
votes2
answers81
viewsDoubt between block and statement
In that question, what would be the right answer? How Many statements are there in the code Below? Warning: This is a Tricky one. The code is Valid. { println("Step 2"); { println("Step 2a"); {…
-
2
votes1
answer496
viewsHow to find out if an Imageview has an informed photo
Hello, I want to create a condition that checks whether all the fields on the screen were informed by the user or not. If any have not been informed, I would like to present a Toast showing error.…
-
2
votes1
answer630
viewsHow to restrict the values of a date in a field of a java form?
I have a form built with Swing (Java) that has some fields, among them there is one that is the Date of Birth (a String that receives the value of a date and has a formatted field ##/##/####.) which…
-
2
votes1
answer484
viewsEclipse error
I installed and configured java jdk 9.0.1 and also the eclipse as java ide,no eclipse when I create the project gives me error soon and as soon as I start writing "System.out.println" this error…
-
2
votes2
answers1712
viewsHow to name a Hibernate/JPA Constraint?
Using the class: @Entity public class Pessoa{ @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long idPessoa; @Column(nullable=false, unique = true) private String nome; @OneToOne…
-
2
votes1
answer182
viewsProblem storing java object in file
When I try to store an object in a binary file, the file with the extension .bin is created. However, when I try to access it by another class, it doesn’t even try to open the file .bin that I…
-
2
votes1
answer286
viewsInstantiate annotated class with Hibernate inheritance using CDI
Good afternoon, I’m creating a project using JSF, CDI, Bootstrap and Hibernate. I would like to know how to work with the following problem, I have created a set of classes to represent a person…
-
2
votes2
answers538
viewsException in thread "main" java.lang.Unsupportedoperationexception
Predicate is a functional interface that allows to test objects of a given type. Given a Predicate, the removeIf will remove all elements that return true to that predicate. When trying to use the…
-
2
votes2
answers397
viewsEdittext Spacing Help
I can’t get a hold of Edittexts on my project. the amount of Edittexts are generated according to the amount informed by the user, that is, it was programmed in the Java Code.…
-
2
votes1
answer722
viewsAdd values within the Two-Dimensional Matrix from the line the user chooses
In the exercise I had to create a two-dimensional matrix and then when the user typed 0, 1 or 2 to know the matrix line, I should add the line values and show the result. I wonder if inside the…
-
2
votes0
answers40
viewsglClear emulator:416 GL err 0x506
When I try to run the app in Android Studio to see the preview of how this error is getting, I’ve tried to use another emulator , even different from the Nexus api…
-
2
votes1
answer229
viewsRemove an Imageview
Is there any way to remove an image in a Imageview or leave it empty via code? For example: I "Seto" img1.setImageResource(R.drawable.icon_circpreto); It has how to remove it via code?…
-
2
votes1
answer898
viewsRemove Jpanel from view
I would like to know how to remove one JPanel that is inside a JFrame. I don’t want to use the information or anything, I just want it to close. Use setVisible(false) makes the panel invisible, I…
-
2
votes1
answer1282
viewsLoops based on a flowchart
How do I write the code for a loop based on this flowchart? It has a do...while. Peeciso of a simple and direct response with nested loops.…
-
2
votes2
answers191
viewsWhat is the best way to sort lists in Java?
I have a list, for example: I want to know how best to sort that list by name and age respectively. public class Pessoa{ private String nome; private int idade; // gets e sets omitidos } public…
javaasked 7 years, 4 months ago Luis Antonio 31 -
2
votes0
answers92
viewserr_too_many_redirects only in production environment
I have an app that pays some employees. On the screen it comes selected from the current month, not to need to select, but if you have mtos data on screen it while processing brings "The…
-
2
votes1
answer33
viewsatOffset using map
private OffsetDateTime getDataDistribuicao() { return Optional.ofNullable(this.getPaginaInfoGerais()) .map(page -> page.<HtmlTableCell>getFirstByXPath(XPATH_CEL_DATA_DISTRIBUICAO))…
-
2
votes1
answer367
viewsMysql - Foreign key in ON DELETE NO ACTION but runs ON DELETE CASCADE
I’m developing a system using Apache, Hibernate e MySQL. But I’m having a problem during the exclusion of parent entries from a foreign key. The database should prevent deletion, but delete the…
-
2
votes1
answer790
viewsWhat is the best way to work with java queues?
In which scenarios is a queue required? What is the advantage of using this algorithm?
-
2
votes1
answer561
viewsFormula Excel - Apache POI
I created an excel file using the Apache Poi API, in it I set one of the cells with a formula, but when I open the file I need to "enter" the cell with the formula so that it prints the result in…