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
votes1
answer51
viewsSerivces on Android rebooting variables
Me developing a test application in which a Service is running in Background and is sending notifications to your phone every 10 seconds. To improve the test I created a counter that increases with…
-
0
votes2
answers60
viewsHow do I continue the repetition until no S/N conditions are entered?
I need that if none of the conditions’S',’s','N','n' is entered by the user the program keeps asking "Do you want to continue running? (S/N):" public static void main(String[] args) { Scanner sc =…
javaasked 6 years, 4 months ago Gustavo Lopes 37 -
0
votes1
answer80
viewsRead text file and copy your lines in Clipboard using Toolkit
I have a text file (txt) with 1000 lines, and I wanted to include them in the Clipboard. But from the examples I tested, only the last line is being copied to the Clipboard. I looked for something…
-
0
votes0
answers148
viewsHow to map Java classes to a specific XML format?
I’m developing a framework that manages system calls and needs to save/load the state of the instance variables in a specific XML format. I looked for tools on the Internet and found the JAXB 2.…
-
0
votes2
answers535
viewsHow to access child node in Firebase?
I have the following tree on Firebase: How do I access to list the data within the node "holes"? I am using the following data listing method: public void recuperaFuros(){ DatabaseReference furosRef…
-
0
votes1
answer72
viewsResultset object is null after Try-catch. Java
I did a query in my database and it worked, but I’m not able to use the Resultset of this query. I debugged and found that it has a correct content, but it gets null after Try catch where it is…
-
0
votes2
answers520
viewsSelect List Item by "ID" using Thymeleaf and direct to another detail page
I’m trying to build an application using Springboot, Hibernate and Thymeleaf. I would like to take the "id" of the selected service in the list using Thymeleaf, search this service in the database…
-
0
votes1
answer419
viewsDelete a user from firebase Auth when an Activity is destroyed
I have an activity call ValidadorActivity, in this Activity I do a validation by SMS, right after the user registers. The register is made by Firebase Auth however is done before this validation, so…
-
0
votes0
answers31
viewsRetofit2 accessing GET api
i am using retrofit2 to access an API... It turns out I can’t get the data from this API. Link to API used I managed to make my code work with this API: (That one), but when I redo the code to use…
-
0
votes2
answers120
viewsSpringboot - @Autowired null in configuration file
I’m starting a project with springboot and need to access some properties of application.properties because of the profiles. But when I inject the configuration class, it always comes null, I’ve…
-
0
votes1
answer59
viewsProblems with Thread in Javafx
I am creating an application to receive serial ports in computer use using the library jSerialCom. For this, I would like to keep updating this information in a ComboBox. But I can’t implement the…
-
0
votes1
answer40
viewsI have an error trying to consume an API, via js fExpected BEGIN_OBJECT but was BEGIN_ARRAY
I’m trying this error because I’m picking up (from an api) a json, does anyone help me how to solve? I’m a beginner in JSF. This is my code to retrieve the data @Named @ViewScoped public class…
-
0
votes2
answers189
viewsChange the position of the maps map by clicking
I want to change the position of the marker of the maps by clicking on the screen of the Smartphone, in my code instead of changing the position it creates several markers. below the main code…
-
0
votes1
answer45
viewsGet Kotlin presets in java
Companywebclient.kt fun find(cnpj: String, success: (company: Company) -> Unit, failure: (throwable: Throwable) -> Unit, finished: () -> Unit) { val call =…
-
0
votes1
answer72
viewsPick string value from txt
I have in a txt that is mirror of a tax printer, I would like to take the COO number corresponding only to Z REDUCTION, in the example below would like to catch only the value 031717. 02/01/2014…
-
0
votes2
answers492
viewsHow to save a list using Hibernate?
How to save an entire list using Hibernate? I’m trying to save a list this way: classe.setMinhaLista(minhaLista); classeDao.salvar(classe); And so: classe.setMinhaLista(new…
-
0
votes1
answer98
viewsHow to disable click(Touch) in a Webview?
The application is simple. Show a webview from an external website. The problem I want to disable clicks, I do not want to give the user to navigate, I just want to look at the initial page set.…
-
0
votes0
answers30
viewsuse Asynctask to fetch data but my Activity is slow to appear
I have a class RepositorioCidades searching data from cities using AsyncTask and returns a ArrayAdapter to the MainActivity, but when I call the MainActivity is a black screen until the data of the…
-
0
votes1
answer219
viewsHow to create/use schema Builder?
I’m trying to create a Builder schema, but I don’t know directly how to make one, looking at the Handbook I come across the following code, but I try to implement in my Java code and cannot create.…
javaasked 6 years, 3 months ago Felipe Jorge 1,479 -
0
votes2
answers314
viewsJVM crashing at random
# # A fatal error has been detected by the Java Runtime Environment: # # SIGSEGV (0xb) at pc=0x00007fc501ddca87, pid=2944, tid=0x00007fc4c41ab700 # # JRE version: Java(TM) SE Runtime Environment…
-
0
votes2
answers678
viewsConvert an excel file (xls, xlsx) to PDF
I have to convert an excel file (xls, xlsx) to PDF, however I am looking for a better way, however I am not sure if the following example is the best for me:…
-
0
votes1
answer176
views -
0
votes1
answer99
viewsI cannot compile a Java class which instance is another Java class
Here’s the thing, I have two classes: Account.java and Program1.java the idea is for the Program1 class to create an Account instance and use it within the program but I’m not able to compile the…
-
0
votes1
answer43
viewsIs it possible for a single button to change Imageview A to B, C, D... ? - Java/Android
Is it possible to change the same button Imageview A to B, C and so on? In the same onClickListener? My first attempt, knowing it wouldn’t work, was mNext.setOnClickListener(new…
-
0
votes2
answers104
viewsI want to understand how the instance variable and the local variable of the parameters works
public Exemplo { private int name; public Exemplo(int name) { this.name = name; } public void setName(int name) { this.name = name; } public int getName() { return name; } } I want to understand how…
-
0
votes1
answer110
viewsTake a Jsonarray and set as Arraylist<object>
Basically, I have a code that gets a JSON from an API. This JSON gets a "reposicoes" array, where it contains the information I need. An example of this JSON:…
-
0
votes1
answer103
viewsUse Highest Precision Possible on Android GPS
I’m building an app that by going through a "line", defined by an interval of latitudes and longitudes, recognizes the passage and displays it in a View. But I noticed that when passing through the…
-
0
votes1
answer50
viewsJava spring: error removing model listing object
I am having problems in the construction of the relations between the models of a project, I have a document that has several subcategories. When I save a document I want to do a validation, which…
-
0
votes1
answer815
viewsHQL with case, sum and max
I’m with a query that is giving problem, I believe the problem occurs for not allow to use the function max, within the function sum, am I correct? How can I get around this? Because I need to add…
-
0
votes1
answer2247
viewsHow to make a robot take data from a table in an HTML website
I’m trying to create a database with stock histories extracted from a website. Below is an example of what I’m trying to do. package com.gustavo.seleniumTest; import org.openqa.selenium.By; import…
-
0
votes1
answer341
viewsSelect option from c:foreach | JSP - JSTL
Goodnight, I need help with a JSTL code. I need to select an option listed by a c:foreach and send it to my Contoller. This data comes from the database. To better understand the logic, I have in…
-
0
votes1
answer533
viewsDo I need to include classes mapped in persistence.xml? Java-Eclipse-Maven-Hibernate-H2database
I’m trying to set up a Maven project in Eclipse with Hibernate and H2 Database. So I’m trying to understand the persistence.xml settings, which I had to create. One question is: do I need to include…
-
0
votes0
answers46
viewsAPP Stopping to work
What’s wrong with the code? In the IDE it appears that there are no errors but when I open the app it closes and appears the message "app stopped". public class BallControl extends Activity…
-
0
votes1
answer649
viewsJava Spring: create a file and offer this for download via api
Hello I have some documents saved in the database (with equivalent templates, they are not .txt files or anything), I would like to create . txt and . Md from the database, searching for the…
-
0
votes0
answers58
viewsHTML tags not recognized
Hello, I’m making a code with java and html and I need to make a list with Objects from Controller. I’m trying to use the tag <li> but instead of forming a list he prints out the <li>,…
-
0
votes1
answer2708
viewsAngular set value in radio button
I have a field on the form with radio Buttons: <div class="form-group" > <label class="control-label col-md-4">Tipo Atividade2*:</label> <input type="radio"…
-
0
votes2
answers250
viewsRun . java that imports another class in the terminal
I am trying to run my program on the terminal, as it matters another class I am using the command: javac -cp ./IO.jar MeuPrograma.java The program compiles the .class. However when running with:…
-
0
votes1
answer1629
viewsGenerate random characters with the Random class
I was given the following code to help in the resolution of an exercise. Random gerador = new Random(); gerador.setSeed(4); System.out.println((char)(’a’ + (Math.abs(gerador.nextInt()) % 26))); I…
-
0
votes0
answers98
viewsConnection of SQL SERVER 2014 to NET BEANS
I’m new here and this is my first question... So I can’t at all connect SQL SERVER with NET BEANS.... I put JDBC already in the library folder, followed several types of tutorials on youtube and…
-
0
votes1
answer47
viewsEJB3 Messagedrivenbean fires exception "This class is not Trusted to be Serialized as Objectmessage payload" when consuming an external Queue Activemq
I’m using a message-driven bean (@MessageDriven) to consume a queue that is in an external Activemq configured in a Docker container, and in Objectmessage it is necessary to use a pojo…
-
0
votes1
answer71
viewsHow to create a Fragment by clicking a button?
I have the following Fragment: public class ListaBimestresFragment extends Fragment { public ListaBimestresFragment() { // Required empty public constructor } @Override public View…
-
0
votes1
answer259
viewsRestriction error in relationship Onetomany Hibernate
I’m getting error in the Onetomany relationship when I try to persist an entity. Error: org.postgresql.util.PSQLException: ERROR: null value in column "book_url_id" violates not-null constraint…
-
0
votes1
answer52
viewsjson Object in array this with java error
I have a Webservice Rest with two classes: Pedido and itensPedido. In the pedido the Insert works, but when it goes to the itensPedido that I use a JSON Array with multiple items returns the error:…
-
0
votes1
answer67
viewsJava Jersey HTTP, cannot receive browser parameters
Hello I would like to receive a parameter from the browser and print using webservices with Jersey, however the parameter does not reach my method, it is not to be printed. XML <?xml…
-
0
votes3
answers3126
viewsMercosul standard vehicle plate?
I’m working on a project and I don’t know how to do it. As in the statement, I need to validate the plates with the Mercosul standard, I have a method to validate the old plates of vehicles. public…
-
0
votes2
answers82
viewsHow to update an external element to p:datatable with selectionMode="single"
I’m using the component p:dataTable of primefaces with selectionMode="single" using RadioButton as a selection. I would like when selecting a table row to update my label with the value of the…
-
0
votes0
answers95
viewsHow to close the root Stage when opening a new one in javafx?
I’m trying to create a button, which, when clicking, opens another screen. However, when opening the second screen it keeps the first. I would like to know how to close the first screen and the…
-
0
votes1
answer418
viewsChange text color in a Listview (Android)
Hey, guys, I’m having a little bit of a problem. I’m trying to change the color of a text inside a standard Listview android, however, it does not change. I tried changing the color in Layout,…
-
0
votes1
answer43
viewsCloud Firestore can’t get data out of onComplete
So my code is this:: SpinnerDialog spinner; String[] textoSeparado; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);…
-
0
votes1
answer101
viewsRest only returns XML
good evening to all, I’m making a Restfull API for mere learning and ran into a simple problem, but I couldn’t find a solution on the internet. I created this class to control games: @Path("/games")…