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
-
2
votes1
answer255
viewsJava file does not receive parameters from Inputstream
I have a problem with a class on my project application server. I need this class after compiled and running, to receive a message: or "MSG_PV" or "MSG_RV" from my REDMINE, to publish projects or…
-
2
votes3
answers1661
viewsIdentify Urls and create links
If I have a text, for example: Visit www.stackoverflow.com to get your questions answered. How do I identify the URL and link to it: Acesse o <a…
-
2
votes1
answer195
viewsLimit set size<> with JPA
I’m having a hard time searching Google and I can’t find a solution. I have a note in JPA with a set<> I want to limit the size of objects inside the set, that is, the code below:…
-
2
votes1
answer182
viewsencapsulation of a point in two-dimensional Cartesian space
I created a class ponto2d with the x and y attributes, I created the get and set methods, until ai blz, then created a class retângulo with width and height, I need to know the value of a point in…
-
2
votes2
answers2344
viewsHow to create a robot using Java requests?
I have been interested in making robots to perform small repetitive and boring tasks. I use a class of Java called Robot. However, I think that the way I am doing it is not the most appropriate,…
-
2
votes1
answer1333
viewsHow to show the content of a received SMS on Android in a text dialog?
I’m developing an Android app that sends an SMS request to a remote device and receives back a reply, also via SMS, which should be presented to the user. To receive the SMS I used the following…
-
2
votes5
answers18470
viewsdelete repeated values java array
I’m trying to print an Array without repeats, which means I have: ja={1,2,3,3,4,5,6,6,8,9}; and the result will be: jaresul={1,2,3,4,5,6,8,9} ideas?…
-
2
votes1
answer265
viewsDifficulty Creating . JAR in Netbeans
I’m trying to create a . JAR in Netbeans, but I get the messages : C: Users Admin Desktop Project nbproject build-impl.xml:993: The following error occurred while executing this line: C: Users…
-
2
votes1
answer792
viewsHow do Hibernate Search sort the result of a search?
I have a indexed search with the Hibernate Search but I can’t get Hibernate Search order the search result in the order of a given column, as for example the name column. But there is a peculiarity.…
-
2
votes2
answers635
viewsJdialog does not design components in Java
I am developing an application that will run a processing soon, and I want a message warning that the process is running stay on the screen while it does this processing. I tried to do with the…
-
2
votes1
answer523
viewsHow to Generate/Calculate the Value of Binomial Poisson and Normal Tables in Java
I am doing a work in Java to calculate the statistical probabilities, I do not know how to generate the tables of Poisson Binomial and Normal to proceed. For example: X~Bi(5,0.05) In this case X…
-
2
votes1
answer5391
viewsHow do I handle Joptionpane.showMessageDialog() options?
How do I handle user choices on JOptionPane.showMessageDialog()? For example, when the user chooses okay the program continues normally if he chooses cancel the program executes another line of…
-
2
votes1
answer159
viewsProblem with internal database
I’m trying to manipulate an internal database with the following code: sql = "CREATE TABLE IF NOT EXISTS tipo ([codigo] integer autoincrement,nome text not null);"; bancoDados.execSQL(sql); sql =…
-
2
votes3
answers2826
viewsAdd image to . jar
I have several programs that run perfectly on my machine, the .jar runs smoothly and I use them as well as I wish, no problem. However, when I run them on another machine, images do not appear. The…
-
2
votes1
answer1087
viewsOpen word file through the . jar
I have a calculator in . jar working perfectly ! My questions are: In the menu I have the "Source code" button and I would like to open a Word document with the source code of the program. I managed…
-
2
votes1
answer469
viewsPush notification on a local network (case without internet)
I studied in the services of GCM for sending and receiving notifications to the android, but I have the following doubt: If I am in a local environment, and the data server is in same environment,…
-
2
votes1
answer771
viewsHow to run audio file using Audiotrack class?
I intend to make an app to play drums, but, as I’m starting now to develop for android, I’m having difficulty. I need to play an audio file with the class AudioTrack (because it has the lowest…
-
2
votes1
answer176
viewsProfundidade Array
I have an a1 Array a1=[a2[a3[a4[]],a5]] I need to know the depth of the array now in this case is 3 because inside the a1 array has the a2 array and inside the a2 has the A3 and inside the A3 has…
-
2
votes3
answers5189
viewsHow to pass editText value to attribute to int type on Android?
I have a question about the value store coming from EditText for attributes of type int of a class. For attributes of the type String I do so:…
-
2
votes2
answers527
viewsArraylist in JAVA
I have a question about Arraylist Example: I made a graphical interface in Java to register players in a ArrayList. after registration, the player goes to a Jlist, Here comes my doubt. I want to buy…
-
2
votes1
answer332
viewsStruts2 - Is it possible to access a back end method of an Action in JSP?
I’m using Struts2 to build a web application. I have a method in a class called BaseAction, where all other actions extend it, as written below: public boolean isUserFullyLogged() { final Boolean…
-
2
votes1
answer203
viewsHow to intercept only the public methods of a bean Managed?
If you have a managed bean ( @Managedbean annotation), how would it be possible to intercept only the public methods of this bean? The motivation for this would be as follows, suppose you have a…
-
2
votes1
answer160
viewsServersocket and Socket
I’m trying to create a ServerSocket: public class RunServer { public static void main(String[] args) { try { byte[] buffer = new byte[1024]; String passwordCript; ServerSocket socketRecepcao = new…
-
2
votes1
answer551
viewsHow to get the color of a pixel on the screen in JAVA 2D game?
Was there any way How to get the color of a Pixel on the x and y coordinates of the screen I specify?
-
2
votes2
answers186
viewsDB Dinamico Mongodb
I’m starting a web project and I’m thinking about using java with mongoDB and Spring data. In this web project, each user would have their own database. That is, when the user logs in (this yes…
-
2
votes1
answer555
viewsHow to use an object attribute to increment a counter?
I have the exercise practically solved, it lacks only an "accountant". "For the determination of the monthly receivables per employee, the clients they raise should be counted. Each customer must…
-
2
votes1
answer627
viewsImage upload using Webservice C#
I would like a help to know what is the best way to upload an image using webservice c#, I have tried several forms and several examples but could not. I tried to convert an image to string Base64,…
-
2
votes1
answer271
viewsJDK 1.8 Genexus X Ev. 2
I wonder if the Genexus X Ev.2 or higher already allows compiling programs generated in Java with JDK 1.8. I have to do something different?
-
2
votes1
answer347
viewsHow to create a Treemap to store words and lines where they appear?
I need to iterate on a text and take every word of it, store it in a structure (like TreeMap) and together with each word the lines in which they appear, to generate a remissive index. My big doubt…
javaasked 10 years, 5 months ago Lone_Dryad 43 -
2
votes1
answer708
viewsHow to store date/time of change in BD using Hibernate Envers?
I need to keep a log of all transactions of an entity with Hibernate Envers. I set persistence.xml as below: <!-- Configurações do Envers --> <property…
-
2
votes1
answer3327
views -
2
votes1
answer94
viewsNullpointerexception with CDI and JAX-RS
I’m studying JAX-RS and created a simple project with the following class: Webservice @Path("generic") public class GenericResource { @Inject private MeuServico servico; @GET @Produces("text/plain")…
-
2
votes1
answer108
viewsInter-yard injection
I have a Jar project, Helper, which has a process manager, where it controls the execution of etal threads. Where it receives an interface that performs the execution when triggered. I have another…
-
2
votes1
answer911
viewsHow to collect tweets through the Streaming API, restricting a geographic location?
I would like to collect tweets through a certain keyword in real time, however I would like tweets only posted in brazil, because when collecting the api returns me tweets from all over the world.…
-
2
votes1
answer877
viewsHow to reference a jar from another project in Eclipse
I’m doing a project to test iReport reports, and I was wondering if there’s a way not to include the same jars that already exist in a particular project. Eclipse itself offers the option to…
-
2
votes1
answer2723
viewsData update Sqlite Android
How to take the information that is on the screen and do an Update in the database. Code displaying information in Edittext. public class DatabasesDAO extends SQLiteOpenHelper { private static final…
-
2
votes1
answer8935
viewsProblem persisting: "Cannot add or update a Child Row: a Foreign key Constraint fails..."
Tables Contact CREATE TABLE IF NOT EXISTS `sgct-database1`.`contato` ( `contato_id` SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT, `telefone` CHAR(10) NOT NULL, `celular` CHAR(11) NULL, PRIMARY KEY…
-
2
votes1
answer85
viewsTrack SQL output in Java
My java application for web gives several times the error of SQL Syntax, but only indicates a snippet of the SQL script that gives error. Is there any way I can see the full script that was "played"…
-
2
votes1
answer74
viewsHow to put Outlines in the text
I would like to know how to put black Outlines in the text JLabel label_name = new JLabel(); label_name.setPreferredSize(new Dimension(100,20)); label_name.setForeground(Color.white);…
-
2
votes3
answers210
viewsHTML tags with Regex
Here’s the thing, I’m using the following expression: <div class="teste">(.+?)</div> And that’s the content, for example.: <div…
-
2
votes2
answers329
viewsJavascript interact with Java
It is possible get a javascript value and put inside a java variable. EX: var len = $(" #relacaoPax select[name=tipo] ").length; console.log( "len = " + len ); }); <% int l = len;…
-
2
votes1
answer291
viewsProblem with table extension in Postgresql, Person and Physical Person
I’m making an application that has a register of people, is a CRUD of Person that can be both physical and legal. the problem is that in my design should be created in the database a Pessoa and a…
-
2
votes3
answers8151
viewsHow to read a string using input in Java?
In case I know how to do with int which would be something like: number1 = input.nextInt(); But I want my user to enter a string, let’s assume a month: mes = input.???? I need to read the string in…
-
2
votes1
answer347
viewsRestart requestLocationUpdates() with Sleep
How do I start the requestLocationUpdates() with Thread.sleep(); in the Android? My code: public void onLocationChanged(Location loc) { Date d = new Date(); SimpleDateFormat sdf = new…
-
2
votes2
answers465
viewsJSP Dynamic Change in Jboss AS 7.1
Hello. When working with JSP I find it very bad to have to pause and start the application every time I need to see a change. Have any way to update page changes without doing all this?…
-
2
votes1
answer85
viewsoutputStream writing a byteArray - XSS validation
I am working with a software that goes through a "Security Application" that indicates the lines of code that are potentially insecure (theoretically). Based on the code below, the application…
-
2
votes4
answers138
viewsHow to get the last more "+" that appears on the console from this code?
Can anyone tell me how to get the last "+" that appears on the console from this code: import java.util.Scanner; public class Power2 { public static void main(String[] args){ Scanner input = new…
javaasked 10 years, 7 months ago Gonçalo Cardoso 23 -
2
votes1
answer245
viewsProblem with Primefaces running glassfish
I am developing a Java Web application using Primefaces to run on the Glassfish server on a Windows Server 2008. When running on my notebook as localhost works perfectly. Then I deploy on the remote…
-
2
votes0
answers111
viewsDistinguish nodes in a TRIE tree
I have a multi-word TRIE tree (dictionary function), in the node that is the last character of the word I need to have a "type" inside this node. I need to distinguish what kind of word each is, so…
-
2
votes1
answer1126
viewsHow to change values of an Enum within the code itself?
What I’m trying to do is, when I call an Enum, and instantiate, it shows up with an X value, and when I’m messing with it in the code, it changes the value to whatever I want. Example: //Classe dos…