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
answer51
viewsScanner isn’t picking up all the lines
I have a file with 7 million lines, but my code takes at most 63000 and returns no error. Scanner sc2 = null; try { sc2 = new Scanner(new File("./assets/words.txt")); } catch (FileNotFoundException…
-
1
votes1
answer388
viewsDuplicate value in the bank when inserting new users with an already used Role (Spring-Security)
Hello I’m creating a simple web application with Springmvc and Spring Security. I did the User and Roles class as follows: @Entity public class Usuario implements UserDetails { private static final…
-
1
votes1
answer1218
viewsHow to put " in a String?
I’m trying to evaluate a PHP code using Java, for that I need to replace in the code all " for \". The problem is that Java also has this escape character to put " in a String. Told me to use \\",…
-
1
votes0
answers32
viewsModify the user-agent in the upload in a Soap Jax-rpc request
I have a problem, I have a project in java that sends Soap requests by Jax-rpc format. Since now I have to modify the user-agent that is sent in the request. I already googled and…
javaasked 7 years, 4 months ago Paulo Rogerio 307 -
1
votes2
answers180
viewsHow to ignore sentence and case in Java . startsWith
This is my code: if(e.getMessage().startsWith("/reciclar") || e.getMessage().startsWith("/ereciclar")){ e.setCancelled(true); p.sendMessage("§cComando Bloqueado/Em Manutenção!"); } But if you use…
-
1
votes1
answer392
viewsError connecting with Firebird database
I’m trying to create a web application and want to use java and html. Good after everything set up and ready for a small connection test the following error occurs: Fev 09, 2016 1:28:02 PM…
-
1
votes0
answers177
viewsProblem with table generation (tutorial algaworks)
I’m reading the book Java EE 7, with JSF, primefaces and CDI. I got to the configuration part of Hibernate, but I’m having problems. I configured my application in a J2EE environment, with JSF and…
-
1
votes0
answers68
viewsWhat are Specifications, Frameworks and Interfaces?
Recently I started to study and research a little bit about Java EE, and some of the most appearing terms are: Specifications Frameworks and Interfaces I read about it, but I’m still confused.…
-
1
votes0
answers139
viewsDynamically connect to the database by the Spring project’s Repository class
I need to connect to the database in a dynamic way, where the database connection data can be passed by parameter, below is an outline of how to need the connection and execution of the query. This…
-
1
votes3
answers303
viewsWhen I roll my listview I miss checkboxes marked
This is a code from my Adapter, in it I have a textview and 4 chekboxes. The problem is that I believe I have to save the status of my checkboxes, not to lose the data from it, because when I roll…
-
1
votes1
answer2212
viewsIs it possible to convert an image to a string in JSON format?
I wonder if it is possible to convert an image to a string in JSON format. If so, could you explain to me how? (if possible with example codes). I need to do this to send these images to a web…
-
1
votes1
answer981
viewsReport details are not displayed
I set up a report in Jasper Studio 5.6.0, and imported my generated *.jrxml file to the IDE where I am developing, but everything that is put in the session "Details" the report simply does not…
-
1
votes1
answer64
viewsSwipe Refresh in api 15
I am making an application that uses Swipe refresh a lot, I would like to know how to implement Swipe refresh in Androids with api 15? If it is not possible how can I create the Swipe for android…
-
1
votes0
answers47
viewsProblem to convert date to Brazilian standard using JAXB
I’m having trouble converting xml to object using JAXB. The date comes in the format Sun Jan 30 16:08:23 BRT 18, and want to convert to Brazilian format 12-08-2009 16:08:23. JAXB Conversion Class:…
-
1
votes1
answer49
viewsJava is not splitting a String correctly
I am trying to split a string using the following character "|" But java is understood to divide letter by letter. List<Curso> cursos = new ArrayList<Curso>(); List<String> pacotes…
-
1
votes1
answer84
viewsHow to make a regex that accepts one line but not two?
I get lost doing any complex regex. I use the following code in java: Pattern pattern = Pattern.compile("tentativas de regex aki"); Matcher matcher = pattern.matcher(conteudo); while(matcher.find())…
-
1
votes1
answer1682
viewsjava.lang.Runtimeexception: java.lang.Classnotfoundexception: org.postgresql.Driver
I created the DAO, MODEL, CONTROLLER packages and a test It runs normal with the server, persists in the normal bank but through the viewing layer. I wanted to test in main running with java…
-
1
votes1
answer184
viewsRepeated ID with facelets
The problem is that in a project I use facelets is telling me that there is a component with the repeated ID. Although I scanned the code behind the repeated ID, I couldn’t find it, so I believe the…
-
1
votes1
answer276
viewsProblem printing the contents of a vector
How to make a score accumulator for each answer. package modulo02; import java.util.Scanner; public class vetorGabarito { public static void main(String[] args) { int pontuacao = 0, n, i, j = 0;…
-
1
votes1
answer861
viewsWait for the execution of a method to be finished, before being able to re-export it again
I am developing a data synchronizer, basically the synchronizer will every 5 seconds check if there are data to be synchronized. However, my doubt consists in how I will do for when the…
-
1
votes2
answers167
viewsData does not persist in txt file
Good morning, I’m having a question, I have this code, which is a contact book and the data should be persisted in a txt file. What happens is that the program runs normally, but the data is not…
-
1
votes1
answer193
viewsHow to leave my Activity in 2 plane by executing a function ?
My project is to put a Webview in Activity and when I quit the application, and it stay at 2° plan updating from time to time the Activity so that the site that is Webview also updates. someone help…
-
1
votes0
answers34
viewsAudioinputstream.close() not working (Unable to delete file)
I’m having a problem with an Audioinputstream. After making the adjustments I need, I give a AudioInputStream.close() (equivalent to InputStream.close()) so I can delete the file later. But in doing…
-
1
votes1
answer42
viewsHow do I know when the user touched outside of Edittext?
I need to identify when this happens. I have two Edittexts, when the user type the time and minute and tap another Edittext example name, I need to appear a warning if the time is incorrect. I have…
-
1
votes1
answer864
viewsHow do I call a progressBar inside the Dialog?
I wonder if there is any way to call a Progressbar inside a Alertdialog... If so, how do I?
-
1
votes0
answers329
viewsJAVA - Is there any way to send a print to Windows Spool?
I wonder if there is any way to send a print to Windows Spooler via java... I tried via Socket, Printwriter and everything, but I can’t send it to Spool, only directly to the printer!!!!
-
1
votes2
answers612
viewsHow to make unique record query
I have a JSP that on the same screen I register for consultation. When opening the screen I have basically the fields for the registration below a grid with the list of the bank, so far so good,…
-
1
votes1
answer95
viewsHow to block my app if you don’t have internet
I’m creating an app that needs internet, If this person’s mobile phone is without internet the application would not start because it would only open if it was with internet. How does that help…
-
1
votes0
answers133
viewsLoad a DLL from inside a jar
Hello, I am currently working with a project where I need to create a java API for image processing and after that I have to integrate it into a mobile module and a web module. But when I tried to…
-
1
votes0
answers61
viewsError when registering an RMI Service
I have the following Class representing a service: public class HelloImpl extends UnicastRemoteObject implements Hello { protected HelloImpl() throws RemoteException { super(); } @Override public…
-
1
votes2
answers680
viewsJavafx how to close an internal Anchorpane
Hello folks my doubt is have a child Anchorpane that is added inside the parent Anchorpane in my son Anchorpane I have a button called close. How do I close Anchorpane Son without closing Anchorpane…
-
1
votes2
answers416
viewsItem chosen in Spinner be a global variable
Good afternoon, everyone , I have an Activity that has a Spinner , the value chosen in this Spinner is sent to another Activity in which I do getIntent and receive the value of Spinner , my doubt…
-
1
votes1
answer281
viewsConvertnumber JSF negative values
Negative monetary values when using the native JSF converter, <f:convertNumber type="currency"/>, stand with the character '-', before R$. For example: -R$ 56.134.726,99 .xhtml…
-
1
votes0
answers141
viewsSpringsecutiry and JNDI Authentication Problem
I have an authentication problem when I add the datasource in my project, it happens that when trying to login the authentication is performed but not the transition to the post-login page. I use…
-
1
votes2
answers189
viewsGenerate files with all permissions
I am generating *.csv files from this: BufferedWriter strW = new BufferedWriter(new FileWriter(caminhoCSV.toString())) However the generated files are only with read permission, how could you change…
-
1
votes1
answer268
viewsjava Response json out of order
Guys I’m making a java API to be consumed by Excel. I’m making a bank select by bringing the columns in the right order, but when it arrives in Excel it arrives in a half crazy order. I also made a…
-
1
votes1
answer1827
viewsGenerate PDF report with Jasper Reports and spring
Hello, I have a problem generating a report with Jasper Reports in spring. I did the implementation exactly as stated in method 4 of this explanation: https://stackoverflow.com/a/27532493 When I…
-
1
votes1
answer495
viewsWEBSERVICE REST - JSON - JAVA
I’m developing an Android app where devices can communicate with each other via messages (Instant messenger). My application is already connecting with the web service (I developed it using…
-
1
votes0
answers22
viewsAPI JMF or Something Similar Cross-platform
I have a project to do in java, I will need JMF to work with the media in general, the project is nothing more than a program to run the advertisements on TV’s that are in malls and etc. I was…
-
1
votes0
answers75
viewsError communication Socket
I have this piece of code: public class Consulta extends AsyncTask<Void, Void, Void> { @Override protected Void doInBackground(Void... params) { try { Socket cliente = new…
-
1
votes1
answer78
viewsSet the initial time of a Chonometer with the text of a textView
Hello, I wonder if it is possible to define the initial value of a chonometer based on a textView. texView who would like to set the beginning of Chronometer in blue highlight. This textView…
-
1
votes0
answers23
viewsI cannot use debug in a library
I need to debug a lib I just created, I’ve done these steps: *Here is what worked for me: (After having clicked debug at least Once before) Open the debug view in eclipse (use the menu at the top:…
-
1
votes1
answer97
viewsMultiple cast in java
I’m having a hard time doing an exercise because I don’t know how to solve this kind of casting: The class D is the superclass. The class C is the subclass. D d = (D) (C) new D(); I’d be grateful if…
-
1
votes0
answers108
viewsError retrieving from Webservice
I’m trying to create a Webservice REST, but I’m having trouble returning the result. The moment Webservice returns the information, it sends the following error:…
-
1
votes1
answer311
viewsSet cryptographic key fixed
The code below is working perfectly for both encryption and decryption, however, when closing the app and putting the generated code before closing it (I open the encryption app a word and close the…
-
1
votes1
answer106
viewsDynamic graphical user interface after Mysql request
People are the following, I’m wanting to upload all this data in my graphical interface, the idea is that the user type the Cpf(Primary key) of it and after that is loaded all this data for it to…
-
1
votes1
answer675
viewsRead json with GSON library
How do I read this code with the GSON library? { "profissao": { "jornalista": [ "escritor", "legal", "fotografo" ], "programador": [ "focado", "exatas", "articulado" ], "maquinista": [ "senai",…
-
1
votes2
answers2942
viewsHow to read the json below with the GSON library
How to read the json below creating the professional class through the instances of the class I would like it to be in GSON without using HashMap - KeySet(); { "profissao": { "jornalista": […
-
1
votes2
answers127
viewsClass that cannot be serialized
Next, I’m studying a project involving javaWeb, with jsf+primefaces. I’m using the apache tomcat 7. The problem is happening when starting the apache service to then test my application, in which…
-
1
votes1
answer153
viewscreateQuery(HQL) returns Nullpointerexception when trying to perform LEFT OUTER JOIN
Personal talk, I have a problem trying to run an HQL on my application. The HQL is basically this: select c.id, c.solicitante from <mypackage>.Exame c LEFT OUTER JOIN…