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
votes2
answers736
viewsError: non-static variable this cannot be referenced from a Static context
This code is giving error: non-static variable this cannot be referenced from a Static context When I take the static main does not look like the warnings in Netbeans, but when compiling it makes an…
-
0
votes1
answer230
viewsSpring Boot - initial test data
I am trying to pass data to test the front, but the controller is not getting the data that Spring Boot should start. My application.properties: spring.jpa.hibernate.ddl-auto=create My import.sql:…
-
0
votes1
answer45
viewsDynamic joptionpane in Java: combobox
Is it possible to make Joptionpane dynamic ? I’m having difficulty registering new entries in the countrys array[]. I’m using Java 1.8 sdk Code import javax.swing.JOptionPane; import…
-
0
votes1
answer15
viewsHow to make a button read the text field number
/** * Creates new form Calculadora */ public Calculadora() { initComponents(); } /** * This method is called from within the constructor to initialize…
javaasked 4 years, 7 months ago Glicowisky August 1 -
0
votes1
answer85
viewsWhat code do I put with the while?
I want you to have a loop when typing the number for "yes": while(resp.equals(cont)) and while(!1.equals(cont)) . import java.util.Scanner; public class umm_whilezinho { public static void…
-
0
votes0
answers7
viewsConnection error using jsch
I am trying to connect to the FTP server via sftp (JSCH) version 0.1.53 with JDK 1.5.0.22 and I have an error in connection when I try to do via SSH key authentication, but when I do user…
-
0
votes1
answer23
viewsIf it’s not working properly
Hello, guys. All right? So I’d like to ask you a question. I created the following code: import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner entrada = new…
-
0
votes0
answers42
viewsButton setVisibility inside the Simplecursoradapter listview?
I have a model_list_view.xml like this <?xml version="1.0" encoding="utf-8"?> <LinearLayout android:id="@+id/lnImprimir" android:layout_width="match_parent"…
-
0
votes1
answer127
viewsSave a PDF to Sqlite
I’m beginner and I’m having trouble saving the pdf in the bank, I don’t even know how I can do it. botaoBusca.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) {…
-
0
votes0
answers62
viewsHow to transfer data from a graphical interface to another Java file and receive it later after data processing
Creating a Java project, which has only two files: the first has a InterfaceGrafica, that takes the data that users will enter, being responsible for sending the data to the second file called…
-
0
votes0
answers8
viewsHow to increase the size of a vector running in the java language
I am making a program that manages the box of a Java store and need to increase the vector size while running without using collections... Go part of my code... How do I reference one vector to…
-
0
votes0
answers295
viewsProcess finished with Exit code 0
Hello, I am creating an application with Spring Boot Applicatio followed this tutorial: https://medium.com/@omeryazir/create-a-spring-boot-application-postgresql-spring-security-499488c30beb I…
-
0
votes1
answer2231
viewsHow to do Inner Join in Jpa Springboot
I have the following appointment: select m.id, m.nome, m.crm, e.descricao especialidade from medico m inner join especialidade e on e.id = m.especialidade_id Whose database return is like this: '5',…
-
0
votes0
answers21
viewsMy thread does not wait for code execution to finish and restarts
Thus, the following thread needs to be always running so that if the READ TEXT button is activated (it is a swicth), the Voice class that reads the text on the screen is executed, as well as if the…
-
0
votes0
answers110
viewsPersist child objects with parent id 1:N
Guys I’m having difficulty in relationships with Hibernate, I have a 1:N relationship between Provider and Address (1 provider may have N addresses). My problem is this, when I try to persist a…
-
0
votes1
answer394
viewsHow to create a custom findBy method for spring?
I can use findById in the controller but wanted to know how to create a findByQualquer to another class property. follows the code: Model: package com.leonardo.pokedex.model; import…
-
0
votes0
answers36
viewsError while deleting SQLITE base and create again dynamically ANDROID 9
I have an android Java app running for years. After migrating to android 9 (API 28), I’m having problems constantly: database disk image is malformed (code 11 SQLITE_CORRUPT) and Android…
-
0
votes0
answers52
viewsCorrupted Sqlite on Android 9 Pie (API 28)
I have an Android Java application running for years. After migrating to Android 9 Pie (API 28), I’m having the following problems constantly: database disk image is malformed (code 11…
-
0
votes1
answer49
viewsProblems for the development of the POJO with Rest Assured
Hello, I’m training with Rest Assured, I can’t show the project itself, but basically, it’s past token and some parameters per header, and the API returns various data, it would be something like :…
-
0
votes0
answers52
viewsI’m trying to make a POST request, but Postman is returning an error. Help me!
Controller: package Controlador; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.PostMapping;…
-
0
votes1
answer199
viewsInsert data into related entity @Onetoone in Spring Boot(Jpa, Hibernate, Postgre)
I have a one-dimensional relationship (1:1) where the contract has a tenant. Class User @Table(name="TB_USER") @Inheritance(strategy = InheritanceType.JOINED) public class User implements…
-
0
votes1
answer471
viewsFindby with nested object - Spring Data JPA
I’m having a doubt when creating a findBy using jpa with atríbuto of a nested object, the classes are: public class Livro { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id;…
-
0
votes0
answers31
viewsJava Random Numbers
Hello, I’m trying to do an exercise involving random numbers with the following code: int sorteio1 = (int)(Math.random() * 6) +1; int sorteio2 = (int)(Math.random() * 6) +1; int sorteio3 =…
javaasked 4 years, 6 months ago Victor Resende 33 -
0
votes1
answer64
viewsProblem with Spring Boot Mapping
Hello, I have the following project structure using Spring Boot and I’m having problems es create their Beans: project1: com.portal (spring-boot service) contem os @Controllers project2:…
-
0
votes0
answers35
viewsHeritage with modelMapper
I am creating a project in college, in which I need to register a user. In my controller I receive a User and need to convert to a type of user, being them student, teacher, coordinator or external…
-
0
votes0
answers26
viewsError generating Ireports report (Jasper) in Maven project
I am working with a Maven project and managed a print using Ireports, but when making the call it is returned java.lang.NullPointerException when trying to detail where was the error I noticed that…
-
0
votes3
answers1117
viewsTCP/IP connection failure when trying to connect to an SQL Server database
The code I made was a basic Microsoft example of how to make the connection. The driver is already installed. package connection; import javax.swing.*; import java.sql.*; import…
-
0
votes0
answers33
viewsAutomatic filling of the seat
Hello, I have a java project and I’m having a hard time. The project is based on creating the functionalities of a bank, I have done everything of the accounts and customers. I already created the…
-
0
votes0
answers21
viewsHow do I implement a timeline? Androidstudio
Good morning, I’m having a hard time understanding/implementing a timeline (Geological Time Scale) in my project. Does anyone have any references? Tips? I thought about starting developing using…
-
0
votes0
answers16
viewsRename Extent Report after running the tests
Is there any way to rename and move an Extent Report after the tests are finished? I would like the name to be saved dynamically at the end of each execution, adding for example the date and time of…
-
0
votes0
answers24
viewsWhat would be the purpose of this line of code to obtain mutual exclusion?
Hi, I’m studying for a college exam and I really need some help on one end. We are reading about mutual exclusion (in the topic of microservices), and given the following scheme: In the…
-
0
votes0
answers18
viewsHow a text input box in a jsp page can receive the value of an sql query
I want to send the result of a SELECT COUNT(*) FROM tabela for an input text box on the jsp page: On the page dao I have: public int getRowNumber() throws SQLException { int numberRow = 0; String…
-
0
votes1
answer27
viewsClass that previously referred to a stackpane seems to "lose" this reference in the future in JAVA
Hail to you, programmers! Ask for help with a Java Javafx code: - I have the controller class where all graphical elements with multiple @FXML are declared, including a stackPane variable. I pass…
-
0
votes2
answers28
viewsAccess Different Jframes objects (JAVA)
Good afternoon, Can someone help me with a project? I’m developing a simple vaccine system, but I’m having a hard time accessing attributes between a Jframe and another since in each Jframe I have…
-
0
votes0
answers19
viewsTreat Optional Null or Empty using lambda functions
Let’s say I have the following methods: public Optional<List<String>> doSomething1() { // do something return null; } public Optional<List<String>> doSomething2() { // do…
-
0
votes1
answer94
viewsError while running file. jar
I was developing a calculator in Java to study the language. After doing the whole project and exporting the file. jar and try to execute it, nothing happens. When trying to execute on the terminal…
-
0
votes0
answers20
viewsJava Criteriabuilder groupBy with Expression and Criteriabuilder.Function
I’m getting the bug: "ERROR: "movement0_.date1" column must appear in the GROUP BY clause or be used in an aggregate function". Estou usando o seguinte código para montagem da typedQuery:…
-
0
votes0
answers114
viewsError Parameter index out of range (1> number of Parameters which is 0)
I’m studying JDBC and learning how the resultset and statement, did first the method of adding and changing data with the statement that worked perfectly private void…
-
0
votes1
answer45
viewsResttemplate error
Guys I’m trying to perform a query in a time forecast API but whenever I will perform the query give me this exception Servlet.service() for servlet [dispatcherServlet] in context with path [] threw…
-
0
votes0
answers38
viewsArray in Sockets
Good afternoon, I am attending ADS EAD and I say that I have a lot of difficulty learning, I have this job to deliver and I do not know how to solve. The teacher said it’s to use this structure and…
-
0
votes0
answers18
viewsHow to get the CA certificate on android.net.http.Sslerror, in Java?
I am trying to replicate an implementation, which is in another language (Golang). In it it is possible to do the following: client := http.Client{Transport: &http.Transport{TLSClientConfig:…
-
0
votes0
answers65
viewsHow to delete a record in the Mysql database using Sweetalert in Spring Boot Modelndview
I would be grateful if you could help me solve this problem that I am not managing to do. I wanted to delete a record in the Mysql Database using Sweetalert. What’s happening is that it doesn’t…
-
0
votes1
answer150
viewsHow to make the Java Scanner read more than once in a program using classes?
I have to make a code using Object Oriented Programming, where you have a password already predefined and using Scanner you enter at least three attempts (one at a time). The program is reading only…
-
0
votes0
answers12
viewsUsing Seekbar in minute form
Everybody, good afternoon, everybody! I am developing an app for study purposes. I am a beginner in mobile programming. My app has an interface similar to the Netflix interface where I’m trying to…
-
0
votes0
answers19
viewsError 415 when sending a zipped SOAP message ( SWA - SOAP with Attachments) using apache Camel
I am doing an integration. Using Soapui worked perfectly. but when it came to java the problem of "415" occurred. In Soapui in the Attachment part I put an option called"Part" and in it a specific…
-
0
votes1
answer50
viewsError sending email using Javamailsender - Microsoft Exchange 10
Good morning! I cannot send the email. All the settings I tried to use return the same error: WARN o.s.w.s.m.a.ResponseStatusExceptionResolver - Resolved…
-
0
votes1
answer77
viewsGame modeling
The game will be fighting between pairs of characters. Classes that are required to implement the following: Personagem (abstract class) -> Orc / Humanos (interfaces) -> Arqueiro (Human) /…
-
0
votes0
answers12
viewsError: Invalid element of type passed to PDF renderer
I would like to implement the PDF download in my project, however the File is not being downloaded, and the terminal returns this error " Error: invalid element of the type passed to the PDF…
-
0
votes0
answers60
viewsJava Properties file, how to set only 1 property
am with an application that works with Properties configuration files. Imagine that I have a file with 100 properties and in a certain part of my code, I want to rewrite only 1 of these properties,…
javaasked 4 years, 5 months ago Matheus Comaru 1 -
0
votes1
answer34
viewsLock problem on the base + Springboot
Good morning, I created a Spring Boot application and through the properties I enabled the file base to check if it is necessary to upgrade the database structure. The problem is that the first step…