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
votes0
answers731
viewsData insertion - Foreign keys in Java
I’m having a little trouble implementing the foreign keys in my project. Daoproduct.java. public class DAOProdutoImpl implements DAOProduto { private GerenciadorDeConexao gc; public…
-
1
votes1
answer442
viewsWhat is the difference between a state (State Machine) and a class?
Would you like to know how to differentiate a state, an interface of a class, what are its main differences? How can I distinguish them?
-
1
votes2
answers82
viewsI don’t know how to calculate the distance
Chromosome chromosome = new Chromosome(); int[] gene = new int[6]; gene[0] = 0; gene[1] = (int) (1 + (Math.random() * 3)); gene[2] = (int) (4 + (Math.random() * 4)); gene[3] = (int) (8 +…
-
1
votes1
answer1033
viewsWhy is the HTTP Status 404 error occurring in my Jboss Tomcat 7 + Spring MVC application?
I’m running some tests on the MVC JBoss 7 + Spring, and locally it runs, but when I put it in the cloud, it generates the error HTTP Status 404. Organization of Briefcase:…
-
1
votes1
answer50
viewsJava - Class does not display requested information
Good morning, I need to fix a problem when I ask in "dao. Access" the get of the model class.User returns vázio = null. When it is called: doLogin(model.Access access) you see the information by…
-
1
votes1
answer104
viewsStackoverflowerror in recursive method when traversing folders and subfolders
This recursive method: public static void percorre(File caminho, String espaço){ if(caminho.isDirectory()){ for (int cta = 1; cta <= nespaço; cta++){ buffer.append(espaço); }…
-
1
votes1
answer231
viewsRepeated tags, file . windows bat do not delete some tags
I’m having a problem with a company system here which is next. The system generates labels and prints them on an Argox printer, these label printers. Are tags of requests that are generated with PHP…
-
1
votes2
answers689
viewsDate value 0000-00-00 cannot be used in java Date
First of all yes, I’ve already added ?zeroDateTimeBehavior=convertToNullin the connection URL the problem is that in the query the reset date is not null and always release the following…
-
1
votes1
answer193
viewsWhat’s that part of the code called?
Let’s say I create a class... public class Teste1 { public void Teste1(){ System.out.println("Olá"); } public void teste2(){ System.out.println("Oi"); } } The Teste1 is the constructor method of the…
-
1
votes2
answers72
viewsHow to decode a code that modifies vowels
I am trying to create a code that modifies vowels. As an example of an input would be: 2n1v5rs0 5 t2d0 0 q25 5x1st5 f1s1c4m5nt5, 1ncl21nd0 t0d0s 0s ... and the exit would be: universe and everything…
-
1
votes0
answers111
viewsConnection between Controller and other classes in the class diagram
I am modeling a project through the UML class diagram, this project is guided by the MVC standard, so that in a given Controller method I receive information, I instate a new object and insert this…
-
1
votes0
answers113
viewsWhat’s wrong with Java?
What are the problems and limitations of Java? You can work out Java, but with thoughtfulness and knowledge of the cause, without being carried away by the emotional. Preferably citing which…
-
1
votes1
answer393
viewsHow can I move an element from an Arraylist to the last element ?
I would like to know if there is any method to perform the operation, other than to concatenate manually. Example of what you wanted: [1,2,3,4] -> [1,3,4,2]
-
1
votes2
answers234
viewsWhy is the recursive function return not being used?
What happens when I call a function, recursively, without assigning its return to a variable? Why there is no need, in this case, to assign the function mergeSort explicitly the variable array?…
-
1
votes1
answer910
viewsJava - How to Capture Data from Jformattedtextfield and Validate
Good night, I have the following problem. I don’t know how to validate if the Jformatted Textfield field has something written or not, so much so that the formatting ##. ###. ###-## is not…
-
1
votes1
answer796
viewsValidate jFormattedTextField with Mascara
I’m using jFormattedTextField with Mascara but I don’t know how to validate if the whole field has been filled. jFormattedTextField // CPF JLabel lblCpf = new JLabel("CPF"); contentPane.add(lblCpf,…
javaasked 8 years, 11 months ago Júnior Nascimento 679 -
1
votes1
answer88
viewsReading via Socket
I am reading strings sent via socket to a Java server. I get a line but when I read it it comes with break, looking like two lines. What I got should be: 78780103554880201238560006d0d8 But it comes:…
-
1
votes2
answers366
viewsError on Android connection with Restfull Web Service
I’m developing an android app for a college course. I am connecting the Restfull Web Service with android using the Gson library to pass data. In the method below I am performing a POST request, in…
-
1
votes1
answer341
viewsPass the name of the item clicked on Listview Android
I have a code that I get the ID of the item clicked on ListViewand step into another Activity, but I would like to get the name clicked and not the ID. My code: if (controle != null) {…
-
1
votes1
answer33
viewsProblems with Youtube Api code - Class import
Good night! I’m trying to do a search using the youtube API, but I’m having difficulties regarding a class : "com.google.api.services.samples.youtube.cmdline.Auth;". I am not finding it on the…
-
1
votes1
answer1189
viewsWhat is the difference between Netbeans JAVA WEB and Java EE?
What is the difference between the type of Netbeans JAVA WEB project and the Netbeans JAVA EE?
-
1
votes1
answer252
viewsWorking with Generics
First, the task: Create a new Map class, now using the name Sortedmap. It should have the same methods as the Map class of the previous task, and accept as type Key a type K that implements the…
-
1
votes0
answers324
viewsScope of p:ajax update and validation
I need you to change the value of the Levelno input to 0 the factoryCode input is disabled, and otherwise nothing should happen. I have the following code: <p:inputMask id="LevelNo" size="4"…
-
1
votes1
answer36
viewsIs there any way to wipe the screen without cycling with ' n' ?
I would like to know if there are other possibilities besides for example executing a series of ' n'. public void clrscrn(){ for (int i = 0; i < 50; ++i) System.out.println(); }…
javaasked 7 years, 7 months ago jorge saraiva 478 -
1
votes0
answers92
viewsGet XML properties answered from web services server
I am wanting to capture the values of XML properties answered by the server. public ArrayList<Carga> smbcRequest(smbc smbc) { //instanciando variaveis PropertyInfo req = new PropertyInfo();…
-
1
votes0
answers130
viewsError: Content-Length and stream length disagree
If you use a Log thus rescuing the body of the sponse: Log.wtf(TAG,""+response.body().string()); Correctly prints the JSON value. Something in this format: {"error":true,"message":"Login failed.…
-
1
votes1
answer232
viewsIs it possible to recover src from a deployed . WAR file?
I’m working with a lot of legacy applications here. One of them (in production) needs to be edited because it has no log. I decompiled, but I have no idea how to reassemble in this situation. I…
-
1
votes1
answer33
viewsRole interpretation
How does this function look without the for? cycle using Objectoutputstream? private synchronized void adicionarListaContactosOnline(){ Set<String> listaContactosOnline = new…
-
1
votes1
answer39
viewsBuild Java code using Python
I want to create a python script that given a name of a JAVA function looks for it in a library and copies it to another file. Is there any way to search for JAVA functions (providing the name)…
-
1
votes2
answers212
viewsWhy of Null Pointer Exception in simple Java agenda program, and how to configure the function that returns an array of phones
Good evening! I’m having a problem with a college job, which is apparently simple (however, I’m very Noob in Java, and I don’t know what to do!). I would like you to help me, I am receiving Null…
-
1
votes1
answer318
viewsWhat does it take to learn specific classes and methods for a task?
What I need to learn about classes and methods in general for Java and Android programming? For example: if I need to display a PDF, as I’ll learn to do it? We know that there are several classes,…
-
1
votes1
answer41
viewsJtree does not update when starting GUI
I’m having a problem that I’m not being able to visualize the solution: Simply put, my Java program has a swing GUI that contains a Jtree (Treemodel customized for system directory view ) There is a…
-
1
votes2
answers371
viewsDifficulty Mounting SQL Query with UNION with SUM
I have 2 tables that stores type of different sales, and I need to add everything to get the amount to generate the charge, however I am not able to mount the sql query, follows: SELECT…
-
1
votes1
answer208
viewsHow to distribute the entities among projects?
I have doubts whether there are good practices for the distribution of entities between projects. Let’s say I have a java REST microservice that provides a client (id, name, address) through GET and…
-
1
votes1
answer71
viewsHibernate with bank
I am using creating a program that adds an information in a database through Hibernate, almost an hour ago it was working perfectly, but now when I run the code generates these errors.…
-
1
votes3
answers3098
viewsHow to use <f:setPropertyActionListener> with Passthrough Elements in JSF 2?
I am using Passthrough elements in my JSF project, and I need to do something similar to this: <h:commandLink action="#{meuBean.acao()}" value="clique aqui"> <f:setPropertyActionListener…
-
1
votes1
answer6763
viewsUnable to find or load the main file class.java
Hi, I’ve been trying to make a code run in a new environment, but I’m not succeeding. Whenever I open the cmd and execute the java arquivo.java I have as return the error Não foi possível localizar…
javaasked 8 years, 11 months ago Lucas Schneider 430 -
1
votes1
answer435
viewsPut dynamic theme Primefaces
I have two templates in my web project. I want to use a different Primefaces theme for each template. How do I do that? In the web.xml, when I put the Primefaces theme changes to all templates, but…
-
1
votes1
answer132
viewsDisplay a value with the non-zero cents and using Float?
Is there any way to make the pennies not cut with float type? I am converting a value to be formatted with Decimalformat so that it looks like the pennies this way: Float numero =…
-
1
votes1
answer127
viewsCode displaying decimal value in C# for Java/Android
I have a code that rounds up a value like decimal for homes I want, and would like to implement it on Android in Java however I’m having some difficulties, follows below the code in C#. public…
-
1
votes1
answer151
viewsPreventing an attribute from being serialized or deserialized
I am using Gson on a web service and need to prevent some attributes from being serialized and others that are prevented from being deserialized. One of the reasons to prevent serialization is due…
-
1
votes0
answers357
viewsUpdate Jprogressbar on how much to read a file
I am developing an application that will perform reading and writing of a particular txt file, which follows a pattern. I will read a file, perform some cleanups on that file, and then write a new…
javaasked 8 years, 11 months ago José Allison 229 -
1
votes2
answers75
viewsHow can I share an image via Mail, Bluetooth, etc?
I own a ImageView that has a drawable that was edited during the use of the app, wanted to take this final edition and send it by Email, Bluetooth, etc.. The way I’m doing, when I send by email for…
-
1
votes0
answers33
viewsDoubt about the Actionbar Tab
When my app opens, the Tab appears like this: But if I open a new one View and return to the home screen, it already appears like this: Does anyone know why? And how do I always show up with the…
-
1
votes1
answer509
viewsMethod that returns Java date/time
After researching several posts referring to the subject, I did not find an example where I create an "external" class (other than the main one for example) and main call the method that gives me…
-
1
votes0
answers53
viewsstack overflow problem what to do to fix it, improve performance, Java?
I know the stackoverflow is given by the memory burst but I’m with it in java and I don’t know a way to give performance so that it doesn’t occur. I’m making a software to calculate a linear…
javaasked 7 years, 6 months ago Anderson Henrique 1,367 -
1
votes1
answer498
viewsChoose an "x" file inside a java directory
So I’m doing a project and in it I would have to fetch some keywords in files. txt within a given directory, only that the name of these files does not follow a pattern and my program would have to…
-
1
votes0
answers165
viewsBackground printscreen in Java
Guys, I want to know if there’s any way I can print a program running in the background I currently use the command : try { Robot robot = new Robot(); BufferedImage bi=robot.createScreenCapture(new…
-
1
votes1
answer1990
viewsPriority queue implementation using vector
I am implementing a priority queue through an array, my method for insertion works normally: public boolean inserir(int n){ if(estaCheia()) { return false; } if(estaVazia()) { fila[nItens++] = n;…
-
1
votes1
answer163
viewsjava programming and database connection
I have a problem that’s making me miserable. Here’s the thing: I have a database and have my program in java everything connected, already created the jar file and all. But the problem is that the…