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
votes1
answer4566
viewsHow do I resolve the "No Persistence Provider for Entitymanager named" error?
When I try to execute the method Persistence.createEntityManagerFactory("Aluno") class Persistence i get the following error: run: abr 04, 2016 9:11:30 PM org.hibernate.ejb.HibernatePersistence…
-
2
votes1
answer517
viewsSocket with C# and java
Good morning, I am writing an application where the server socket is in C#(due there are some drivers have to be in c#) and the client in Java. I can make the communication perfectly between them,…
-
2
votes1
answer1810
viewsHow to capture parameter in form with enctype="Multipart/form-data"?
I’m having trouble capturing the parameters of an HTML form with enctype="Multipart/form-data", I can upload an image through the form, but I can’t capture text typed in the form. The form looks…
-
2
votes1
answer286
viewsOne method stopping the loop of another method
I have four objects (already instantiated) triangle, square, circle and a last picture, responsible for invoking both methods of each class of the respective objects, in order to draw a house, a…
-
2
votes1
answer509
viewsArraylist<Obj> java listing
What is the advantage of using in a listing: for(Obj o : lista){ // operacao } instead of: for(int i = 0; i < lista.size(); i++){ // operação }…
javaasked 7 years ago ayowole agbedejobi 557 -
2
votes1
answer170
viewsWhy unmark the main class creation when we work with canvas?
So far, in all tutorials I’ve seen, when we’re going to work with a swing screen, we’re asked to clear the main class creation. I would like to know the science behind it, and what results if I…
-
2
votes2
answers2905
viewsJtextfield null field validation
On my system, I have a window and a controller, but for some reason, it is never launching the error as expected : Method of validation : private void validacao(){ if((form.txtNome.getText() !=…
-
2
votes3
answers142
viewsHelp with java arrays
I have the discipline array and the current array. The current one is an exact copy of the disciplines. If there are two equal Strings within the disciplines array I need to delete all the same and…
-
2
votes1
answer411
viewsHow to create a folder browser in java swing?
I want to create a window and it has a button, when the user clicks that button appears that "typical windows folder browser" for the user to select a folder from his machine and the folder address…
-
2
votes1
answer421
viewsDefining an abstract attribute in a non-extabstracted class
I want to be able to instantiate an employee class (so this can’t be abstract) and have an abstract salary attribute that will be static for each type of employee. I can do (in the working class):…
-
2
votes2
answers1400
viewsHow to sort a p:datatable
How do I sort a datatable by a text. For example my system is a service order system, I need the "Open" orders to come first. Follow the code of the datatable below. I tried to use sortby but it did…
-
2
votes0
answers72
viewsUpload files. only in Xamarin Android
I’m trying to convert a class Java for C# in the Xamarin.Android. The class Java that’s the one: private native boolean OpenDeviceCtx(Object obj); public native boolean CloseDevice(); public native…
-
2
votes1
answer522
viewsHow to use the TIMER class in a method with Math.max and Math.min
I’m on a kind of ambitious project to create my little math game (which I found better than a simple calculator) in just one JFrame, methods only, without using any other class in the package...…
-
2
votes1
answer392
viewsHow to model Product/Stock?
I started a modeling for Products thinking of the same as: Purchased for Resell Produced for Sale Perishable or not So far so good, but when I started thinking about stock control based on this…
-
2
votes1
answer697
viewsFor inside a Java Switch
Good night, I wonder if there is a way to declare a 'FOR' within a SWITCH CASE in Java because Netbeans is making an error right here. I’m trying to make an application to perform a guessing game…
-
2
votes2
answers687
viewsQuery sql with multiple java fields
How to do a java sql search that involves multiple arguments? Example: I want to research all people with Angolan nationality, with the Computer Science course and who have two or more years of…
-
2
votes2
answers385
viewsDisplay Jcombobox object data in a Jtextarea from the selected item
I wanted to show the data of a customer who is on a combobox inside a Jtextarea, as in the following image: The problem is that only the information of "Igo Brasil" is shown, when I try to show the…
-
2
votes2
answers347
viewsError while calling Activity
main activity import android.content.Intent; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.Button; import…
-
2
votes0
answers1330
viewsFailed to convert to internal representation
Good afternoon, I’m working with Genexus Ev3 Up1. I have a Data Provider that searches for a query and returns an SDT with the information, but of the error in TOMCAT with the message of:…
-
2
votes3
answers342
viewsWhere should I put a calculation method? In the entity itself or in the business class?
I have an architectural doubt, I believe. I need to create a method that receives a period of dates and an entity in which to execute a search in the period cited. In fact, to ask this question it…
-
2
votes0
answers86
viewsHow to count how many days of a certain type (Monday, Friday etc.) exist between two dates?
How do I know how many weekdays of specific types (for example, only Mondays, Tuesdays and Wednesdays) exist between two dates in Java? For example, from date 01/12 to 30/12, how many segundas,…
javaasked 6 years, 11 months ago felipe.rce 1,969 -
2
votes1
answer362
viewsHow Does Life Cycle Dependency Injection Work?
How the 3 life cycles of a dependency injection works such as Singleton, Transient and Scope ?
-
2
votes1
answer375
viewsTwo id in table Hibernate
Is it possible for two fields to be id in a Hibernate table? I have two ids that need to be single in even table. But I don’t know how to implement.
-
2
votes1
answer352
viewsReturn Web Service is a string, how can I query the data?
I am consuming a Web Service , follows the JAVA code (JSP): <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE html> <%-- start web service invocation --%><hr/>…
-
2
votes1
answer95
viewsEL JSP does not work
Servlet code: protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { token = "teste"; request.setAttribute("token", token);…
-
2
votes0
answers209
viewsProblem to read formulas using Apache POI
I’m creating a method to hide the elements that are zeroed out from an excel file, but the problem that it can’t catch the values when the column is a formula. How can I get these values? My code:…
-
2
votes1
answer33
viewsUsing a connection for multiple methods in the same class and other methods
Could I have only one connection and use it in several methods? For example: The Prepared statement needs an open connection to run, so I do the getConnection(), and another method also needs, so I…
-
2
votes1
answer175
viewsI calculate two-tailed in Java
How can I do the bicaudal or unicaudal calculation in Java? This calculation is done in Excel by function INVT. This Excel function is done as follows for example: =INVT(0,0455; 4,81E+01) that…
-
2
votes1
answer583
viewsHow to refresh on another page after entering data in the database
i am creating a service system where there is a screen only to display the passwords that are being registered in the database. The problem is that I can’t update the passwords in real time, because…
-
2
votes1
answer808
viewsOrganize layout files in Android studio
Following, I have a project that will be huge in the end. currently I finished 1 module of a total of 4 modules and it is already full of layouts, etc. Follow an image just for you to be aware of…
-
2
votes1
answer193
viewsSpinner does not load data from the.xml string
My spinner only appears the arrow. no 1 has to show the States and so informed 2 shows the cities of that state This is the java code. public class PropertyRegisterActivity extends AppCompatActivity…
-
2
votes2
answers2461
viewsDelete repeats of values in Arraylist
I got the following ArrayList<Integer>: ArrayList<Integer> sequencia = new ArrayList<>(); sequencia.add(2); sequencia.add(11); sequencia.add(12); sequencia.add(13);…
-
2
votes1
answer2032
viewsHow to create style condition in Jaspersoft Studio?
How can I put a style condition in Jasper Studio checking if the value is positive put green in foreground, if it is 0 or negative put red in foreground? I pass the following to the datasource…
-
2
votes1
answer597
viewsNetbeans Error: org package does not exist
I am developing a desktop application using netbeans. I spent a few months without touching the project, and when I open it again I get the message that the org package does not exist. I’ve already…
-
2
votes1
answer146
viewsScripting language for JVM and DVM
I intend to use a scripting language attached to Java SE applications, my fear is to develop something and later have difficulties in porting it to Android platform. I am not professional in the…
-
2
votes1
answer224
viewsI would like to make a point limit for my game developed on android
I would like to make a point limit for my android game, example: when you reach 100 points he open another blank screen saying for example congratulations! but I’m having a hard time doing this is…
-
2
votes1
answer50
viewsWhat is the problem with this query of my JSP?
This is an excerpt from a JSP page that lists the log-in user’s commitments.I don’t use JSP nor do I usually select this type but I need to use it this way. <% try {…
-
2
votes1
answer151
viewsHow to set the root Stage of a controller?
I created a login screen that when authenticating redirects to the menu, but calling by the controller does not work. Main: public class Main extends Application { @Override public void start(Stage…
-
2
votes0
answers34
viewsEmbeddable Hibernate Mapping
Good morning ! I have a question regarding composite key mapping. The situation is as follows: I have a class whose primary key of the same is composed of two other classes, but I have a third class…
-
2
votes6
answers2011
viewsHibernate is not creating the tables
I am new to the subject Hibernate, for the little I have learned, I believe I did everything right, ie, I lowered the dependencies, I wrote down the classes, etc. Below follows my class example:…
-
2
votes1
answer238
viewsHow to obtain Arraylist from Listview?
I have a screen in my application with several fields, spinners and a listview, one of the spinner is products. When I select a product in the spinner and click on a button called add, the…
-
2
votes2
answers197
viewsJava polymorphism
In the context of inheritance, when B is sub-class of A, an instance of B can be used anywhere where an A is valid. This is the characteristic of polymorphism. However I have a question. I know it’s…
-
2
votes1
answer53
viewsWhy does logback use both logback-test.xml and logback.xml as configuration file name?
Reading the logback manual on configuration section, he says he looks for the following configuration files, in order: logback-test.xml logback.groovy logback.xml Why there is a suffix -test? For…
-
2
votes1
answer1149
views"Finish" method in Java
How does the "finalize" method work in Java? It is called implicitly? Below is a code with this method that I cannot understand. The class EmployeeTest calls this method, but I don’t know how.…
-
2
votes2
answers71
viewsReplace part of string with drawable or image
I receive from the database a string in formatting "text text ??? text text" and need to transform the "??" in an image or some character, the ideal would be an image or drawable that I can…
-
2
votes1
answer1072
viewsNotes JPA @Onetomany or Manytoone?
I own the Report Class public class Report{ private String nome; @ManyToOne @JoinColumn( name = "idpai", referencedColumnName = "id" ) private List<Report> subReports getters e setters... } My…
-
2
votes2
answers133
viewsAny difference between the two expressions?
int p=4,u=12; System.out.println(p=u); System.out.println(p=+u); I don’t understand the difference between the two expressions?
-
2
votes2
answers2377
viewsWhat’s the difference in using Modelandview and Responseentity?
I came across these two classes, I found their function quite equal. What are the differences between them and when is the time to use a specific?
-
2
votes2
answers808
viewsFigure out the file format without extension
I have thousands of photos on my computer but without the extension. As the extension has been deleted, I would like some Java library to manipulate those files/photos that are without extension and…
-
2
votes3
answers58
viewsShare Web Services in different projects
I have 2 designs, using Restfull Jersey: Projectox Projectoy And the module of User, this module is responsible for making GET, POST, REMOVE to manipulate the information related to User. This…