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
answer611
viewsTracert or Traceroute in Java, without calling the OS
I am developing a web application that will test the servers and will bring the result equal to a tracert of Windows or the traceroute Linux. I am developing in Java and using the commands mentioned…
-
3
votes2
answers105
viewsForce every instance to have 2 attributes
Hello, I have an Employee class with the attributes name, code and salary (all private), and a Manager class - which extends Employee - with the attribute quantityFunctionaries, also private. How…
-
3
votes1
answer1036
viewsWhat is the simple way to create a Webservice Rest from an existing Dynanic Java Web project?
Fala galera I’m a beginner in the world of java and created a Dynamic web project where I use Hibernate, Primefaces and Tomcat. Everything is working, screens, records (CRUD) and stuff. Only now I…
-
3
votes2
answers373
viewsSelectonemenu is not powered
I have a p:selectOneMenu and would like it to be fed with existing data in the database as soon as the page was loaded: xhtml. <p:selectOneMenu id="carros"> <f:selectItem itemLabel="Carros"…
-
3
votes2
answers5037
viewsSort a list of objects by more than one attribute
How to sort a list of objects by more than one attribute? First is made the ordering of the score, then as tiebreaker criteria we have the winning number and then the goal balance. Something like…
-
3
votes2
answers1032
viewsprint special characters when generating file
Some strings are coming out like this when generating my . txt É fácil entrar em contato com a área I read another file. txt that has several sentences, I make a treatment of all the lines and…
javaasked 9 years, 5 months ago chocolatemontana 573 -
3
votes1
answer2487
viewsHow does Htmlunit work?
Someone has some example of login of a web system communicating with another, where I will send the user and password to another site and this site will authenticate and give me a feedback if the…
-
3
votes1
answer862
viewsCapture Windows Clipboard with JAVA
There is how to capture the Clipboard in Windows environment with Java? I can capture the screen, but I would like to capture the Clipboard (that’s what stays in memory when doing CTRL+C, for…
-
3
votes1
answer896
viewsHow to handle request header with Filter
How to change, remove or add a header of a request in a web application using Filter?
-
3
votes1
answer1058
viewsReturn to Start Menu when pressing ESC with Javafx
How can I get my application back to the start menu after pressing ESC. I can currently use Keyevent only when some component is associated, such as a TextField, Button, etc.. I just want to press…
-
3
votes2
answers846
viewsCount line in the matrix that have repeated numbers
I wanted to add to linhaPreta the number of lines with only 0, and the linhaBranca only with 1. public class Pixel { public static void main(String[] args) { int[][] img = { { 1, 1, 1, 1, 1, 1, 1, 1…
-
3
votes1
answer96
viewsBuild error using Audioplayer class
When trying to compile the code below: import javax.swing.*; import sun.audio.*; import com.sun.java.util.*; import java.awt.*; import java.awt.Event.*; import java.io.*; public class filechus {…
javaasked 9 years, 11 months ago Augusto Tomás 31 -
3
votes1
answer63
viewsDifferentiate View accessed by a reused Contextmenu in multiple Views
I’m developing an application for Android in which I have two images on a screen, client and its vehicle. I want to show a menu by clicking a long click on both images and so far so good, by…
-
3
votes1
answer184
viewsAsynctask Android
I have a "Runnable" method that executes in a new Thread a certain method to update my list. Every time I call this "Runnable", I’m creating a new Thread, which for me is not very positive... How…
-
3
votes2
answers1142
viewsConvert and Validator with CDI injection
Can someone inject CDI or EJB into JSF 2.2 Converter or Validator? It was said that from 2.2 it would be possible but I’m not getting it. I’ve tried to @EJB UserService userService and also @Inject…
-
3
votes3
answers3750
viewsconsuming JSON
I’m having trouble getting a file from the internet by JSON. I have some data on this link http://www.sinestandar.com.br/maker/categorias.txt and I want to take to use in my application, the link…
-
3
votes1
answer147
viewsHow to convert a String of this type to a Date Object
I’m working with an Ontology at Protegé 4.1 and I have a Dataproperty that is a Datetime. I’m taking this Datetime this way: ["2015-06-30T16:38:53"^^xsd:dateTime] How do I put the date like this on…
-
3
votes1
answer703
viewsSerial Communication with Precision Balance
I’m developing an application to measure the weld flow that passes through the plate on a production line, but I’m having a little trouble connecting the precision balance with the PC via serial…
-
3
votes1
answer181
viewsJava class for Builder and dependency management
I have projects using Gradle as a dependency and build manager, I know the power of Gradle, but not the domino, this issue of being a dynamic language(groovy) forces you to know 100% of the commands…
javaasked 9 years, 11 months ago Rodrigo Rodrigues 573 -
3
votes1
answer576
viewsBrowse between screens
I’m developing a project on Android Studio, using drawer navigation. And in one of Fragments I need you to have a navigation of 2 screens. How do I navigate between two screens, ie when sliding on a…
-
3
votes1
answer686
viewsHQL query with ENUM list as parameter
Hello, I have the following problem, follow an example: I have an entity Banda which has as attribute a list of generos List<Generos> generos, Generos is an ENUM with the following values:…
-
3
votes0
answers385
viewsExample of Spring Security Does not work in Jboss, what should be done to make the example compatible?
Continuing my studies in the use of Spring Security and Servelet 3.0 I am trying to follow the suggested examples in the tutorial Hello MVC - Running the insecure MVC Application, but such examples…
-
3
votes1
answer766
viewsException in thread "AWT-Eventqueue-0" java.lang.Stackoverflowerror
I have this mistake here: run: Exception in thread "AWT-EventQueue-0" java.lang.StackOverflowError at sun.awt.Win32GraphicsConfig.getBounds(Native Method) at…
-
3
votes2
answers5402
viewsCheck if day x falls on a Saturday or Sunday
I’m making a system that will be an Agenda, in this system has an option to repeat the commitment unless fortnightly, ie I save the commitment and the system will notify me every 15 days. But this…
-
3
votes1
answer237
viewsDoes the last instruction of a switch need 'break'?
I was watching some tutorials on Youtube and noticed that some programmers leave the last instruction of a block switch without the word break. For example: switch(frutas){ case "abacaxi":…
-
3
votes2
answers12630
viewsHow does Java Builder Heritage work?
In Java when one class inherits from another it is necessary to initialize the constructor of the parent class, right? using the super() and passing to this super() the parameters the parent…
-
3
votes1
answer690
views -
3
votes1
answer518
viewsDesign structure
I have a project being developed with VRaptor and I have a question about the structure of project. The project I’m developing will be installed in several clients, each with a different structure.…
-
3
votes2
answers3840
viewsHow to use dll in Java
How do I include files dll in a Java project using Eclipse?
-
3
votes2
answers2833
viewsEnabling Internet Connection in an Android App
I would like to know a way to identify if the android phone is connected to independent internet if it is mobile network of the mobile operator or wifi, and if not connected, I activate all…
-
3
votes3
answers644
viewsDiscovering the SQL of a Resultset
I have a Resultset java object that I don’t know the SQL/parameters that generated it. Would you like to know how to get the SQL used to create it? would have something like : rs.getStm.getSql ?…
-
3
votes1
answer1148
viewsHow to structure Hibernate Entity relationship annotations?
I would like to understand the difference between Hibernate annotations with JPA: @Onetoone, @Onetomany, @Manytomany and @Manytoone from Hibernate, how it works?
-
3
votes1
answer337
viewsSet date inside an Arraylist using Cursor
In a App finance the cursor has no type of getData or getCalendar. What to wear instead? public List<Despesa> getLista() { Cursor c = getWritableDatabase().query(TABELA, COLUNAS, null, null,…
-
3
votes3
answers99
viewsMethod to save multiple "Players" to a list
I want to make a system of party, the only command will be /party PLAYER (if the player is already in the party, it will be removed and if it is not, it will be added). But I couldn’t find a way to…
javaasked 9 years, 4 months ago Lucas Caresia 2,663 -
3
votes2
answers1093
viewsHow to assemble logic to read 2 files, compare them and extract values not found
I have 2 files .txt, one of them is a correct list of cities (contain all the cities of the country, written correctly) and the other, also a list of cities but with some wrong data (this list…
-
3
votes1
answer133
viewsOrder a LIST based on another LIST
I have a class that has a property that is another class. Follow example: Menu Class public class Menu implements Serializable { private static final long serialVersionUID = 1L; private Long id;…
-
3
votes1
answer225
viewsCreate document templates in Java
I am creating a Java system with Swing, where I would have templates of documents, and fill with data informed by the user in a form that I have already created, so that it generates a PDF of the…
-
3
votes1
answer189
viewsDoubt of beginner javax.imageio library
I’m trying to make this import in java studio import javax.imageio.ImageIO; import javax.imageio.ImageReader; import javax.imageio.stream.ImageInputStream; but I’m coming up with this mistake:…
-
3
votes3
answers15702
viewsDifference between private final and private final Static for the use of immutability
An attribute when declared with the modifier Static has the characteristic of "propagating its value" by all instances of the class to which it belongs, that is, its value will be the same for all…
javaasked 9 years, 10 months ago Geison Santos 4,428 -
3
votes2
answers96
viewsError generating custom Listview
Hello, I’m trying to accomplish the implementation of a ListView custom on Android, but I’m not getting it. It’s something simple, I’ve done other times, but I can’t see where I’m wrong.…
-
3
votes1
answer892
viewsHow to correctly declare Server Runtime or provided Wildfly dependency on Gradle
I have a Java web project being developed to run in Wildfly, using the Eclipse IDE. This application uses JPA, JTA, JSF and CDI at first, but will use other Java EE resources in the future. The…
-
3
votes1
answer651
viewsGlassfish does not take root context from the application
EDIT Guys I managed to solve, I was missing point my application to my virtual server, thank you. I uploaded an application on the server today and glassfish is not taking the context of the…
-
3
votes1
answer493
viewsHow to convert HTML code to a PDF file in java?
I am developing an application where I need to convert an HTML code, which is saved in the database, into a .PDF. file.No need to save this file to the server. I’ve never done anything like this.…
-
3
votes1
answer120
viewsMultiple Imageview within Framelayout, an error occurs
Well the problem is I’ve got a few ImageView which are called buttons, run cool, but when setting 4 images it still goes well, add one more ImageViewwith another picture there the error program, in…
-
3
votes1
answer350
viewsThread in Java and Nodejs
We know that benchmarks are specific measures and do not count for all cases, certainly what and how you measure matters a lot, so I will try to be very specific. In the case of a server having…
-
3
votes1
answer272
viewsUpdating data from one Active to another
I’m making an app android that uses communication telnet and receives data every second (ActivityTelnet). I would like to treat part of this data in another activity(Activity1). But when I’m in…
-
3
votes1
answer672
viewsHow to check if my spring application is in production environment?
when it is in production I want that when it falls into an exception send an email to the support but only in production , in development I do not want it to perform this task .
java spring spring-mvc spring-security spring-bootasked 9 years, 3 months ago Jose Vieira Neto 2,560 -
3
votes1
answer377
viewsCopy Outputstream object to a file
I confess it’s the first time I’ve worked with Stream’s and File in Java. Currently I use the Spring (Core) in my application, I soon use a simple copy utility feature stream’s and file’s called…
-
3
votes1
answer1333
viewsConditional validation in Primefaces component
Hello! I have the following problem. I have inputText description which gets disabled by default. When I click the search button, it enables inputText and then instance an object for search. If I do…
-
3
votes3
answers2541
viewsRXTX: serial scale port connection
I’m trying to catch the weight of the scales, but I’m not finding success in this battle. As can be seen the connection to the SERIAL port (actually USB) is all ok: Stable Library…