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
votes3
answers818
views -
2
votes1
answer1715
viewsHow to read page by page from a PDF with Pdfbox
Good Afternoon. I wonder if anyone can help me. I need to extract data from a PDF file, but I need to read page by page from the file, if anyone can help me thank you. public static void main(String…
-
2
votes4
answers1376
viewsApplication with Tomcat and Spring Boot
Hello! I am having following problem in my application. After running the main method just below and enter in the browser the address of my application localhost:9090/restaurantWeb is opening a…
-
2
votes0
answers39
viewsHow to put an Alert when clicking to exit the App
Some Apps when exiting the physical button of the device appears a bar below in the first click of the user, asking the user to click again to exit. How do I schedule this event?
-
2
votes1
answer241
viewsImport github code for eclipse Oxygen
I have a code that I would like to import into my eclipse by downloading the zip, however at the time of importing the following error No Projects are found to import Searching for git features ,I…
-
2
votes1
answer257
viewsPlace object array in combobox
I have the following method for adding objects to a JComboBox: public void PopulaCategoria() throws SQLException{ for(Categoria categoria : caDAO.getCategorias()){ comboCategoria.addItem(categoria);…
-
2
votes1
answer286
viewsCriteria Bringing Duplicate Hibernate Data to JSF
I am receiving duplicate data or sometimes missing data until, how can I solve? This is my DAO: public List<Produto> filtrados(Filtro filtro) { try { Criteria criteria =…
-
2
votes1
answer177
viewsI can’t access static content in spring-mvc
How do I access static content from spring-mvc? For example a css. I have the following spring configuration: import java.util.Properties; import javax.sql.DataSource; import…
-
2
votes2
answers678
viewsWhat is the most efficient way to take information from any website and use it in an Android APP?
For example: An app that accesses the site https://dolarhoje.com/ and take the value of the current dollar and show in the app. What are the ways to do this?…
-
2
votes1
answer94
viewsObject problems using java sockets
I’m trying to pass the person object that was instantiated on the server to the client. But I’m not getting it. Below are the classes I used: Server public class ServidorTCPBasico { public static…
-
2
votes1
answer1100
viewsPick up Jtable’s line after Filtering Data
I’m wearing a TableModel(not the DefaultTableModel) which I populate with data from banco (MySQL), I also use a Class to filter through what I type into a JTextField. It is working correctly, but I…
-
2
votes2
answers822
viewsMake a consultation with Ibernate criteria with Spring
Good evening, friends, I have a question. I have a Class called Proposal and another Customer Call. In the client there is the CPF field and a Proposal has a Client. I need to search for…
-
2
votes2
answers992
viewsPass parameters to jar file
I have an example project ready (very simple), however I would like to make a connection configurator with the database. Once compiled, the system creates a.jar file and I would like to know how to…
-
2
votes2
answers1181
viewsCompilation error: The literal ... of type int is out of range
CadastroDePessoasFisicas c2 = new CadastroDePessoasFisicas("636.363.635"); System.out.println(c2.getNumero()); System.out.println(c2.getNumeroValidador());…
-
2
votes2
answers895
viewsJunit unit test for default system routines
I have a Java code that checks if there are standard categories registered in the database, if yes it returns true, if he doesn’t return false. public boolean validaEntradaDeDadosPadrao() {…
-
2
votes1
answer61
viewsHow to pass schema by paramentro in PLSQL?
I have a function that receives a varchar2 value with the Schema name to save the data in the database but in the schema. create or replace FUNCTION hospitalTeste123(MatriculaMedico in number,…
-
2
votes1
answer120
viewsConnection to the PL/SQL database via a JAVA application. SECURITY ISO 27001
My java application is currently connecting with a pl/sql database, username and connection password are in the jdbc file: jdbc.username=xxxxxxx jdbc.password=xxxxxxx jdbc.url=xxxxxxxxxxxx and…
javaasked 8 years, 4 months ago Lucas Fantacucci 435 -
2
votes3
answers103
viewsI’m not able to log data into the database
I’m a beginner in java and I have the following problem. On the state registration screen, I have a country selectOneMenu, and two fields for name and acronym. When I go to save in the database I…
-
2
votes0
answers101
viewsDocumentation framework for java REST API
Hello, I have a java project, with REST Apis. I wanted to create a documentation wiki (markdown+Swagger) on Apis locally, including also a way to test the API (console API/explorer). These are…
-
2
votes1
answer764
viewsHow to create a prefix for the url using spring boot
I learned to use the spring doing all the configuration in java classes and now I’m migrating to the spring boot 2.0.2. I would like to know how to create a prefix in the URL that has the name of…
-
2
votes1
answer942
views -
2
votes1
answer105
viewsEntity Repository Spring Error with Relationships
I have a project using Spring Boot to serve JSON on a Webservice. An error occurred when adding the Repository class. If you remove it the program starts normally (no errors in the console, I don’t…
-
2
votes1
answer336
viewsDelete chunk from a string with replaceAll
I have a string, example: &texto-outroTexto=09213sdadwqWDQS Where "09213sdadwqWDQS" would be any text and "&texto-outroTexto=" would be a fixed text. I wanted to do the Regex of that string.…
-
2
votes4
answers788
viewsConvert Int to String
I’m trying to make a button to register to the bank but am having difficulties in converting the int to String. follows my line of code: private void…
-
2
votes1
answer53
viewsRead file located in another Package
I have 3 Packages, one where the Gui class is located, another where the data reading "scripts" (in main) and photos and text files in the Resources. File file = new…
javaasked 6 years, 5 months ago André Moreira 51 -
2
votes1
answer2676
viewsWeb Service Tracking Couriers
I have often read the manual of use of the web mail tracking service and I couldn’t understand how I can access the user and password. I’ve been trying for days to understand and I can’t.…
-
2
votes1
answer39
viewsHow to delete a SD Card file?
I have an application that saves information from a requested table within Sqlite in a CSV file and then that file is transferred to an FTP. I need this file, stored in my SD card, to be deleted as…
-
2
votes0
answers105
viewsApplication runs on eclipse but does not run on Intelij
I am migrating from eclipse to Intelij and my application runs normal in eclipse, and when I deploy on server, but it does not run on intelij. No error message, log only. package br.com.ramires.pac;…
-
2
votes1
answer96
viewsFix Jbutton that is running 2 events
I have an application where in a Jframe I create new records for mysql table, and in another I return a select JTable with all records created. I have a change button, which when I select a Jtable…
-
2
votes1
answer99
viewsWhy is it that when I change the size of the window, the components are gone?
I built an application using windowbuilder eclipse. In it, when clicking with the mouse, a picture is drawn according to the last selected button. However, when I change the window size, all the…
-
2
votes2
answers257
viewsQuicksort in Java does not work
I’m trying to implement the quicksort method, but the code I wrote is not working, someone can help me (it sorts part of the sequence, but some elements remain cluttered). public static void…
-
2
votes1
answer517
viewsError running . jar on Windows Powershell with Maven
Good afternoon to all. I am trying to run this tool (CPA - https://github.com/CityPulse/cpa). Through the link provided, I download the classes. After that, I run Maven, which generates a .jar. The…
-
2
votes1
answer448
viewsInitial focus on the Joptionpane OK button
I got the following JOptionPane: As you can see the focus is on the Cancel maestro option I need this focus to be on OK, but I have no idea how to do that. My code: JPanel panel = new JPanel();…
-
2
votes1
answer641
viewsInvert characters from a String
I have a code I made to invert a String, but it does not meet what I need. I need it to convert the order of the characters of each sentence. For example: He converts "Hi guys!" into "! laossep Io".…
-
2
votes1
answer184
viewsPOO in Java - World Cup Modeling
I am entering the universe of Object Orientation and, moved by curiosity, I decided to try to simulate the organization of a World Cup through these concepts. Well, I’m having some difficulties with…
-
2
votes1
answer564
viewsAutowired spring boot in Jframe
In the development of a Spring Boot application for Desktop, it is possible to inject a @Repository in a class JFrame? If yes how? Some alternative? Code examples: @Repository public interface…
-
2
votes1
answer1439
viewsRequest Post API Messenger with Spring Boot
I need to create a post method that returns this information to the Messenger API with Spring Boot, if anyone can give a light thank you. The example below is found in the Facebook Developers…
-
2
votes1
answer80
viewsCopy content only from the superclass in java
There is a way to copy only superclass content in another class of the same type through a subclass instance in Java, without accessing getters and setters one by one? Example: public class A {…
-
2
votes2
answers660
viewsClassformaterror: Incompatible Magic value 0 in class file
My project was working normally. After restarting my machine, running it through the IDE returns the following: Exception in thread "main" java.lang.ClassFormatError: Incompatible magic value 0 in…
javaasked 8 years, 4 months ago Vinicius Leonardo 233 -
2
votes2
answers436
viewsConvert float value to String
I’m programming for android, and I’m trying to display a float value found by function getX() in a Toast, which only displays String values. How do I do this conversion?
-
2
votes1
answer911
viewsMysql Does Not Connect by getConnection() Netbeans Java
I’ve been trying for a while to get my Mysql database connected by getConnection(). I’ve tried several different ways, to put the name of the bank, I’ve seen several tutorials including tutorials…
-
2
votes0
answers52
viewsRun Activity from another app
Is it possible to run an Activity from another app? I don’t want to call it through an Intent, something like this: public class AnotherActivity extends com.otherapp.app.ActivityName { // Aqui vai…
-
2
votes2
answers51
viewsHow to modify the last item of a sequence in Java?
Guys, I don’t even know if that’s the question I have to be sure about, but come on... I want to get the following output: "V V V V!". First I created a simple algorithm just to simulate the output,…
javaasked 6 years, 4 months ago Van Ribeiro 1,482 -
2
votes1
answer1079
viewsInsert background image in Jpanel
I already checked and the path is correct, but when I run nothing appears on the screen: public class MapaInterface extends JPanel implements ActionListener { private Image fundo; public static…
-
2
votes0
answers900
viewsHow to fix Failed to execute Goal org.codehaus.mojo:exec-Maven-plugin:1.2.1:exec error?
I’m making that mistake: ------------------------------------------------------------------------ BUILD FAILURE ------------------------------------------------------------------------ Total time:…
-
2
votes1
answer88
viewsCreate Jlabel under image
I created a 672x750 Jpanel and put a 672x672 image inside it. I need to put texts under the image, in the space that remains. Is there any way to create a Jlabel and position it below the image? I…
-
2
votes2
answers124
viewsSend data from one method to the other in the same Activity
I know that to send data from one activity to another is the following: String value = filename; Intent intent = new Intent(getApplicationContext(), ReceberNome.class); intent.putExtra("nameFile",…
-
2
votes2
answers502
viewsWhen to validate fields from a swing form?
I was wondering if someone could help me with the validation of forms fields in java desktop. When should I perform validations, in the field (focusLost) output or in Keystroke(keyPressed), or other…
-
2
votes1
answer65
viewsRegistration with Validation
currently my system has Person and Time, a person can already create a Time, defining some attributes(name and passwordTime). Now, I aim to create a "Join Team" method where someone will join an…
-
2
votes1
answer91
viewsSlow opening of Jframe with Hibernate
Good morning to all. I have a Swing application that has a Jframe using Hibernate 3 for networked Mysql BD persistence. When I run through Netbeans, it opens very fast. But when I run the jar built…