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
votes2
answers152
viewsHow to make a functional string analysis method?
I am creating an application that simulates a library system, and to begin with, you need to log in by entering a name in the text field. This is the method I created to parse the name (I want only…
-
0
votes0
answers62
viewsWhat is it and how can I use extends and Abstract in a public main?
Hi, I’m a beginner in programming and am currently learning in the game development course. The course teacher couldn’t make it clear to me what it is and how to use extends and Abstract, I watched…
-
0
votes1
answer37
viewsSDK problems in Fedora Workstation 24
A few days ago I installed Fededora 24, with all completed I installed Ionic and Cordova, and soon after JDK. Ao gives the following command ionic build android I checked that SDK was missing,…
-
0
votes1
answer302
viewsHow to run commands in the Maven plugin for Eclipse?
I use the Maven plugin for Eclipse but I don’t know much about technology. You can run Maven commands (even typing: mvn compile for example) without having to install Maven separately? The answers I…
-
0
votes1
answer4794
viewsError: error: class, interface, or Enum expected
Why is my code making the mistake: error: class, interface, or Enum expected Follows the code: import java.util.Scanner; public class teste175 { public static void main (String[] args) { Scanner sc…
-
0
votes0
answers120
viewsImplement interstitial ads in the App
Can anyone explain to me in a brief tutorial on how to implement, interstitial Admob ads in my app which is a simple browser. The problem is that it keeps giving wrong classes, as I have no…
-
0
votes1
answer95
viewsError while consuming Glassfish + Jersey REST web service with date that returns an xml
I need to consume a web service (WS) REST on my android app. The web service was done with glassfish, jersey and the Hibernate ORM to communicate with the database. Below is the WS code: Vegetarian…
-
0
votes0
answers28
viewsIs sharedpreferences indicated to save the application status?
I’ve searched several gringo sites but found nothing, including here. I have a problem in the application that whenever the user minimizes it and uses the mobile phone for something else on cell…
-
0
votes1
answer182
viewsClose ad by clicking close button
I would like to know how to close the layout adview if the user clicks on the ad "X". My ad code is the below and use in the main layout activity_main: MobileAds.initialize(getApplicationContext(),…
-
0
votes1
answer66
viewsMask of entry of measures in metro
I am developing an Btus Air Conditioning Calculation App, which simply receives units of measurements and recommends an air conditioning capacity suitable for the environment. The problem is I want…
-
0
votes1
answer53
viewsWhen modifying a data before sending to Query it updates the table
I’m doing a query select with spring + Hibernate, Query query = em.createNativeQuery(sqlBase); I am passing to the 'sqlBase' a Company as parameter, SELECT e.* FROM Empresa e WHERE e.id = :empresa…
-
0
votes1
answer126
viewsRedirect between pages with datatable(primefaces) without losing filters
I have 3 pages and they are responsible for fetching objects in my databases based on the first page selection filter. My website is about car ads and has the following structure: 1st page:…
-
0
votes1
answer181
viewsIs it possible to merge Java with Javascript?
For example, if I have a function soma(a, b) in Javascript and I want to use this function in a Java code, is it possible? If so, how? Javascript: function soma(a, b) { return a + b; } Java: public…
-
0
votes1
answer422
viewsMake the button visible at a given time
Hi, I’m trying to get that button "X" close the ad appear after 15 seconds. I don’t know the correct function for this but I did it on the basis of appearing interstitial ads from admob. See my…
-
0
votes1
answer432
viewsNo bean named 'entityManagerFactory' available
I am testing my Spring application with Junit, however the error occurs after placing the annotation @EnableJpaRepositories: Caused by:…
-
0
votes1
answer148
viewsRemove empty line from within Java text
By manipulating a xml return of a service, I do the following manipulation in the file: return xmlServico.replaceAll("job.coincidencia.vo.", "").replaceAll("RNSCoincidenciasMultiRamo_-",…
javaasked 4 years, 9 months ago eugenissimo 25 -
0
votes2
answers55
viewsFileoutputstream fails in context
I’m trying to reuse a class, which writes the file to the internal storage. In the first line of try, the result is null (from activity) and makes a mistake. When I execute this code on…
-
0
votes2
answers351
viewsHow to remove the blue border of the tabpane?
I can’t get the blue border pattern that is shown in the event :focused. I’m trying to solve this problem by CSS, but I can’t. My CSS code: .tab-pane .tab-header-area .tab-header-background {…
-
0
votes1
answer18
viewsSyntax error in SQL when starting OW2 Orchestra
I recently downloaded the OW2 orchestra software. In the user manual, after going through all the configuration steps (I’m using Mysql as my BD. The other settings are the defaults, including the…
-
0
votes1
answer1780
viewserror :Exception in thread "main" java.lang.Nullpointerexception
I’m trying to set an attribute that’s a vector, and it’s in a class y, but I have a class x, which consists of this class y. At the time I write the code there is no error, but when executing the…
-
0
votes1
answer100
viewsError - Java Maven Does Not Build - Release Version Not Supported
Good afternoon, everyone, I installed intellij alone in Ubuntu version 18.4. I need to do a Maven project. I did a test, created the project and in a class to make a simple Hello world. However only…
-
0
votes1
answer19
viewsJbutton Netbeans Java
How to check if the mouse CONTINUES over a button in java? I created a timer that after 1.5Segs performs the task of showing a Popup saying what the button does, but it still runs when you take the…
-
0
votes1
answer153
viewsModelling View Controller Unit Test with Mockite and Spring
I need to mount the unit test for the controller below (for example only): import javax.servlet.http.HttpServletRequest; import org.springframework.web.bind.annotation.GetMapping; import…
-
0
votes1
answer33
viewsHow to register values in a two-dimensional array?
Java I’ve tried it this way before, but it’s not working. Returns error message: Index 0 out of Bounds for length 0 private double[][] salarios = {{},{},{},{},{}}; public void cadastrarCargos(){ for…
javaasked 4 years, 8 months ago Renan Cavalcante 1 -
0
votes1
answer416
viewsSpring Data JPA: How to Project Data?
I’m following a tutorial to make projection based at this link. However, it seems that the application is generating an error in the serialization of the data emitted by the reflection of Jackson.…
-
0
votes1
answer148
views.gitignore being automatically created by Eclipse IDE
Every time I create a new Java project in Eclipse .gitignore is created with the information /bin/ within the same. Can anyone tell me if it is possible for me to configure the IDE not to create it…
-
0
votes1
answer30
viewsinject CDI Beacons into during testing using Arquillian Chameleon
I’m unable to inject with CDI @Inject. The field movimentador If the contract is void. I believe it is because of Beans.xml, but how do I create Beans.xml using Maven-build-Deployment, because I am…
-
0
votes1
answer64
viewsInstance of database connection
People, I have a problem which is this, my database connection class is a Singleton. It happens that if the server drops the instance of the class does not know that the server is down, I only know…
-
0
votes2
answers101
viewsMVC desktop - where is the Controller?
I modified it this example of MVC to try to make it more like my MVC vision (in which the role of the Controller is not very clear). I ended up with a program that only has Views and Model, without…
-
0
votes0
answers74
viewsCSS does not load into HTML
Guys, when an exception occurs in doFilter(Filter) the code below is executed: RequestDispatcher requestDispatcher = request.getRequestDispatcher("maintenance.jsp");…
-
0
votes1
answer101
viewsUML - Composition or Aggregation
Is the related 'Composition' in the 'controlCurso' classes with the 'Course' carried out in this way? I am in doubt if it would be a 'Composition' or 'Aggregation', or none of them.…
-
0
votes1
answer29
viewsThe number and the letter stick together when I try to compile a variable
I’m creating variables, and when I compile, the number comes out "glued" to the letter. I don’t know how to explain it well, but that’s about it. See my code below: int numero = 24;…
javaasked 4 years, 6 months ago camelloazul 9 -
0
votes1
answer51
viewsI cannot capture regex from the end of the string with the Java replace method
I tried that code but the $ is not understood as the end of the string, but rather as a character to be captured, I did something wrong or it’s a bug? String s = "gabriel";…
-
0
votes1
answer407
viewsHow to get the date of a server instead of a local server?
I made the following form of license con.executaSql("select *from vencimento"); con.rs.last(); SimpleDateFormat df = new SimpleDateFormat("ddMMyyyy"); Date hoje = new Date(); String dataAtual =…
-
0
votes1
answer395
viewsTreat Inputmismatchexception calculator
I am making a calculator in java oo, and I would like to treat this exception but I don’t know how. This is the main class. public class Principal { public static void main(String[] args) {…
-
0
votes1
answer130
viewsHow to select multiple device images and upload them?
How to pick multiple images from what user select and send to mysql database by php? The most that got was a single image, but the user can select several on android and wanted to send to online…
-
0
votes1
answer85
viewsUnable to view event details created in the first faces Schedule
This is intriguing me has a time, use in the project the Schedule of the primefaces to add events, even then it’s okay, all the computers add and send to the online database, there is also a method…
-
0
votes1
answer27
viewsDoubt eclipse tool
It is possible to generate Getters and Setters automatically only of selected variables?…
-
0
votes3
answers3802
viewsLoad a list of Enums
I have a selectOneMenu thus: <p:selectOneMenu id="diminui" value="#{naturemb.nature.diminui}" effect="clip"> <f:selectItems itemLabel="#{naturemb.carregarAtributos()}"…
-
0
votes1
answer88
viewsreplaceAll How to do repetition
want to make a replaceAll from 0.0 to 9999.9999 and wanted to know if there’s another way besides adding 1 by 1? I was doing like this fim = fim.replaceAll("0.0", "0.0f"); fim =…
-
0
votes1
answer151
viewsxml error Annotation
I’m having a problem when running my program and have no idea what might be wrong, I made a Java program with Annotations. Would anyone know to tell me? [Fatal Error] :8:83: The "Property" element…
-
0
votes0
answers52
viewsRecyclerview does not expand
Hello, Here’s the thing, I’m using two Recyclerview in parallel: <android.support.v7.widget.RecyclerView android:layout_width="match_parent" android:layout_height="wrap_content"…
-
0
votes3
answers117
viewsWhat technical obstacle for Android not support the new versions of Java
I wonder why the version of java in the Android remains the same after so many years. Against Kotlin update with a certain frequency, it is a technical issue the stagnation of Java?…
-
0
votes0
answers21
viewsHow to correctly print the following expression? Math.Pow (2, (1/12));
The expression 2^(1/12) should present the result: 1,0594630943593. But when I apply the Math.Pow function the result only gives 1.0. Could someone help me and tell me how to print the correct…
javaasked 4 years, 5 months ago Habemus Capital 1 -
0
votes1
answer999
viewsDTO Assembler, how do you really use it?
I’m reading about DTO and tbm viewmodel in ASP.NET and wanted to do something like this in JAVA. If I’m not mistaken, DTO is a way to move data between layers in a specific way without having to…
-
0
votes1
answer167
viewsHow does JVM, Java, JDK and JRE work?
Java can compile to .exe? Does every operating system, such as Windows, Macos, Linux, etc. already come with JVM installed to interpret the program made in Java? Or when compiling the program b.exe…
-
0
votes0
answers122
viewsAndroid - Create a Socket in Singleton
Good night, I’m developing an android game where to play online have to connect to the server. At first I was trying to create sockets in an Activity where the game will occur, but the app was…
-
0
votes1
answer23
viewsCustomize validation message in Wicket
I currently have a project that is using Wicket 7.8.0 and Java 8 and I have one DateTextField that every time I put one wrong date, the FeedbackPanel reports that the: "deDateField" não é um número…
-
0
votes1
answer192
viewsHow to change pipe color in NETBEANS?
I was changing the colors of the NETBEANS editor, only I couldn’t change the color of the pipe (the bar that appears when you write something). You can help me ?
-
0
votes1
answer21
viewsCannot reolve Symbol "@drawable/", image exists and application runs ok
Android Studio shows this warning, but the application runs normal and the picture is shown normally. My question is why the IDE shows the error if everything is ok. Image in the folder: Error in…