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
-
3
votes1
answer5577
viewsHow to change the default postgresql schema in persistence.xml in a java application
I am developing an application and I have a certain difficulty to change the default scheme of the application. I am using Postgresql in a Java application with JPA and Hibernate as implementation.…
-
3
votes4
answers3679
viewsConsume values from a webservice
I have no knowledge in the use of webservice, and I need to use one now to consume data from a database(Normally I would fetch the data directly from the database, but in this case the admin did not…
-
3
votes2
answers1253
viewsAttach TXT file using Javamail
I’m using Javamail for sending email, with attachment, on Android. When attaching a file with extension ". txt" it is assigning the content to the body of the email, not as attached file. My file…
-
3
votes1
answer2686
viewsPositioning of components using Gridbaglayout
I’m making a panel and I want to have the following layout: The width of the panel takes up the entire width of the frame, and I want to have 4 buttons in the right corner of that panel. I created a…
-
3
votes0
answers821
viewsHow to return an imported value from one JSP page to another?
I have two JSP pages: in one it checks a condition of client links, if it has no link, it enters a function that calls another JSP to import client data. He even imports the data but, when he…
-
3
votes1
answer1275
viewsRestricting data access with REST
I would like to know if it is possible to restrict access to my application data REST. For example, I have the xml/json that she returns in http://meuapi.com/usuarios, where you return my user list.…
-
3
votes1
answer6083
viewsSend an Arraylist of objects to an Activity
How to send an Arraylist of objects to an Activity on Android? ex: I have an Arraylist of Books objects, I want when I click this object arrayList to be passed to another Activity..
-
3
votes1
answer1357
viewsDynamic graphical user interface in Java
I need to create something like this: I usually do the GUI’s with the help of the IDE but in this case I can’t(I think), because I need the GUI to repeat an undefined number of times, depending on…
-
3
votes2
answers432
viewsCreate a set method for different variables
I’m looking to create a Setter for an object Character, where it will modify the attributes String name, int intellect, int strength and int stamina, but what is the best method to do this? public…
-
3
votes1
answer716
viewsHow to communicate between classes?
I’m starting at Javafx and I’m having doubts. The main class creates an Hbox with a button. This button has the action of creating a TableView in the Center of bdPrincipal. Only they are in…
-
3
votes1
answer470
viewsProblem with transition animation between Fragments
I’m working on an app that consists of several fragments and decided to put animations between them. Looking, I found that I should use the command setCustomAnimations to get the desired result, but…
-
3
votes1
answer1276
viewsMark (colorize) a string to write to the file
My application searches for a few words in a file. When the program recognizes these words (strings), it should mark it. For example: change the font color or change the word background color. Then…
-
3
votes2
answers595
views@Named does not work JSF
I am doing a project with jsf 2 and glassfish server when I put @Named in my bean the attributes get null only works with @Managedbean someone has already gone through this problem
-
3
votes2
answers1038
viewsJava Timestamp and Mysql Timestamp
Problem: I’m storing a timestamp in MYSQL, but when I reset this timestamp I’m losing the thousandths. Java timestamp with thousandths. MYSQL timestamp without thousandths. Why does this occur? How…
-
3
votes1
answer180
viewsGeneric type in Java
I have 3 classes, Expression, Operation, Scalar public abstract class Expression<R extends Expression> { public abstract R calcular(); } public abstract class Operation<T extends…
-
3
votes3
answers2485
viewsHow to insert res/string string in the String[]{} array;
I’m trying to put my Strings in an array to use on Adapter and I can’t. I’m doing like this: String cores[] = String[]{getString(R.string.cor1), getString(R.string.cor1)}; but it’s certainly not the…
-
3
votes1
answer100
viewsMethod not found using JPA
I created a method for autocomplete. However when I invoke this method it is not found, follow below error: Advertência: /pessoal/cadastrar.xhtml @35,186…
-
3
votes2
answers5778
viewsHow to send Jsonobject to a Web Service?
I am trying for the first time to consume a Web Service in my Android application by sending data by JSON format. To accomplish the task I have a class to make the connection. public class…
-
3
votes1
answer1286
viewsSocket connection causes an exception on Android
The code below works perfectly when only used with a Jbutton, but when passing to Android happens the exception (Exception). I have located that the error is in clientSocket = new Socket(serverIP,…
-
3
votes1
answer439
viewsJframe Paint method does not show the drawings on the screen
I overloaded the method paint and I’m using the Graphics2d class to try to make the drawings, but nothing is being drawn on the screen, I could see with the Debugger that the method is run…
-
3
votes1
answer71
viewsFilecopyutils of Spring With strange behavior
I don’t know if anyone here uses the Filecopyutils offered by Spring, but I’m using it in a imaging replication method in my system. It aims to "grab" the images that are in my system’s temp folder…
-
3
votes1
answer283
viewsJava JNLP Application and Database
I will start developing a client/server application and in my searches I found Java JNLP. I searched some forums but did not find the answer to this question: Knowing that the application will have…
-
3
votes1
answer426
viewsAndroid Mediaplayer class alert: Should have Subtitle controller already set
After I upgraded to Android Kitkat (4.4), a class object MediaPlayer Android generates the following alert on Logcat: Should have Subtitle controller already set As explained in that question of the…
-
3
votes2
answers35944
viewsTaking time in format: HOUR:MINUTE:SECOND
I currently use this code: // Pega a hora Date hora = new Date(); hora.getTime(); He returns it to me: Thu Aug 28 21:55:42 BRT 2014 I would like a way to get only hour, minute and second. How to do…
-
3
votes2
answers567
viewsJava server disconnects idle users after 5 minutes
I’m using this Java methodology for connection between client and server, I copied it from the internet, and it helped me a lot, but the server allows the user to stay connected while he’s sending…
-
3
votes1
answer2814
viewsVia java reflection, set and take values of inherited variables
I have the following class hierarchy (POSTRequestHTTP extends ReqeustHTTP) (RequestHTTP extends ComunicationObjectHTTP ) Assuming that each object can have variables corresponding to an item in a…
-
3
votes1
answer1301
viewsMysql Local Database and Online Server Connection
I’m developing an application using Java Swing + Mysql database, but I’m analyzing making an online platform that talks to the local application, using the database to interconnect the data, because…
-
3
votes1
answer115
viewsBinding on Spring MVC not working
Well, I have a problem that never occurred to me before related to the Spring MVC Binding. I have a form as below. The bindind "firstName" and "lastname" work well, but already the "logins.email"…
-
3
votes1
answer1561
viewsjava.lang.Nullpointerexception Error in JDBC Connection with WS + Postgres
I am creating a WS that connects to a DB Postgresql and performs a query in a single table. I try to run it locally, but the problem is when running the application gives the following error: HTTP…
-
3
votes1
answer724
viewsTimetask scheduling Java Tasks
I’m trying to set up some task cycles in Timetask so that it happens every day at a certain time, could someone give me a tutorial or some example that employs this question ? What happens is it…
-
3
votes1
answer585
viewsHow do I add a different object to a list whenever using the add?
I’m having trouble adding a different object to a list of objects whenever I use her add, I know what the problem is but I don’t know how to fix it, follow the code List class public class Lista {…
-
3
votes1
answer524
viewsEclipse app for iPhone
I’m in need of some help, and I don’t even know what to do. I created a very simple Eclipse Kepler, I put in Google Play and it was great. I would like to know if it is possible and how best to…
-
3
votes2
answers3596
viewsLog in with network user (LDAP)
I have an LDAP server in the company and to log into the machine requires a network user. We would like that after the user is already logged in to the machine, when using the network or some…
javaasked 11 years, 11 months ago Fillipe Sanches 45 -
3
votes3
answers99
viewsPlacing a vector in decreasing order
I need to create a vector of size N but it has to be ordered down only when I do the code always from 0. public int[] vetor_dec (int n) { int[]vetor = new int[n]; for(int i=n;i>vetor.length;i--)…
javaasked 11 years, 11 months ago IMoonBlackI 364 -
3
votes1
answer301
viewsIllegalargumentexception
I’m developing a project and I’m having a very annoying little problem. It is a WEB system. When I look for a client it fills in all the fields I need correct however, when I look for another client…
javaasked 11 years, 11 months ago Eugenio Michetti 31 -
3
votes3
answers3039
viewsHow to make a decision structure to close a window?
In the code below, I want you to choose sim the window closes and when choosing não the window remains open. private void formWindowClosing(java.awt.event.WindowEvent evt) { // TODO add your…
-
3
votes2
answers7797
viewsRemove duplicate objects from List<Minhaclasse>
Guys is the following, I have a model class with attributes that store data returned from the database. For example: public class RelacaoTransformacao { /** ID do registro no banco de dados. */…
-
3
votes1
answer1651
viewsError opening new Activity
I’m picking up here to be able to make the click on a button, open a new Activity. I looked at the Android documentation on Activity, Intent, the methods to create and yet yes, it doesn’t work.…
-
3
votes2
answers383
viewsGetting around the problem with hot Java development?
Problem situation: You are developing a website and debugging on it. For example a CRUD of users. For this you are using Javaee 1.7, Eclipse Kepler and Apache Tomcat 7. However, at the development…
-
3
votes1
answer6227
viewsHow do you go through a binary tree?
I’m having trouble adding an element to a binary tree because I don’t know how to go... Tree knot public class NodeBinaryTree extends BinaryTree{ NodeBinaryTree left; NodeBinaryTree right; int…
javaasked 12 years, 3 months ago user8278 -
3
votes2
answers5118
viewsUpload android images to Server folder
How can I upload an android image to a folder on the server? I have the address of the folder that I can use to save image, I am already using this address to be able to grab the images but now I…
-
3
votes3
answers88
viewsProblem receiving random integer values in array
Eclipse does not point out any errors in the code, but does not execute. package gerarOrganizar; import java.util.Random; public class GerarOrganizar { public static void main(String[] args) { int…
-
3
votes1
answer1315
viewsCompare prices taking into account units (kg, g)
Hello, I need to compare 2 products, taking into account their weight and values, to know which product is more advantageous to buy. Ex: Rice 5kg - R$ 10,00 Rice 2kg - R$ 6,00 Thinking that you can…
-
3
votes1
answer9074
viewsHow to select only one radio button?
In the swing of Java, a user can select more than one radio button simultaneously, so this does not happen, one can do: private void radio1ActionPerformed(java.awt.event.ActionEvent evt) { if…
-
3
votes2
answers3349
viewsHow to do Collision in game with Java 2D platform?
I’ve been trying for several days to make a collision method that returns me or tells me the sides of a rectangle that are being collided. I’ve already used the method Intersects but it only returns…
-
3
votes1
answer1642
viewsHow to rewind the file pointer correctly in Java?
Actually the problem is quite complex, but I’m going to try to give a notion that I think will be understandable. I have a method in an application that initializes objects to I/O in accordance with…
-
3
votes1
answer1352
viewsGenerate 10-character random alphanumeric code
I have today an application that is presenting data divergence because of the return time of a webservice. To get around this we created a code to prevent this particular information from ever…
-
3
votes1
answer1857
viewsHow to compare Date to Mysql field
I’m a beginner in Java and I have a table in Mysql that has a date field and the dates are stored in the format yyyy-mm-dd. Now I need to recover only records whose value of the date field is…
-
3
votes1
answer1503
viewsHow to modify XML elements with Java?
I have never worked with XML before. I created the following XML configs.xml: <resources> <string name="ip"></string> <string name="username"></string> <string…
-
3
votes1
answer561
viewsTwo pages using the same Servlet
I have my main page(index.jsp) uses Servlet for a few little things. Then redirect to the final page.jsp. This page will use Servlet as well, as I need the user to choose the functions (buttons) he…