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
-
4
votes1
answer118
viewsClass creation that returns a String
Hello guys I’m beginner in Java Android and I’m having a little problem, I’m trying to create a class that returns a String. I create the file .java and paste my code but gives the following error…
-
4
votes1
answer4911
viewsFailed to execute Goal org.apache.Maven.plugins:Maven-Compiler-plugin:2.5.1:Compile (default-Compile)
By clicking on install in any of my three MVC parts, he makes reference to the cited error. ================================================================================ Scanning for projects...…
-
4
votes2
answers176
viewsHow, by clicking on the notification, delete the notification and do not open the application?
I need to send a notification but would like when the user clicks on the notification it is deleted and does not open the application The part of generating the notification that is already working…
-
4
votes1
answer738
viewsPass List to a sub report and call it in main report
Guys I have a method that generates a pdf report in a certain directory, now arose the need to use a sub report, but I’m having difficulty understanding how to pass a List as the data source for…
-
4
votes1
answer145
viewsJavafx reality or just speculation?
I have experience in Swing 8 years, but for some time I’ve been reading that with Java 9 Swing will be totally abandoned by Oracle. Now arose the need for me to develop a Desktop system for a client…
-
4
votes1
answer127
viewsHelp with logic
I have a method that reads several tags from a file . xml and returns a list filled by the data read. Problem: Each xml file has several batches and within the batch has several tabs, for example, I…
-
4
votes5
answers5903
viewsCapture filename in directory
The following method takes the name of the files of a given directory and displays them on the screen, the problem is that the .listfiles() returns the number of bytes and not the number of files,…
-
4
votes1
answer73
viewsSplit by the | character does not return all expected elements
I have a file with lines similar to the one below: 42|a|b|c|d||f||h||||||||||||||||||| I need to split by character | then my code does it like this: String linha42 =…
javaasked 8 years, 8 months ago hebertrfreitas 593 -
4
votes1
answer665
viewsMessagedigest and hash class with MD5 in java
I’m testing the creation of Hash using this class, and I’ve seen on several websites, including on Soen, the use of snippets similar to the following to create hashs using md5, but without much…
-
4
votes1
answer893
viewsI cannot ignore fields when trying to return them as Json causing "Infinite recursion"
I’m working with Hibernate, Spring and Jackson (to ignore fields) and when trying to return the class User in a json request java returns error due to mapping @Onetomany and @Manytoone with class…
-
4
votes1
answer987
viewsNotifications with Spring
how to implement a system of notifications that receive an example notification counter in real time: My question is that when it is inserted there in the bank one more line and go from 4 to 5…
-
4
votes0
answers338
viewsConfiguration of the Maven
I created a project Maven (NOTE: It is the first time I am touching this technology), but he is making this mistake. This plugin what message is talking about I need to install it? How do? Another…
-
4
votes2
answers232
viewsPower method and exception treatment
I must resolve the following exercise but I have some doubts: Create a class with only one method power, which receives 2 numbers and calculates the number 1 to the number 2. This process must…
-
4
votes2
answers339
viewsHow to completely delete an Arraylist and a List
I would like to know how to destroy the erase completely a ArrayList and a List in full at runtime. example: ArrayList<Elemento> e = new ArrayList();//Elemento e uma classe for (int i = 0;…
-
4
votes1
answer1666
viewsProxy project default, why use?
This proxy pattern example can be found on Wikipedia. reference: http://en.wikipedia.org/wiki/Proxy_pattern What I want to know is this: Why should I use this pattern? When should I use it? Why is…
-
4
votes1
answer359
viewsWhat programming should be done to use Spring Security with Jboss with annotations?
According to requirements of a project that is in the research phase, I need a large distributed system to work properly with Spring, at the moment I am having a lot of difficulties in integrating…
-
4
votes1
answer570
viewsFiltering data from acceleration and magnetic sensors on Android
I have a player open source for Android some time ago. Months ago I created an audio viewer (the type of ones with bars and colors) where the user could interact, simulating an augmented reality…
-
4
votes1
answer1964
viewsImage upload with Primefaces on Tomcat server, only the image path being saved in the database
Fala galera. I’m a beginner in Java and am doing a small Dynamic Web project using Primefaces, JSP, Hibernate and Tomcat. Basically it is several forms of registration and one of them is the…
-
4
votes2
answers1190
viewsThe Operator != is Undefined for the argument type(s)
I am trying to create a method to save users in the database by doing the following check if the id past user is different from null he changes if not he registered. Code public void salvar(Usuario…
-
4
votes1
answer837
viewsHow to organize CRUD methods for each table?
I would like to know how to organize the CRUD (create, read, update, delete) methods of each class in Java. An example, to better understand: Suppose we have the classes Funcionario, Cliente and…
-
4
votes1
answer724
viewsHow to map entity with Hibernate to create non-unique constraints?
I’m trying to create an entity with the following mapping: @Entity @IdClass(AutenticacaoPK.class) public class Autenticacao { @Id @OneToOne(cascade = CascadeType.REFRESH) @JoinColumn(name =…
-
4
votes2
answers1494
viewsAccess and permission control
I have a CRUD project to manage faculty and college courses using jsf+primefaces+jpa. My problem is this: There are the users who are the coordinators of the courses and the users who are…
-
4
votes4
answers1244
viewsHow to Catch Data with JSON on Android
Hello how do I get the data from a web-service that I have? I have the following code in JAVA Android to save the information:…
-
4
votes3
answers1762
viewsRecover logged in user
I have Java Web application, but I want to do the following: When I log into my application with a certain user then I need to do some operations, such as saving some information in the database,…
-
4
votes3
answers1646
viewsJava Maps: take key from value
Hello, I have a string map for string: Map<String,String> myMap = new Map<String,String>(); with a series of values myMap.put("1","valor1"); myMap.put("2","valor2");…
-
4
votes2
answers670
viewsHow can I make a variable wait for the user to press 1 of 4 buttons?
Well, I’ll try to be clearer. I have a variable called int tentativa and I want it to receive a specific value depending on the button the user presses. The buttons are btPedra[0], btPedra[1],…
-
4
votes1
answer1465
viewsJavase with CDI and JPA - Error WELD-001303
I am studying JPA and CDI in a Java SE application. When I will create the EntityManagerFactory I come across the error: Exception in thread "main" org.jboss.weld.context.ContextNotActiveException:…
-
4
votes2
answers129
viewsOperation with Java Factorials
Can anyone ask this question in Java? I have no idea how to do, I’m still beginner. Input format An integer x corresponding to the X of the equation and an integer n indicating a number of series…
javaasked 8 years, 7 months ago João Carlos 41 -
4
votes1
answer810
viewsHow to add a folder via Maven to build path
I have an application using Jhipster, to make queries I added querydsl, configured in Maven to generate Q classes, these classes are being generated in the path: target/generated-sources Except that…
-
4
votes2
answers1183
viewsMy layout does not render
I was watching and copying a code from the first class of Material Design of the Thiengo Calopsita youtube, It turns out that the file xml of activity_main and of toolbar_bottom is not rendering in…
-
4
votes2
answers2270
viewsSeparate each number with semicolon(;) in Java
In a text box that has the variable name MMdados I put the numbers: 0;1;0 Then I created a variable String recebeMM who receives MMdados.getText(); I send these numbers to a text field that has the…
-
4
votes1
answer614
viewsSeeking Active Threads
I have the following problem, where I have one for() that opens 17 threads and needs to recover, in another thread ( 18ª ) the active threads that I opened earlier and verify which of the 17 are…
-
4
votes1
answer368
viewsOverflow by multiplying two integers in Biginteger
I am starting studies in Java and have a task: generate two random integers and store their multiplication. For this, I tried to use long and BigInteger. But the result of this multiplication is…
-
4
votes1
answer380
viewsProblem with Spring Security - page not located
When the user accesses a page that he does not have authorization for, it is to be directed to the page of AcessoNegado.xhtml. But it presents the following image: This page is located here:…
-
4
votes1
answer127
viewsWhy the compiler alerts me Anonymous new Runnable() can be replaced with lambda
Because that code (Thread) shows this message (on the compiler), and how to make it not show more? Code: public void onCreate(Bundle icicle) { ... mVideoView.setOnPreparedListener(new…
-
4
votes1
answer1653
viewsI can’t leave Jbutton on Jlabel
I have a JPanel, and within it a JLabel of the same size. The JLabel has an icon associated with it, working like a wallpaper. When I try to put a Jbutton on top of Jlabel, Netbeans repositions the…
-
4
votes1
answer879
viewsSpring boot Data-JPA and JSF Java Config
I am setting up a project using Spring boot for ioc and Data-Jpa along with JSF however I have a problem with @Autowired my DAO is not carrying. Does anyone know how to do that configuration and…
-
4
votes1
answer243
viewsProblems with changing Jpanel inside Jdialog using Swing
I’m having a problem with a system I’m developing regarding screen swapping. Sorry for the extensive post, but I could not explain the problem otherwise. He owns a JFrame main with a menu that are…
-
4
votes1
answer734
viewsError "illegal start of Expression"
In my main I’m calling the method stats: user.stats(ctr); The method stats in itself: public void stats (int num) { int i; float total=0, perc; for (i=0;i<num;i++) { total = total +…
-
4
votes6
answers201
viewsHow to remove 2 digits from each item in the list?
I have a list/array: var lista['01.um','02.dois','03.tres'] I need to create a new list like this: lista['01','02','03'] I know little of Groovy and Java, which is the correct way to create the…
-
4
votes0
answers217
viewsBetter logic for sheet handling
Good afternoon dear friends, I have a project in hand where I have four spreadsheets, one of each "computer station management program" in which, in all of them, I have a column with the number of…
-
4
votes2
answers1829
viewsHow to print a decimal number with a dot, not a comma?
If I do: float a=5; System.out.printf("%d", a); His exit will be: 5.000000 How do I print 5.000000? I mean, I want to replace the comma with the dot.…
-
4
votes1
answer92
viewsHow does one method work within another? E.g: service.metodo(arguments). execute();
I’m not understanding this method within another method someone explains it to me? Another example of my doubt: ImageKeywords keywords = service.getImageKeywords(image, forceShowAll,…
-
4
votes1
answer161
viewsJava Nullpointerexception Error
I have a class like User which has as attribute a vector of Sensors, and the class Sensors has as attribute a vector of Data. After creating five objects of type User and saving in a txt file, I…
-
4
votes1
answer505
viewsDefinitely solve problems with strange characters in Java
I had a problem and I solved it this way: javac -encoding UTF-8 nomedoarquivo.java As I can already leave configured this command for all files?
-
4
votes2
answers450
viewsError including CSS/JS in the head of a JSF page
I’m trying to include a CSS in a JSF view. However, I’m not succeeding. Below we have an excerpt from the view: <h:head> <h:outputStylesheet library="css" name="bootstrap.css" />…
-
4
votes1
answer394
viewswindow.open() does not load the page
I am trying to open a link in a new window/tab but when it opens it does not load. Controller: public static Result loadCreateArtigo(){ return ok(request().host()+request().path()); } Javascript:…
-
4
votes1
answer552
viewsHow to use a custom Adapter on android Listfragment
Hello folks I’m having problems with using a Adapter customized and display this Adapter in a Listfragment. My Custom Adapter public class UsuariosAdapter extends BaseAdapter { Context ctx; List…
java android listview android-fragment android-adapterasked 9 years, 3 months ago ThiagoDeveloper 55 -
4
votes1
answer311
viewsI cannot boot Tomcat in Netbeans
When I started Tomcat in Netbeans IDE it gave the following error: Using CATALINA_BASE: "C:\Users\chrissian\Desktop\Todo sobre o JAVA\Tomcat\apache-tomcat-7.0.63" Using CATALINA_HOME:…
-
4
votes2
answers3815
viewsSelenium WebDriver_ Access page without opening browser
Can anyone tell me if it is possible to access the page without opening a browser? That is, do the tests without opening the browser. Is there any way? If there’s a light. I’m using the Firefox…