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
votes0
answers266
viewsHelp with Exception in thread "AWT-Eventqueue-0" java.lang.Numberformatexception: For input string:
I am concluding a code in java but I came across the error above and I am not able to solve. When I check the checkbox the fields are formatted, when I uncheck I get the exception above. Can anyone…
-
0
votes2
answers89
viewsHow to read a txt file store the value in the whole type?
I’m using this example: try { AssetManager assetManager = getResources().getAssets(); InputStream inputStream = assetManager.open("nome-do-arquivo.txt"); InputStreamReader inputStreamReader = new…
-
0
votes1
answer1259
viewsConvert String to Date (request.getParameter)
I have a form in JSP that makes a register that has a date. <form method="Post" action="InserirCompromisso"> titulo : <input type="text" name="titulo" required="true"> local : <input…
-
0
votes1
answer13
viewsError in javaEE context-root using Jboss
I have an error project, I have error messages in the configuration files: 404 - Not Found jboos-web.xml web xml.…
-
0
votes0
answers1549
viewsImplement action to save button
I’m new to programming and built the image GUI from an example of the college book, but the save button has no functionality. And I ask help to implement on the button save some code that saves the…
-
0
votes1
answer76
viewsProcessor decimal percentage problem - JAVA
Okay, guys, here’s the thing, I developed a code to pick up the percentage used by my processor core application: private String getCPULoad() { OperatingSystemMXBean osBean = (OperatingSystemMXBean)…
-
0
votes0
answers75
viewsHow do I convert Date to String ? (Java Language)
public class Passageiro { public static void main(String[] args) { Viagem passageiro = new Viagem(); passageiro.nomePassageiro = JOptionPane.showInputDialog("Digite o…
-
0
votes2
answers259
viewsConsume web service
I come as an idea to deploy in a system that I am setting up a web service, where the user informs the zip code, and address fields if completed. However I find nothing about how to do this in…
javaasked 7 years ago Rodrigo Prado 192 -
0
votes1
answer199
viewsXML SOAP -> WEBSERVICE REST
I wonder if it is possible to send an xml in the SOAP pattern to an "endpoint" in REST? Or if the best way would be to create Webservice in SOAP so as not to mix the protocols? I ask this, because…
-
0
votes0
answers366
viewsHow to get Result from Controller Vraptor with Jquery?
I have a controller. Newslettercontroller.java @Controller public class NewsletterController{ @Inject private Result result; @Post("/gravarEmail") public void gravarEmail(String email){ String…
-
0
votes1
answer722
viewsJavascript in JSF page - Primeface
HTML code - JAVASCRIPT It reads a txt file from the computer and puts its value in an html input <input type="file" id="files" name="files[]" multiple /> <input type="text" required…
-
0
votes2
answers537
viewsHibernate does not close connections/sessions in BD
I’m in big trouble using hibernate. Each time I call a method that performs a query or update in the database, Hibernate opens a session in the database and then does not close. I’ve tried…
-
0
votes1
answer140
viewsError to popular jtable with database
I have to make a client registration application in JAVA, I am using eclipse. The problem is in the method listarCli(), because when I comment on this method the error does not appear. The error is:…
-
0
votes0
answers85
viewsError rotating screen with open fragment
I am using the simple model of Fragment. There is one that is the List, and another Viewer . Fragmentactivity : if(pFragVisualizar==null){ pFragVisualizar = new FragVisualizar();…
-
0
votes0
answers444
viewsFolder ".m2" for the file Settings.xml in Windows Server 2008?
I have a Java EE application with Wildfly-10.1.0.Final server that uses this folder to add the file settings.xml , but inside Windows server 2008 I don’t have this folder in user, how could I do…
-
0
votes1
answer419
viewsProblems with p:selectManyCheckbox using Enum
Good evening, I’m making a registration page but I came across a problem on p:selectManyCheckbox <p:outputLabel value="Nome" for="nomepa" /> <p:autoComplete id="nomepa" size="40"…
-
0
votes1
answer239
viewsHow to access inherited attribute in an entity with a query in Spring Data
Guys, I have the entity Client that extends Pessoa: @Entity @Table(name = "cliente") @PrimaryKeyJoinColumn(name="id_pessoa") @Document(indexName="cliente") public class Cliente extends Pessoa…
-
0
votes1
answer66
viewsProblem with SUM in Namedquery
I have the following NamedQuery: @NamedQuery(name = "Controle.listarTotais", query = "SELECT controle.prestador, controle.tipoPrestador, SUM(controle.valorLote), SUM(controle.valorPago),…
-
0
votes0
answers41
viewsHow do I get the switch back to the "fake" state?
I created a switch that turns bluetooth on and off. However, when connecting, it asks the user if he really wants to activate bluetooth. If the user clicks no, the switch remains active and the app…
-
0
votes0
answers57
viewsHow to use Jprogressbar with audio readings in excel
I have a method that receives an Excel file, and a Jtable. This method reads the file and plays the data contained in it within jTable. import java.io.File; import java.io.FileInputStream; import…
-
0
votes1
answer111
viewsHow to select multiple checkBoxs?
I have a loop for, in which I create a new checkBox every time it goes through the/loop routine. I am adding these "checks" inside an item of a treeTableView. I wanted to know, how could I mark all…
-
0
votes0
answers400
viewsError: Could not find or load main class com.eventoapp.Eventoappalication
I’m with this error I can’t run my application. Error: Could not find or load main class com.eventoapp.Eventoappalication My class package com.eventoapp; import…
-
0
votes0
answers316
viewsJAVA - error starting Hibernate application
I am having problems starting my application with Hibernate. I am programming in Java using Eclipse. Error message: Sep 20, 2017 2:40:36 pm org.hibernate.Version logVersion INFO: HHH000412:…
-
0
votes1
answer51
viewsHow to get the amount of garbage already generated at a time from Java code?
So people, I’d like to know if you have any method or even way to get the amount of Garbage generated at the current moment of the code. If you do not know but if you know any DOC that I can study…
-
0
votes0
answers108
viewsHow to generate random numbers in Java without repetition?
I wonder how to generate random numbers without repetition I’m trying this method but it seems to me not working properly. public static ArrayList<Integer> numerosAleatorios(int inicio, int…
-
0
votes1
answer148
viewsUsing Progressbar
I would like to know how to create a progressBar where, when clicking a button to open another screen, the progressBar was showing, and when opening the other screen, the progressBar exit the…
-
0
votes1
answer78
viewsError trying to post a php page through Android Studio
Error 03 - 12 18: 44: 46.688 23858 - 23891 / com.natanielsoares.eceller E / AndroidRuntime: FATAL EXCEPTION: AsyncTask #3 Process: com.natanielsoares.eceller, PID: 23858 java.lang.RuntimeException:…
-
0
votes1
answer91
viewsHow to open an Activity from a calculation?
I am very lay in android studio and I need to do a program on an IMC calculation. The idea is simple, in the first Activity he asks for his weight and his height, after that he must do the imc (imc…
-
0
votes2
answers453
viewsCapture, as string, xml-specific tag
You only need to save the signature tag of an xml. The method for signature is this: private void assinarMdfe(String tipo, XMLSignatureFactory fac, ArrayList<Transform> transformList,…
-
0
votes1
answer651
viewsSet cursor focus position in Edittext
Is there any way when I call the virtual keyboard (SoftKeyboard) set the cursor position? I have a EditText which is already filled in by default the number 10, when the keyboard starts I want the…
-
0
votes2
answers1163
viewsError calling another screen
I’m trying to call a second screen in Android Studio, but this giving error. This is the main class: package br.com.olamundo.parametros; import android.content.Intent; import android.os.Bundle;…
-
0
votes2
answers259
viewsHow to return a vector to another vector in Java?
I’m doing a program that applies hill climbing, but the value I need to compare to see if the previous one is better than the next one is a vector double My method to find the best value returns an…
-
0
votes1
answer238
viewsJoptionpane cancel button
In the following code, it asks to be filled in the name, but if you do not enter anything, and I click cancel it returns a message (The name you entered was Null). My question is how do I stop when…
javaasked 7 years ago Wenderson Almeida 3 -
0
votes0
answers700
viewsNfe XML Parser for Object
I am trying to parse an Nfe XML parser for the Tnfeproc object, and I always get the error: java.lang.IllegalArgumentException: can't parse argument number: {0} at…
-
0
votes2
answers748
viewsLimit access in app areas to different users
I’m working on an app project for a company and I ended up getting into a problem I didn’t find how to review it. I would like to limit access to certain parts of the app to different users. Ex.:…
-
0
votes1
answer2375
viewsSocket/Threads (Client/Server) Java
I have a very cruel doubt. I did a lot of research and found nothing similar to solve my case. What I need is this: Customer side sends card number and purchase value The server side receives this…
-
0
votes1
answer47
viewsFunction result JAVA Android
I have a simple question for those who already understand Java but this breaking my head. Being direct, I have my Mainactivity and a layout with two Edittext’s and a button, and a Systemshttp Class.…
-
0
votes1
answer83
viewsJPA entity generating column with double name id_municipio_id_municipio
I have an entity called districts that contains a relationship with the municipality table. When I run the database the districts table creates the id_municipio_id_municipio field and it was to be…
-
0
votes0
answers200
viewsProblem setting value of a mysql BIT field
Use Java + Hibernate in my systems, I created an attribute boolean to determine whether a user is an administrator: private boolean isAdmin; The Hibernate generates tables and fields, and this isAdm…
-
0
votes1
answer49
viewsHow do I click an Imageview that doesn’t interfere with the application?
I have a Linear Layout <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/linear" android:orientation="horizontal"…
-
0
votes0
answers957
viewsError: Unable to find or load main class
have tried: Unable to find or load the main file class.java I’ve tried the system and it still works like when I use it javac arquivo javac -version java -version everything works more when I use…
-
0
votes1
answer405
viewsHow to declare and instantiate a Double vector?
I’m trying to fill a Double vector with 1’s, but I don’t know how to declare and instantiate the variable. double betaParcial[] = null; // 'linha' seria o tamanho do vetor, e pode assumir qualquer…
-
0
votes1
answer934
viewsChange the size of an array at runtime
I’m making a java application, and I used netbeans to build the screen. On this screen I have a button that generates random numbers and puts them inside an array, but I can’t change the size of it…
-
0
votes1
answer50
viewsHow to use custom properties from Demoiselle.properties
I wonder how I could use the class of demoiselle.properties to use my custom properties. Ex.: # Propriedades personalizadas do sistema sistema.id.documento = 10 sistema.processo.seguranca = true //…
-
0
votes0
answers52
viewsError in project configuration
What I’m missing, I couldn’t find the mistake. Dispatcher-Servlet.xml <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"…
-
0
votes1
answer201
viewsError while using Simpleemail
public void enviarEmail() throws EmailException{ SimpleEmail email = new SimpleEmail(); email.setHostName("smtp.gmail.com");//o servidor SMTP para envio do e-mail email.addTo("[email protected]",…
javaasked 7 years ago Guilherme Wayne 167 -
0
votes2
answers452
viewsComparison request.getParameter with JSP string
I’m wanting to pick up what the user will type with request.getParameter and compare with a String and if the value the user enters is equal to string, the user is redirected to the page but this is…
-
0
votes1
answer33
viewsApply Asynctask to code that receives double vestments
I have many doubts about how to apply the concept of AsyncTask. I’d like to know what that code would look like on AsyncTask. Thanks in advance // Metodo da ação do botão Calcular public void…
-
0
votes1
answer6370
viewsWhat good . this in java
Hello, then, I’m starting in java and would like to better understand what is .this. I imagine it has something to do with the current class or something like that. But I’m not sure. I’ll post a…
-
0
votes0
answers827
viewsWhy does the image get bad quality?
Well, the question is simple, why is the image in low quality? Code: Main class: @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode ==…