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
votes2
answers1833
viewsDatabase insertion via Webservice
Good night, I know very little about Webservice. And, through tutorials, I managed to create one. The content was taken from this site: Creating Web-Service The query is successfully made, but now I…
-
3
votes3
answers1994
viewsHow to count characters from a Java reference?
Example I have some characters 123456789.123456789. How to do to count up to the . after the . count again remembering that the point should not be counted.…
-
3
votes1
answer109
viewsHow to lock a layout on ORIENTATION_LANDSCAPE and another on ORIENTATION_PORTRAIT
I’m using the method for when change of layout change position but when start application in landscape it starts layout teste_01 landscape mode being that its format is portrait how to fix it. if…
-
3
votes1
answer1530
views"Transparent" text in java
I wanted to do a text similar to this: This "transparent" text, when clicked it disappears and you can start writing in the dialog box... someone knows how to do it in Java? Help me, people, help…
-
3
votes2
answers240
viewsHow to isolate gravity in the accelerometer
I’m developing an app in which the user needs to shake their phone to all directions and the smartphone needs to maintain stable guidance in the meantime. The problem is that all ways to achieve…
-
3
votes1
answer415
viewsHow to get 4 last numbers from a variable?
I have to get last numbers from a variable and I don’t know how to do it. I’m taking the milliseconds and I need to play in this variable lol, where I need you to return only the last 4 digits of…
-
3
votes3
answers10600
viewsGenerate random data within a range
I cannot return any number. Ex: If I use "lower 1500" and "higher 5000", I would appear in this interval if I did not enter the while, only nothing is returning. public int aleatoriar(int maior, int…
-
3
votes1
answer549
viewsHow to pass dates in Java to a database?
I’m trying to pass a date in format "yyyy/MM/dd HH:mm:ss" to the database for this I am using the Date() and the SimpleDateFormat(), but he returns me one string. Is there any way he can return me a…
-
3
votes1
answer1494
viewsPass variable value between Classes
I would like to pass the values stored in the variables of the Parte1 to the Parte2 to validate the highest entered value. PART 1: public class SEP_06_parte1{ public static void main(String args[]){…
-
3
votes1
answer988
viewsJava - Edit Windows Registry
How can I change a Windows registry (regedit)? And if the key doesn’t exist How can I create?
-
3
votes2
answers331
viewsCheck string value
I wanted you to check if the entered value is vegetarian, and if it is, print on the user’s screen is vegetarian as follows the code, but when I type vegetarians or anything else it warns that it is…
-
3
votes2
answers158
viewsPlay framework problem with form
Introducing I’m starting to develop with the Play Framework. I’m making a TODO list template with it. Problem When I am instantiating my form in the controller it returns me the following error:…
-
3
votes1
answer80
viewsDemoiselle in Openjdk
I heard that Demoiselle does not work with Openjdk. Is it true? Even for Openjdk 7? There are plans or work in progress so that Demoiselle can be used with Openjdk, at least from version 7 onwards?…
-
3
votes3
answers500
viewsHow can I separate a string for example 36529874 from two to two without having any separation carcter for example 36.52.98.74
I’m taking the IMEI of the phone and I have to divide it into groups of 2 characters for me to convert them to hexa later. This string comes without separator, the numbers come together, for example…
-
3
votes2
answers2692
viewsChange project dependency folder (lib)
When compiling my project on Netbeans the files are generated in this way: ./dist ./dist/meuProjeto.jar ./dist/readme.txt ./dist/lib ./dist/lib/dependencia1.jar ./dist/lib/dependencia2.jar And I…
-
3
votes1
answer1040
viewsTake array values returned from another class
I need to pass the variable value sgEstado for the other class but I can’t, the value is in the return when threshing, but I can’t get the value out in the other class. ArrayList estados; try {…
-
3
votes1
answer130
viewsin.createNativeQuery executes first than in.persist and now?
I’m developing an application with Hibernate + Spring mv. spring takes care of the Entitymanager dependency for my DAO, but I have the following problem. i persist an object called User then I run…
-
3
votes2
answers4563
viewsHow to create an executable in java + Mysql database?
I created a java desktop application that connects to a Mysql database, how can I generate this application to run on any machine along with my database? Thank you!
-
3
votes1
answer1575
viewsRecursive algorithm
I have a job at college that I just have no idea where to start. Display the recursive mathematical function that defines mdc (maximum common divisor) between two natural. Based on it, do: 1. Define…
-
3
votes1
answer6178
viewsHow to configure the back button action on android?
How to perform certain activities in the app when the back button is heard?
-
3
votes2
answers1863
viewsAndroid - How to export the database in a csv file?
I have an application that collects and stores information in a database, and the user can query this data within the application itself. However, I would like to insert a button to export the…
-
3
votes3
answers10404
viewsClear content from my netbeans java console
Good morning guys, which java command do I use to clean up my netbeans console? Because I have a method that is every time printing some messages and I want you to keep cleaning this from my…
-
3
votes4
answers14347
viewsHow to take a String value before a Special character
Hello, good morning. I have a little doubt, how can I get the value of a String before some special character. For example, Clinica Antonio S/S. I would like to take only the Clinica Antonio S,…
-
3
votes1
answer1222
viewsHow to get the result of an asynchronous task on Android?
I am trying to redeem the value of my API using .get() but it’s always falling in Exception, I believe I’m not doing it properly. private static String APIAddress =…
-
3
votes1
answer2606
viewsChange the color of a jProgressBar
How can I change the color my Progressbar, it always turns a little orange weird, I tried to use this code but it didn’t work: UIManager.put("ProgressBar.background", Color.orange);…
-
3
votes2
answers1867
viewsHow to pass an array to a Jtexfield?
I’m doing a college paper where we have to do a kind of screen login, however, with array and not Arraylist. My question is how I pass on the information from JTexfield to the array? That one array…
-
3
votes1
answer145
viewsHow does the Java compiler work?
Why is the compiler of Java cannot guess which type of object will be returned on the line that will cause compilation error in this program? import java.util.*; class Teste { public static void…
-
3
votes1
answer230
viewsPython subprocess.check_output command
I am calling a program in Java via command subprocess.check_output python. It is not working. In this command I pass a file as parameter. There’s something wrong with the command below? import…
-
3
votes1
answer1604
viewsWebview on Android, modifying HTML
I’m able to upload the URL to my device, using the Webview, but the page that loads is not adapted for mobile devices. I wonder if there is a way I can access the page, but eliminating some parts of…
-
3
votes1
answer250
viewsMulti-processing/Multithread not working
I want to try to solve the problem of when the client cannot connect to the server(connection failure, server below, etc). In my main class is the connection to the server and I want in case of…
-
3
votes1
answer328
viewsRecover String between characters
Hello, I’m developing a program that uses the java command line if the user type: send -all < message to be sent > it sends the message to all if send -by < user > < message to be…
-
3
votes1
answer1395
viewsHow to make a button blink?
I created a simple code for a game similar to Genius, where a random button of a set of 20 buttons starts to blink, but I can’t get an interval for the color change to be visible... Here’s an…
-
3
votes1
answer612
viewsHow to put a Jlabel above the buttons on a Jdialog?
I’d like to put a label on a Jdialog, but above the existing buttons. How can I do that? All components stay online for me: private void…
-
3
votes1
answer778
viewsJava/ Sqlserver transaction divided into multiple methods
I have a method that performs several Prepared Statements, only two of them in methods of other classes. In my method, I have the object connection, and if I want to start a transaction, I have to:…
-
3
votes2
answers1073
viewsHow to do zip validation for Android
I would like to know how I validate a cep typed by the user in an Edittext on Android. Do I need a specific API? I want to validate if the zip code is existing and return to the screen if it is not.…
-
3
votes1
answer218
viewsHibernate Criterias - Group Dates
Currently I can group dates using Projections.sqlGroupProjection(). When my date field is in the same class as I create the Criteria, it works perfectly. The problem is when I create an alias, and…
-
3
votes1
answer476
viewsVestibular system using JAVA
I have a college assignment to do, which is to create a vestibular system. The work is on the link, click here, and I am in doubt on the following topic: The program should read from the file…
javaasked 10 years ago Raul Goulart 33 -
3
votes2
answers2182
viewsRepeated elements in a matrix
I’m trying to make an algorithm that finds repeated elements in some matrix but I don’t know how. The algorithm should not check the repetition only in the rows or columns, but in the whole matrix…
-
3
votes1
answer1231
viewsJar does not execute.
I’m having a problem running a jar file. that I made. When I click on run nothing just happens, no window opens, no error message or anything. In the folder of Meta-inf has the file MANIFEST.MF…
-
3
votes1
answer1941
viewsWhat is the setProperty method of the System class for on Android?
In my case I used so: System.setProperty("file.encoding", "UTF-8"); It would be the identification of the language used?
-
3
votes1
answer309
viewsAccessing values from an object array
I have a job where I should create a parking, in the basic Java same. So I have my class Carros: package estacionebemestacionamento; import javax.swing.*; import java.util.Date; import…
-
3
votes2
answers649
viewsJava Scheduleexpression
I’m developing a Nobreaks Supervising Software, I’m using the ScheduleExpression which runs every 5 seconds, followed by code: @PostConstruct public void agendarMonitoramento(){…
-
3
votes4
answers15572
viewsWhat is the super() function for;
I am studying Java and I need to understand the logic of a code here. I wanted to know what this piece of code does: public class UsuarioController extends HttpServlet { private DAO dao; public…
-
3
votes3
answers225
viewsDoubt about showing local network IP
I am developing an application to turn off the PC’s of a laboratory. I have a reference to class InetAddress, invoking the method getLocalhost(). Then I throw it in a array byte and then I did a for…
-
3
votes1
answer1336
viewsHow to deserialize JSON using Gson with generic list?
I need to deserialize JSON for a generic list, but I’m having an error that I believe is in the conversion: Method call: AtualizarJSON at = (AtualizarJSON) DeserializaConsulta(AtualizarJSON.class,…
-
3
votes3
answers126
viewsRun block if no exception occurs
I want to know if you can perform a function, a block, case NAY there was an exception in try {..}. Example: try { sout("Texto na tela"); } catch(Throwable t) { sout("Ocorreu uma exceção"); }…
-
3
votes1
answer307
viewsUse of equals and inheritance
I have a parent class and in it I have a equals and I have other daughter classes of this father class and in them I want to overwrite the equals to compare particular attributes of these daughter…
-
3
votes1
answer690
viewsHow to add reticence if content leaks from Android layout?
How to add ellipsis if content leaks from Android layout? For example: I have a very large text in my Actionbar, and instead of having to decrease it in size, I want it to add reticence in case…
-
3
votes1
answer1362
viewsHow to convert from Timestamp to Calendar?
I need to convert a resultSet of the returning bank in Timestamp in a Calendar type variable.
-
3
votes2
answers154
viewsAndroid studio has ndk support?
I will start development geared towards digital tv, and will be 50% ndk. Android studio meets well? or better eclipse?