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
-
1
votes1
answer7968
viewsjava.lang.Classnotfoundexception: javax.faces.webapp.Facesservlet
Trying to start my JSF application returns this error : java.lang.ClassNotFoundException: javax.faces.webapp.FacesServlet pom.xml <dependency> <groupId>com.sun.faces</groupId>…
-
1
votes1
answer589
viewsHow to translate java code?
In the Android application you can translate the xml string. How do I do this in the java code? In this code, for example: Toast.makeText(getApplicationContext(), "Carregando o aplicativo",…
-
1
votes1
answer184
viewsWhy are tables created in Hibernate deleted after stopping the server?
I run my website and it generates the tables in the database. I can even register in the database by the site and its der a select it shows that it was registered. But if I stop the server, and see…
-
1
votes1
answer297
viewsError when injecting object: returning null
When I inject an object into the class it returns null, it seems that it is not instantiated. Exception in thread "main" java.lang.NullPointerException at…
-
1
votes2
answers636
viewsHow to create a folder named after the current date
I am trying to create a folder with the same name as the current date but simply does not create. import java.util.*; import java.io.File; public class PastaData { Date data = new Date();…
-
1
votes1
answer475
viewsHow to show Hashmap value?
I’m having trouble showing (can be using a for) the value of this Hashmap. Does anyone know how? The console only shows this value: {Joao=[Ljava.lang.String;@2b05039f} I can’t show the internal…
-
1
votes0
answers19
viewsParameter with default value in Java
In other languages, such as javascript, it is allowed to make a function by passing a parameter with a default value, as in the following structure: function myFunction(value = true){ //alguma ação…
-
1
votes2
answers2062
viewsPass values from a table to a modal dialog (JSP)
Good afternoon, you guys! I’m trying to pass values from a table to a modal window, but I’m not getting... I tried something from jquery, but I don’t know what I might be doing wrong... I’ll post…
-
1
votes0
answers52
viewsOmniface Selectitemsconverter does not reflect the values of the object on screens
I’m using the component selectOneMenu with the conversion of omnifaces. When I save my object in the database works right, but when I restore the information, they do not reflect on the screen, ie…
-
1
votes1
answer486
viewsHow to get the Android version number?
I would like to know how to get the Android version number in which my application using Webview is running, to put in Useragent, as in the code below:…
-
1
votes0
answers104
viewsHow to use setCaretPosition in Jformattedtextfield?
I’m having trouble to "set" the cursor at the beginning of the field, using the setCaretPosition(0); in Textfield fields, it works correctly, but in any field with masking (Jformattedtextfield…
-
1
votes1
answer196
viewsRelation N x N in Java objects
I have an item table (item_id (pk), descrição, ...), A supplier table (fornecedor_id (pk), nome, ...) and for being an Nxn relation I have an item_vendor intermediate table (item_id (fk),…
-
1
votes1
answer2133
viewsTraveling salesman resolution using genetic algorithm
Friends, I’m developing a solution adapted to the traveling salesman problem using genetic algorithms, to solve the problem I took a chromosome crossing function ready on the internet, but I don’t…
-
1
votes1
answer58
viewsReturn numbers from a String
I am a programmer PHP and giving maintenance on a project Java I found myself with the need to return only numbers contained in a certain String. I found no questions about it in Sopt and found in…
javaasked 8 years ago Kenny Rafael 6,698 -
1
votes1
answer80
viewsAs popular jtable with xml file titles
Hello, I have a cruel doubt about how to do something, I need to popular a Jtable with a list of xml files that are in a certain folder, but I have no idea how to do it or how to search for…
javaasked 8 years ago Prostetnic Vogon Jeltz 408 -
1
votes2
answers402
viewsSQL/Java query
Good morning, guys I am beginner in SQL and I need to do the following search. Tenho esta tabela: MINIMO MAXIMO CLASSE 0 20 1 21 40 2 41 60 3 60 10000 4 I need a command to see which class fits the…
-
1
votes1
answer847
viewsJavafx - button-click event, inside a table, does not work
I am in a Javafx project where I needed to make an autocomplete in an input. We have some plugins that can be used, but the autocomplete was so simple that we prefer to do on hand same. Here is the…
-
1
votes0
answers464
viewsError opening H2 Database
I have been trying to open a H2 Database file that is not corrupted and H2 Database has returned me the following error: Encryption error in file "C:/Users/Administrator/test.h2.db" [90049-189]…
-
1
votes1
answer41
viewsChange Actionbar title in older versions
Hello I have four screens in my android app and I want in each screen the action bar has a different name. I tried to change the title using getActionBar().setTile(): But since I have API 9 as a…
-
1
votes1
answer2024
viewsDisplay text in Jframe
I would like to know how to assemble a text in my Java class, but this text would have the contents of a record of my database. I’ve done more or less that using JLabel but it creates one-line…
-
1
votes0
answers284
viewsHow do I show an item already selected in a jsf datatabe that has been edited previously
I’m trying to see these items I selected on the inclusion screen also selected on the edit screen and am not getting: this is my inclusion jsf: <?xml version="1.0" encoding="UTF-8"?>…
-
1
votes1
answer208
viewsRegister product for logged in user
I’m getting the object through Activity's using putExtra and returning on the other screen with the getSerializableExtra. I’ve already created the fk id_usuario in the product table for the field…
-
1
votes1
answer84
viewsHow to access a "List" from the screen?
I am trying to access a list of values in my code through the JSF screen, but the screen does not find the method that lists the values, someone can help me? I want to access the method values…
-
1
votes1
answer1878
viewsValidate date less than current date
My question is as follows. I have a JSP form for the registration of students with several attributes, one of them is the date of birth. Until then I was registering the date only validating the…
-
1
votes1
answer281
views@Inject for manually instantiated object?
I have a class called Application which is a listener, it instantiates objects of ServidorRadius where it needs to access the repositories that are injected with CDI, however radiusRepository is…
-
1
votes0
answers31
viewsJbutton pressing a key
Is it possible to "simulate" pressing a key from a keyboard at the click of a Jbutton within another program? I want to do this because I’m messing with old versions of Amcap .
javaasked 8 years ago Jonathan Galdino 31 -
1
votes0
answers173
viewsHow to underline a specific character in a Jtextfield
How to change, say, the font of one or more characters of a JTextField allowing them to be underlined, bold or italic? But, the rest of the text would be normal. But in this case I need to…
-
1
votes0
answers43
viewswant to pass my java script function to the bean when loading the page
want to pass my java script function to the bean when loading the page, no need to click the button ? I am using the remote,…
-
1
votes0
answers82
viewsIs there a Recyclerview equivalent in Swing?
In Android Studio, I use a class called RecyclerView, that repeats a layout while there is data for it, as if it were a list. There is an alternative to this in Java using Swing?
-
1
votes1
answer463
viewsHow to add Mouseclicked to a Jlabel?
I am creating a program with MVC rules in Java and would like to know how to create an Event in JLabel for when I click on it with the mouse. For example, for the buttons I do so: View class: void…
-
1
votes0
answers89
viewsHow do Java annotations work?
I would like to know how EJB annotations are made in Java, those that start with "@"
-
1
votes2
answers76
viewsJava File Writing Difference
I would like to know the difference in these two methods of Writing in files. Path path = Paths.get("E:/documentos/texte.txt"); Charset utf8 = StandardCharsets.UTF_8; try(BufferedWriter escrever =…
-
1
votes1
answer76
viewsIs it possible to decrease the startup time of my application?
I’ve seen a lot here and at Stackoverflow in English about Swing and Runnable, I still couldn’t solve my problem. I am developing a work for the college (interdisciplinary work involving Distributed…
-
1
votes1
answer67
viewsMethod with Generics in inherited type
How do I use two types in the method Generics, to sum only the areas of the classes Quadrado and Retangulo. I tried a method like this: public static double soma(Forma <? extends Quadrado>…
-
1
votes1
answer68
viewsHosting a small javaweb software on jelastic localweb
I took a course in java web building a financial with bills to pay and some basic things. Some people were interested . In case for every client I have to create an environment. Do you know if I…
javaasked 8 years ago Silvano.filho 31 -
1
votes1
answer195
viewsSubreport in ireport
I am trying to make a report where each code has x clients. Example Code 1: Bruno Rodrigo Fernando Code 2: Rafael João I retrieve these codes from a database, example: 1 Bruno 1 Rodrigo 1 Fernando 2…
-
1
votes1
answer91
viewsHow to scan a signature with java
I need to get a signature on a document but I wouldn’t like to print it. Can anyone indicate a signature pad that works with the first faces ?
-
1
votes1
answer165
viewsAm I abusing Strategy Pattern too much in Java?
In an application for user authentication via Radius I thought it would be interesting to use Design Patter Strategy with Enum. So the code went like this: public enum TipoAutenticacao {…
-
1
votes1
answer93
viewsDoubt User table and Friend table
Eae guys, I need help, I’m a beginner in java, and I’m doing a college job where it’s going to be a mini social network, at the beginning we will make user registration, within the class Beans, user…
-
1
votes1
answer427
viewsProblems in configuring the Spring project
Create a controller called Homecontroller and put the following settings: First Configuration So far so good. After that you have to configure the project to see the page that is in this package:…
-
1
votes2
answers1143
viewsReceive variables from other classes
A class that contains variables and their values, and needs some simple way to feed the other class with these variables. For example, I have a class with the variable String urlPage =…
-
1
votes0
answers52
viewsAPK signature hashcode
I need returns a unique hashcode from the apk signature. Signature[] sigs = context.getPackageManager().getPackageInfo(context.getPackageName(), PackageManager.GET_SIGNATURES).signatures; for…
-
1
votes1
answer303
viewsJava Test with database in memory
I am in doubt when running the tests of my application: The question is whether there is the possibility of making Hibernate create a non-physical bank to perform the tests in memory, to facilitate…
-
1
votes1
answer165
viewsError when viewing postgres table using Jpa, Hibernate and Postgres
I did a small project to test a small registration in a postgres table , using jpa, with Hibernate, I managed to make the registration class work, it inserts in the table without problems but I…
-
1
votes1
answer37
views -
1
votes0
answers46
viewsAndroid app gives error when trying to login
System application log in to Android Studio. I can register in the application but when I try to log in I can’t Love a message "login failed" here is the login code.php <?php…
-
1
votes1
answer413
viewsSend address to search in google maps
Hello, I ask for help on the following: I have a Textview with an address, I would like when clicked an Intent sending this address to search in the user’s own Google Maps App. I know I can use the…
-
1
votes1
answer473
viewsError while fetching a list in the bank
Eae personal, So I have a question about my college job, I have two tables a user and USUARIO_AMIGO both related, by java I’m searching a user list that brings all registered users, and another list…
-
1
votes1
answer69
viewsreceive the size of a folder in textview
I’m an Android development intern, as a challenge I need to create an App to receive/discover the size of the folder/ directory of images Whatsapp... I researched and I couldn’t find anything, I saw…
-
1
votes0
answers380
viewsDesign - Comics (Board)
I have an Introduction to Programming project that consists of making a comic. The first class is the Vignette. It is necessary to create two constructors for the Vignette, which in one of them…