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
votes2
answers558
viewsBreak inside method that returns Boolean
I’m trying to make a loop for, who at a certain time returns true, and out of the loop. Example: public boolean autentica (Usuario usuario) { for(i=0; i<listaUsuarios.size ; i++){…
-
4
votes3
answers1464
viewsHow to control volume to app media on Android
I’m like a doubt on how to control the volume of the app’s media. I’m using this method: Button button1; MediaPlyer mp; button1 = (Button)findViewById(R.id.button1); button1.setOnClickListener(new…
-
4
votes2
answers686
viewsFull Date Return Type
How do I get that return? 2014-08-05 18:29:47.757 Using the Date. Date data = new java.sql.Date(new java.util.Date().getTime()); Using that my return is just 2015-02-03 and does not return the…
-
4
votes1
answer1933
viewsAccessing Webservice by Android - KSOAP2
I am creating an Android APP and have to connect with the web service of my company to make the login system, I am using the lib KSOAP2 3.3.0. The path of my WS is for example as:…
-
4
votes3
answers1850
viewsHow to test the Service layer in a web service application, using mockite and junit
I have a class of services that will receive a dependency injection from an object responsible for the persistence layer. In this service class are all my methods that will answer the web service’s…
-
4
votes1
answer2408
viewsWhy should I use getResource()?
In Java it is nothing unusual to see codes that carry images, audio files, XML and other things like this: final ImageIcon programLogo = new ImageIcon("res" + System.getProperty("file.separator") +…
-
4
votes1
answer1090
viewsNon-static variable cannot be referenced from non-static context
I’m using a context where I have an array type variable with reference to another class. When trying to declare the instantiated object of the class and declare its size is returned this error and I…
-
4
votes1
answer2747
viewsWhat are the API’s to create a graphical Java interface?
There is some other tool besides Swing, AWT and Javafx to create desktop graphical interface for Java applications?
-
4
votes2
answers2516
viewsWhat are the differences between Inputstreamreader and Java Scanner
I was aware of the data reading by Scanner, know superficially its functioning, however I came across some examples using a class called InputStreamReader for data reading. What are the differences…
-
4
votes2
answers472
viewsHow to expand the window by clicking a button?
Is it possible to expand a window with more information when the user clicks a "Details" button? The behavior is similar to that of some error screens, which show the data of an error, as shown in…
-
4
votes1
answer128
viewsWhat is the best way to follow the software flow?
I have a big project, how do I follow the flow (step by step)? I have several classes and have no idea which methods are called, which classes are etc. I put a breakpoint in a point that I know goes…
-
4
votes1
answer292
viewsJtable does not save information when focusing on the cell
My JTable does not save information when there is focus on the cell. To effectively save the information I need to focus manually and then click on the "Register". How can I make this process…
-
4
votes1
answer4154
viewsHow to convert a Java project to Eclipse for a Maven project?
I have a Java project in Eclipse that I want to convert into a Maven project. For conversion, I right-click and select the option "Convert to Maven Project" as shown in the figure below. The problem…
-
4
votes2
answers1267
viewsSize of an Arraylist
In Java... What is the initial size of a ArrayList? Reaching the maximum size, when it "expands", its size is doubled?
-
4
votes2
answers2271
viewsTake printscreen on Android by API
I have a app and one of the functions would be to printscreen screen. How to do this?
-
4
votes2
answers1914
viewsMultiple JDK/JRE
Can I have multiple JDK/JRE facilities? because I have two different software and one depends exclusively on the 32bits version (aptana studio 3) and I’m already using the 64 bits version in the…
-
4
votes1
answer176
viewsPredicting an outcome through probability
I wonder if there’s a way, from a sequence of 10 numbers I can predict the supposed next 10 numbers. These 10 numbers are in a range from 0 to 100. Explaining the situation better: Every day 10…
-
4
votes1
answer84
viewsJava class for performance analysis of my project
I’m looking for a Java class or bundle to help me analyze the performance of my app. I need information such as: processing time, memory consumption, processor usage ... and so on. I know there are…
-
4
votes1
answer248
viewsChoosing encryption in SSL
How can I define exactly which encryption I will use in the routine below? I want to define for example that the encryption to be used is the AES, or DES, or 3DES... // Setup truststore KeyStore…
-
4
votes1
answer2681
viewsHow to run a back bean method from a Javascript function?
I am developing a web page with canvas in HTML 5, it will be presented dashboards in real time, for this use Managedbean to return the respective values, I have a component developed in JavaScript…
-
4
votes2
answers2442
viewsRun a java Jar by Delphi
I wonder if there is a way to execute a jar by Delphi and give commands to it as if it were a command line. The truth is that I have a java application that no longer has access to the code and it…
-
4
votes1
answer812
viewsCapture Accent Words with Scanner
I’m using a Java Scanner to capture Words/Phrases, but when I type in a word it contains or 'ç', the letter turns into a 'square'!
javaasked 9 years, 7 months ago Nickolas Carlos 632 -
4
votes2
answers272
viewsJava Infinite Loop
Guys how do I take the Infinite Loop out of this class? Every time it is the last database information he keeps sending email. public class Dia06 { public static final long TEMPO = (14 * 1440);…
javaasked 10 years, 1 month ago Wesley Costa 159 -
4
votes1
answer188
viewsHow to Distribute RIA with JNLP and Java 8
I developed an application and at the time of distributing with JNLP, I found an impasse. With Java 8, it asks to sign the Jars and the certificate must be from a recognized CA. I signed the Jars…
-
4
votes1
answer134
viewsHow to get the value of the attribute "Lazy" of the datatable primefaces in the bean?
To get the attribute value selectionMode datatable (primefaces) in MB: DataTable dt = (DataTable) FacesContext.getCurrentInstance().getViewRoot().findComponent("IdForm:IdDataTable"); String sm =…
-
4
votes2
answers72
viewsGeneric, extend to an X or Y
How do I get my generic class to only receive guys who extend X or Y? Example: class MinhaClasseGenerica<T extends ClasseX ou ClasseY> Sorry if you got a little confused, I’m new yet, I can’t…
-
4
votes1
answer1025
viewsConvert PDF to DOC
It is possible to convert a PDF to a word document by keeping all formatting, alignments, fonts and tables in the converted document, using apache-poi or some other api?
-
4
votes2
answers412
viewsProblem when changing the type of a column in the model using JPA annotation
I have a column in the database that is limited to receiving a varchar(255), but I need to change this to a bigger size. For that I added these annotations in the field: @Column(nullable = true,…
-
4
votes1
answer575
viewsUse of @Transactional Demoiselle
I’m having trouble using the note @Transactional Demoiselle. When I was managing the transaction "in hand" with a EntityManager injected, everything was fine. But now using the @Transactional, the…
-
4
votes2
answers1347
viewsFind out how many days passed from one date to another
In a java program, where the person first inserts the day, then the month, then the year, how do I know how many days passed from that date inserted until another later date that will also be…
-
4
votes1
answer173
viewsProblems with new in Java
Why every time I use new in my class, for example: if(e.getSource() == levelButton) { new PainelNivel().setVisible(true); } Java executes this command, i.e., shows the class Panel and opens the…
-
4
votes1
answer2475
viewsHow to popular a Jtable using a . txt file?
I wonder how do I make to popular one JTable using a pre-existing text file. I have a query table and I want the user when placing the account number, it shows the data on Jtable and also how I can…
-
4
votes1
answer396
viewsXA transaction does not commit changes in procedures (intermittent)
I have an EJB Stateles that monitors files that fall into a folder. When a file arrives it is handled, a receiving event is recorded in a central database and the file is inserted into a target…
-
4
votes1
answer125
viewsHow to implement the 'auto complete' feature in a Jformattedtextfield?
I need that when I type in JFormattedTextField pop up text suggestions. It would be possible to do this?
-
4
votes2
answers798
viewsSyntax error when creating table in Postgresql using Hibernate
@Entity public class User { @Id @GeneratedValue private int id; private String name; private String email; private String sex; private int age; private Date birthday; private Date registerdate;…
-
4
votes3
answers1367
viewsProblems to implement convert to selectOneMenu
Good afternoon. I’m having trouble implementing a selectOneMenu of objects in my xhtml. Keeps giving "Conversion Error". Could someone tell me the problem of the code below? Error code: Erro de…
-
4
votes2
answers466
viewsHow to go through Arraylist with daughter class
Next, I have one ArrayList student type (which is an abstract class), and I have two daughter classes (EstudanteGraduacao and EstudantePosGraduacao), when I’ll add them to ArrayList it’s quiet, but…
-
4
votes4
answers1394
viewsHow to concatenate two byte arrays in Java?
I have: byte mensagem[]; byte nonce[]; How do I concatenate the array nonce at the end of the array mensagem and store in a third array?…
-
4
votes2
answers1591
viewsWhat happens when I convert String to an array of bytes?
I have: String msg = "Texto a ser encriptado"; byte array[] = msg.getBytes(); What happens when I convert the string to an array of bytes? I’m concerned about an application I’m developing. I need…
-
4
votes1
answer3345
viewsHow to write the percentage symbol on a string in Java?
How to make the string accept the percentage symbol '%' ?
-
4
votes1
answer1778
viewsChange text and background color Tooltip
How do I change the background and text color of a Tooltip? I already did a search and found here a chunk of code but I can’t change it. Colors always stay the default Netbeans. Any suggestions? I…
-
4
votes1
answer824
viewsCreate Dto by Constructor with a List parameter of a Hibernate entity
I have a @Query Spring, which performs a database query by an Entity, to create some Objects DTO. And the properties of this DTO object, I pass via Constructor, but I needed to pass as parameter in…
-
4
votes3
answers249
viewsHow do you make sure the person who used the system is really her?
At the university where we are studying, we are developing a system in Java EE to reduce bureaucracy in some enrollment processes, extinguishing forms and generating PDF forms that, instead of going…
-
4
votes1
answer1239
viewsIs there a Java function equivalent to var_dump()?
Does anyone know if there is a Java function equivalent to var_dump()?
-
4
votes1
answer841
viewsDifference between calling the Fragment call and a new instance
I’m working on a college project where I made an app that uses Ragments. I’ve always been used to creating a Fragment as follows: // imports ... public class LoginFragment extends Fragment { public…
-
4
votes5
answers26088
viewsRegistration problem (Column Count doesn’t match value Count at Row 1)
I am having the error "Column Count doesn’t match value Count at Row 1" when I try to register. I already checked my comic book and everything seems to be in order but nothing to solve this mistake.…
-
4
votes1
answer617
viewsHow to set a char in a Preparedstatement?
My typical variable is a char how to set this in Preparedstatement ? PreparedStatement ps = conexao.prepareStatement(sql); ps.setString(1, veiculo.getTipoCombustivel());…
-
4
votes1
answer174
viewsChicken Escape - Backtracking Problem
I am implementing a problem in Java. The problem consists of an Nxn board, where a chicken and X wolves are placed. I get the size of the board, the position of the chicken, the number of wolves and…
javaasked 10 years ago Pedro Webber 41 -
4
votes1
answer2506
viewsInsert data into a table from a Java form (Netbeans+SQL Server)
I have a form created so that I can enter data about a client and from this form open a table with a button that has the data, so far I have been able to link the buttons. Now my question is how I…
-
4
votes2
answers1251
viewsJavafx Threads Update UI and load System in the background
I have a Stage Main that is my Login: In the FXML of that Stage I have a Region and a ProgressIndicator with the property setVisible(false) After successfully logging into the application the…