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
-
1
votes1
answer95
viewsUsing CDI in the app
People have a problem , on my login screen I can inject the in a good, when I step to the second screen that would be the Dash , I can not inject , he only brings me with null .... Segue Conexao :…
-
1
votes1
answer1618
viewsjava.lang.Classnotfoundexception: Could not load requested class : com.mysql.jdbc.Driver
I have a Dynamic Web Project in Eclipse and have been constantly receiving this error: java.lang.Classnotfoundexception: Could not load requested class : com.mysql.jdbc.Driver. My persistence.xml…
-
1
votes1
answer80
viewsAndroid Studio - Doubt about String’s comparisons
I have the following code static String q1 = "select * from faculdade"; if(edit.getText().toString().equals(q1)) { bar.setCurrentPosition(++position); Toast.makeText(getApplicationContext(), "Certa…
-
1
votes3
answers1411
viewsCompare an integer typed with each Enum value
Hello. I want to check if the option that the user typed corresponds to an option in the menu. I’m using Enum to show the options and the user type a corresponding number. But I can’t. Let’s see the…
-
1
votes1
answer106
viewsFilter email reading from a date
I have the following piece of code that performs the reading of emails from the inbox. try { email.conectar(); javax.mail.Store store = email.getArquivoEmail(); Folder inbox =…
-
1
votes1
answer380
viewsRelationships JPA Spring Boot Rest Fetch Eager
I’m with an application that serves a service json Rest (not quite a Rest, but okay). The application uses Spring Boot to run, use the Pagingandsortingrepository. The problem is that in serving an…
-
1
votes1
answer882
viewsDirect printing in Java
While running, the error below is displayed when sending a string printer-friendly. sun.print.PrintJobFlavorException: invalid flavor at sun.print.Win32PrintJob.print(Unknown Source) Complete code…
-
1
votes1
answer161
viewsSpinner - Line break in list
When opening the Spinner, has some options that are great, so by default he puts ".." points at the end of the item. Is there any opção padrão do Spinner for the automatic break or would have to be…
-
1
votes2
answers78
viewsHow to refer to a String through various values in Java (Android)?
I made a chatbot/virtual assistant and I want it to answer the same thing for different words, example: if I write "Hi" or write "Hello" it return the same answer: "Hello, how can I help". public…
-
1
votes2
answers1058
viewsHow to generate log files with data log4j
Good afternoon to all, I am using log4j(log4j-1.2.17.jar) to generate the log of the system, however now I need to generate the log with date and make q it generates a log every day, I need the log…
-
1
votes0
answers348
viewsHow to open an Imageview in full screen using Onclicklistener?
I have an app and would like to display an image in full screen. The screenshot below shows an application example. How could I put it in full screen, using onClickListener? And how could I do the…
-
1
votes1
answer42
viewsIs it better to repeat field or Join to access the relationship?
Hello, thinking about performance and also good practices, what would be the ideal in this scenario? 3 objects: - Enterprise - Person representing the company - Visit (object of a commercial visit…
-
1
votes1
answer70
viewsSqlite Android, 2 apps accessing a database
How do I make 2 applications use the same database? If I create the bank in an app the other one does not access this bank, then how to make this 2nd app access this same bank?
-
1
votes0
answers30
viewsError requesting the ID of a data in the database via the data STRING name
Good guys, I made a method in my webservice to get the ID of a value of a state, IE, I pass to function a name EX: "Acre" and it returns me the ID in the bank of that state. I did it, it worked cool…
-
1
votes1
answer61
viewsTransforming "26/Feb/2013" into an Offsetdatetime (2013-02-26 00:00:00)
I gave an example of the month of February, but it could be Jan, Mar, etc... I get a String with the "abbreviated" month (only the date as in the title), I want to convert this to a Offsetdatetime…
-
1
votes1
answer1003
viewsJava Printing - Docprintjob
I have this method to make impression: public void imprimir(String texto) { PrintService[] printService = PrintServiceLookup.lookupPrintServices(DocFlavor.INPUT_STREAM.AUTOSENSE, null); PrintService…
javaasked 8 years, 6 months ago Rodrigo Lima 315 -
1
votes3
answers1071
viewshow to select the entire row of a Jtable using Defaultcellrenderer which changes the color of the line
Hello, I’m working with Jtables and on such a Jtable I needed to leave some lines in differentiated colors, so I implemented the method class cellRenderModel extends DefaultTableCellRenderer { /** *…
-
1
votes0
answers91
viewsStrings in JAVA
I once worked with a program where I had a txt file with all Strings values and in the code I just referenced, so everywhere I used the same string I just needed to change in txt and still no…
-
1
votes2
answers2108
viewsCreate Bootstrap template to be used on all JSP pages of your Java app, implementing only "content/content"
Good morning, Guys, "I know it’s more of a subject of the same," but could someone help me with that question. I’m used to making templates with facelets, so I write down a xhtml file inside it,…
-
1
votes1
answer672
viewsStatic method with object as parameter
I am creating a very simple system for enrolling students. I took a class Aluno as follows: public class Aluno { private String nome; private String matricula; private String curso; private int…
-
1
votes2
answers794
viewsAccess the emulator’s Sqlite database (and other storage types)
I’m developing an app that uses SQLite, SharedPreferences, etc. On my device with access root i can access all this information with some app’s specific to it (which require root access), mainly the…
-
1
votes2
answers323
viewsHow to format resultset printing via System.out.println in Java?
Hello, I am printing on the screen the result of a SELECT that I have stored in a resultset object (sql.Resultset). But it comes out "all crooked". I tried to use the " t" between each printed…
-
1
votes1
answer250
viewsCreating a "check" method in a DAO class
I have a question when creating a method that checks if there is already a record in my database. In my database I have two tables: Table User: (id, login, password); Order table: (id, Qtd,…
-
1
votes0
answers40
viewsIs it possible to fill a tree list in reverse using stream?
The point is this My class public class Node{ private String name; private Node parent; private List<Node> children; public Node() { } public Node(String name) { this.name = name; } public…
-
1
votes1
answer225
viewsAssociation of various classes in Java
The project consists of a management system for a carrier, where an administrator manages travel, and these trips have drivers and trucks. I used association to relate the classes, but I’m having…
-
1
votes1
answer490
viewsStore values in inverted order
The objective is the following: read 10 values of a given vector, after that, create another vector, which has the same values of the first vector, but in inverted order, for example, the first…
-
1
votes2
answers1250
viewsJSF - Bar loading while executing a Java method
Good morning, I have a login screen, and when the user clicks the Sign in button, I want it to be an incone showing "loading" while the java method is running. Follow my xhtml code: <?xml…
-
1
votes1
answer88
viewsExtracting File with Progressdialog
Hello, I need to implement the `Progressdialog while the file is being extracted. My extraction code is following. Now just implement ProgressDialog, recalling that the downloaded code has already…
-
1
votes1
answer576
viewsJavascript returns the error message "Typeerror: applet.returnMD5 is not a Function" when calling Applet method
My applet is signed and all his methods are public. This error message appears for all browsers I have tested. Follows the codes: Main java. public class Main extends Applet { private String ip;…
-
1
votes0
answers360
viewsitext romaneio pdf for non fiscal printer
I am developing a romanticism for sorting orders in java with itext, it is practically ready, however the document standard is as A4, and the ideal would be for the standard of non tax printers,…
-
1
votes1
answer1159
viewsDraw lines in binary tree graphical representation
I’m trying to draw a binary tree using swing and awt in java. I can already show the knots of the tree but I’m not able to draw the lines of a parent knot to your children. I have the Node, Treegui,…
-
1
votes0
answers31
viewsActive Jdbc Association not work
Hello. I have two classes: User and Competition. I need to make a relationship between the two, as below: public class User extends Model{ } @Table(value = "competencias") @BelongsTo(foreignKeyName…
-
1
votes3
answers1170
viewsExchange Fragments Android
Good people, I’m starting with Android Studio and I’m developing a small app and I made a menu, and I would like when I click on it, open another Fragment. I’ve tried several things already and…
-
1
votes1
answer203
viewsJava arralist does not return data
My doubt consists in the following problem. I am building an application (didactic purposes). It has a Contact class that receives a String with name, a String with the phone, and the constructor…
-
1
votes0
answers41
viewsProblem calling Class Activitity
I have a class I intend to call another class through a click on one of the fragments, but it is not responding when calling the other Activity gives an error in the app and application to work. I…
-
1
votes1
answer260
viewssoftkeyboard pushing layout up
Hey, guys, I got a problem, and I can’t fix it in any way. already tried adjustpan, resize.. anyway.. I have a layout with recycleview and edittext and a few more views.. when I click in edittext…
-
1
votes3
answers1439
viewsSaving ID from a table with two Primary Keys with Hibernate
Hello, I am having a problem while saving data in one last table. Well, this table has two Foreign Keys and the same are Primary Keys: When going to Controller, save the table, I use the following…
-
1
votes0
answers411
viewsSpring Boot [ Maven (Multi-modules) ] Application management.properties
Well I have a little problem I have a project where I am using a project with Maven, Spring Boot. And inside the Maven I’m dividing the modules [multi-modules] as ex.: Persistence and Web The module…
-
1
votes1
answer371
viewsEncoding problems on the eclipse console
When reading the contents of a file to print the same on the eclipse console, I have a sharp word and it is coming out like this on the console: é um teste The correct thing to show is: é um teste…
-
1
votes1
answer300
viewsConversion of float to string - how to display two or more decimal places?
I have the code below, which returns values of type float. How can I get the result presented to two or more decimal places? private void btnDividirActionPerformed(java.awt.event.ActionEvent evt) {…
-
1
votes1
answer2439
viewsHow to reference an arrayList of another class
Personal my code is still unfinished and I am creating a library system as college work want to do as a reference to use a list array of another class in a new class. I want to use the same Book…
-
1
votes1
answer173
viewsEnable and disable Android alarms via code
I am creating an application and in a certain part I will need the application to activate and deactivate alarms (from the phone itself). I searched the Internet, but I couldn’t find anything to…
-
1
votes1
answer81
viewsError with Hibernate when running server
When running wildfly I have the following error snippet in the log: 15:46:18,297 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC000001: Failed to start service…
-
1
votes0
answers34
viewsSonarqube validating methods from other JAVA files
I am developing a sonarqube rule, but I find myself with the following problem: If a method of one class calls another method, I want to validate if the so-called method exists, but I only have…
-
1
votes2
answers1746
viewsCalling an Activity within a Fragment - Android Studio
I need from the click of a button inside my Fragment, it call an Activity. My code is like this: public class ActFoto2 extends Fragment implements View.OnClickListener,…
-
1
votes0
answers28
viewsBIRT - Report Parameter - Listbox Dynamic - Select All
I am creating a report in BIRT, where in the report parameters (filter screen) I have a Listbox that is dynamically loaded, so the data will suffer variations and it is impossible to leave the…
-
1
votes1
answer266
viewsGet String from strings.xml file
I’m trying to get one back String of the archive strings.xml for this variable SQL_CID. <string name="insert_cid">" INTO `CID` (`COD_CID`, `NOME_CID`, `CODIGO_CID`) VALUES(1, 'CÓLERA DEVIDA A…
-
1
votes0
answers81
viewsHow to select a runtime class based on a Requestparam using Spring MVC?
Let’s say I have the following @Restcontroller in my code that uses Spring MVC: @RestController public class Exemplo { @RequestMapping(value = "exemplo", method = RequestMethod.GET) public…
-
1
votes1
answer40
viewsAdd "filter" to "logger" for the entire application
I would like to make the Filter of java.util.logging.Logger filter all generated log lines. In this case, I am using a Wildfly application server. Currently, I can filter only one specific class,…
-
1
votes1
answer500
viewsLogin screen problem, if logged in user redirects to telaInicio
Good afternoon, I am with a system, I was able to filter in case the user is not logged in to the session, redirect to login screen. Only now I’m trying to do the opposite, in case the user is…