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
votes0
answers729
viewsHow to Connect the SQL Server Online Database from the JDBC in Netbeans
I have a question about how to generate the JDBC Java connection URL in the Netbeans IDE to connect to an online SQL Server database. Below is my code, which did not generate a connection like the…
-
0
votes2
answers397
viewsUse of Enum in the case of a switch
Hello, good afternoon. I have a problem regarding the use of ENUM to replace a number in the case. In order to make my code more intuitive and not use numbers in switch cases, I intend to use an…
-
0
votes1
answer175
viewsSend Activity parameters to a calculation class
I’ve had a question for a while, I posted it here once, but it hasn’t been solved. I would like to pass a parameter from an Activty to a calculus class (this class does not have Activity , it is…
-
0
votes1
answer143
viewsProblems acquiring data from a Javafx Label
Good afternoon, I’m starting a simple example for data acquisition of a Label in Javafx, but I’m having difficulties, most of the sources told me to perform as follows: public class MainApp extends…
-
0
votes1
answer550
viewsIs it possible to inject a bean into a Singleton with Enum?
We have a system that uses Struts 1 and enum-based singletons. Now we have a dependency that was written using Spring 4.3.6.RELEASE that should only be used with other systems that also use Spring,…
-
0
votes1
answer514
viewsError accessing local variable in anonymous class
For some reason netbeans asks to transform the variable i in the end, but if so, I cannot edit it. Follow the error: Error: local variable i is accessed from Within Inner class; needs to be declared…
-
0
votes1
answer143
viewsArraylist giving error
I’m doing a little program with a database and I can’t seem to get my list to appear in one jtable. I created the method and at the time I call my method it error, someone can help me code this…
-
0
votes2
answers928
viewsJava Rest Client Receiving a Localdate
I’m doing a test client in java. My book class is like this: public class Livro { private Long id; private String nome; @JsonFormat(shape = JsonFormat.Shape.STRING,pattern="dd/MM/yyyy") private…
-
0
votes1
answer68
viewsError Spring MVC Rest Full
Good night, I’m trying to compile a code to run a simple Rest in spring mvc, but found with the error "The request sent by the client was syntactically incorrect." Class Controller package…
-
0
votes0
answers73
viewsDatabase connection error
When trying to make a connection to the dodo bank I have the following error: java.sql.SQLException: No suitable driver found for jdbc:oracle:thin:@delphix-db-1.homolog.infra:1521:BRMQA10 at…
-
0
votes1
answer755
viewsReturn only the first data from a JSON and JAVA array
I have a project where I search the database via JSON, to export this data in Excel format. I am adding a new search, however I have a string array, but I cannot bring the database data back to me…
-
0
votes3
answers400
viewsMake a Static method in the main class that writes on the screen all even numbers from 1 to 10000 that are palindromes
This is my method: public static void B() { int vet[]=new int [100]; int vet2[]=new int [vet.length/2]; for(int i=0;i<=vet.length;i++) { vet[i]=i+1; } for(int i=0;i<vet.length;i++) { int rest…
-
0
votes1
answer147
viewsSELECT in multiple SQLITE tables
I have a table of clients and I make a list of all the items in this table in SQLite I need to list these customers, also search for the lowest date, related to the customer, in another table.…
-
0
votes1
answer286
viewsError reading XML with JAXB: all null items after Unmarshal
I have a simple XML stock file with the following format: <?xml version="1.0" encoding="UTF-8"?> <estoque> <item Nome="Impressora XL2N" Peso="13 kg" Armazem="8" Quantidade="12"…
-
0
votes1
answer90
viewsProgressidialog does not quit 0%
I am uploading an image to the firebase database and I want to show it in the file but it always stays 0/100. progress=new ProgressDialog(getContext()); progress.setMessage("Downloading Music");…
-
0
votes1
answer323
viewsJava Array List: How to show a Jlist the values and Positions of the String Array
I made this code in class: public class Dados { ArrayList<Contato> contatos = new ArrayList(); public void cadastraContato(Contato contato){ contatos.add(contato); } public String…
-
0
votes1
answer1621
viewsregex java replace all
String url = "/users/{id}/books/{id_book}"; url = url.replaceAll("{\\w*}", "\\w*"); System.out.println("result url:" + url); Trying to replace with regex, and returns me the following error:…
-
0
votes1
answer69
viewsBuble Sort Arraylist - Java
I need to sort an array based on the Date field of the same, for that I made this code. SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy"); for(int i = 0; i <…
-
0
votes2
answers117
viewsProblem when calculating time
I am doing an exercise that receives a value of the radius of the sphere, and then do operations with formulas already proposed by the exercise. So far so good, at the time of rotating, wheel quiet,…
-
0
votes0
answers225
viewsFormat Number Java
I’m studying java and doing some exercises. I am doing an exercise where I passed 2 values to be formatted, However when I run the program gives the error below, if I step only 1 value works, but…
javaasked 7 years, 7 months ago ROBSON CESAR 1 -
0
votes1
answer179
viewsHandling of JAVA Attributes
Good afternoon, I’m with a college job and it’s the first semester I’m learning java. The job basically is: Make an interface that would represent any geometric figure, in it specify methods of area…
-
0
votes0
answers96
viewsProblem uploading a photo to a web server
Hi! I’m having a problem uploading a photo taken from an android app to a web server. On the local server it usually sends the photo, already on the web server, it sends only one photo and only…
-
0
votes0
answers42
viewsthe message is not updated when sent to more than one screen
I explain it better in the image. But here’s the thing. I have a Bt to add fruit. Whenever a fruit is added, a new canvas opens for it. but here’s the problem: ALL FRUITS ADDED MUST APPEAR ON ALL…
-
0
votes1
answer124
viewsJasper with javafx does not open by jar
I have a strange problem, I made an application with javafx and jasperstudio and when running inside the eclipse works perfectly. When generating the . jar and run, it works, but if I remonear the…
-
0
votes2
answers122
viewsHow to safely store AWS credentials in a Java application?
I have a Java Desktop application that is distributed to customers. I need, from now on, send data from this application to Amazon S3. For this you need to set the credentials AWS (accessKeyId and…
-
0
votes1
answer39
viewsAfter the validation method is true, how to cancel sending the data to the database?
I have the application already made. The class Produto, ProdutoDAO and a method validaProdutoPorDescricao() JButton btnCadastrarProduto = new JButton("Cadastrar");…
-
0
votes2
answers82
viewsRelationship problem Manytomany - Java
Good evening guys, I was making a table that lists the doctors and how many patients they have, but at print time only comes the doctors, does not come with the list of patients. Classs Paciente:…
javaasked 7 years, 7 months ago Matheus Lage 3 -
0
votes1
answer1050
viewsMysql Web related error
Hello, I am trying to connect a java class with a Mysql BD from the db4free.net host but is returning the error below: SQLException: java.sql.SQLException: java.lang.ClassCastException:…
-
0
votes1
answer93
viewsHibernate Mapping - One to Many/One to One/etc - Explanation
Basic example to understand how Hibernate mapping works. Table Person Sex table The mapping for these tables generates: Sex: public class Sexo implements java.io.Serializable { private Integer…
-
0
votes1
answer78
viewsField List of a jsp
This field is filled in correctly by a query made in the DAO. The problem is that you are not accepting the object as null or as the value by the ID. The entity’s field is Man Entity @ManyToOne…
-
0
votes1
answer266
viewsTwo-dimensional array size is not being defined
I created a matrix and put it to initialize with the values passed in the constructor, but it is not initializing. I created the object, played the values, but when I call the method to show the…
-
0
votes1
answer290
viewsPick only numbers from a String (Tokenizer)
Hello, I’m doing a project with stack and queue, and I’m in a part I need to pick up the operator and put in a pile and the number in a queue. However this part of taking the number is not working,…
-
0
votes1
answer61
viewsPassage of parameter Drawable object
I created a method to encapsulate a notification message (Notification.Builder). An excerpt from the code is shown below: public void exibirMensagem(String titulo, String texto,Drawable icone) {…
-
0
votes1
answer3397
viewshow to take a textField value and move to an int variable?
How do I get the value typed in a field of the type JTextField and move on to a variable, so I can do calculations later? I tried to use getText(), but the variables being int, do not receive the…
-
0
votes0
answers361
viewsCapturing server exceptions via Java HTTP request
Hello, I have a system that reads XML files, transforms into JSON and makes HTTP (POST) requests to another server to save the data in the database. But some XML files have, for example, null fields…
javaasked 7 years, 7 months ago Lucas Hananni 5 -
0
votes1
answer58
viewsRemove n lines from a string
Given a String as template: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <soapenv:Header> <X-OPNET-Transaction-Trace:X-OPNET-Transaction-Trace…
-
0
votes1
answer65
viewsObject is not completed
I have the following form from my page: <h:panelGrid columns="3"> <p:outputLabel value="Código" for="codigo"/> <p:inputText id="codigo" value="#{encomendaController.encomenda.codigo}"…
-
0
votes2
answers281
viewsMy program gives error when the array value is null
I have a program that takes reports from a system, I’m including one more table in the program. The data that is read, comes from a array but sometimes it is empty, and when it gives this the…
-
0
votes2
answers368
viewsHow can I extract the information from an XML that is stored in a String?
I’m consuming this one xml of a api and storing its contents String Its structure is this way: <opml version="1"> <head> <title>Título</title>…
-
0
votes0
answers127
viewsProblem using a numerical box combo variable with decimals in GX Ev3 u11
I identified a bug when using a numeric combo box variable with decimals in GX Ev3. In Ev1 and Ev2 versions the same example works perfectly. I am not good at writing, but I will try to describe the…
-
0
votes1
answer74
viewsError nullpointer when query in database with parameter
When I run the query below I have a nullPointer error. @Query(value = "SELECT * FROM x WHERE USER_NAME = :name", nativeQuery = true) DataBaseCobilling findByCdIdent(@Param("name") String name); But…
-
0
votes2
answers755
viewsHow to make a button or a checkbox become inaccessible in android studio?
I would like it to be confirmed that the choices of both Uttons and checkboxes become inaccessible/irresponsive/inactive. I know you can do this using if, but I believe there must be some function…
-
0
votes1
answer50
viewsReferences lost at persistence time
Below follow my entities and their relationships: Order: @Entity @Table(name = "encomenda") @XmlRootElement(name = "objeto") @XmlAccessorType(XmlAccessType.FIELD) public class Encomenda { @Getter…
-
0
votes1
answer26
viewsI have 2 problems that when trying to submit the fomulário
well I’m having little problem here on my form in fact would be 2 problems. 1 - I am using an autComplete, and then I can get my object through the search, only that at the time of submitting my…
-
0
votes1
answer196
viewsupdating by filling in information after using the autocomplete
I am creating a form in JSF and primeface, and I have here an autocomplete. Only when I finish filling out my autocomplete, I want you to render a part of my fomulário. Until now I was able to hide…
-
0
votes1
answer242
viewsI am trying to add a Listview inside a Viewpager Ragment and returns me the following error. Any suggestions?
3-22 17:00:33.850 24857-24857/br.edu.br E/Androidruntime: FATAL EXCEPTION: main Process: br.edu.Unilab.intercampi, PID: 24857 java.lang.Nullpointerexception at…
-
0
votes1
answer443
viewsPrint a Java Object List
When making a filter of courses belonging to a given shift , the correct thing would be to make a foreach by walking through an object , but by doing so he gives an error ';' expected , I didn’t…
-
0
votes1
answer2850
viewsWebservice Post Office - Tracking
I am trying to consume the web service of the Post Office - Tracking. On the net Benas imported the WSDL in new->client to Webservice. The problem is that Webservice is returning the empty list,…
javaasked 7 years, 6 months ago Guilherme kreusch 3 -
0
votes0
answers61
viewsError: HTTP Status 500 - org.json.Jsonobject cannot be cast to jdk.nashorn.api.scripting.Jsobject
In my java system appeared this error: I’m sweating the POSTMAN tool to study the case. HTTP Status 500 - org.json.Jsonobject cannot be cast to jdk.nashorn.api.scripting.Jsobject Code: import…
-
0
votes0
answers54
viewsSend String Arraylist via UDP in java
Hello, the question is this: How do I send an entire Arraylist via Server UDP to the Java client? Can send a String only at a time and works very well. However, I don’t know how to send a String…