Questions tagged as 'java'

1
answer

Write file.txt

I'm having trouble with a code I put together. I can not find the error. My problem is this: I've created a code that generates combinations of numbers and you should save those combinations in a .txt file. However, when I run the code, it...
asked by 03.09.2016 / 20:19
2
answers

Compare value at each position of the String in Java?

I'm having trouble comparing a value at each position of a String , follow the example below: parametro = "30,60,90"; private int countVirgulas(String parametro) { int count = 0; for (int i = 0; i <= parametro.length(); i++) {...
asked by 30.12.2015 / 11:23
1
answer

Why should I use getResource ()?

In Java it is not uncommon to see codes that load images, audio files, XML and other things in a more or less like this: final ImageIcon programLogo = new ImageIcon("res" + System.getProperty("file.separator") + "icon.png"); However, from t...
asked by 07.09.2014 / 14:09
2
answers

Compile jar for exe and do not need after having an JRE

One more problem here, and I need your help. I downloaded a program that converts jar files to exe. The only problem is that I still need the JRE. Is there any way to convert the program to exe and then do not need the JRE (or the JRE to go insi...
asked by 26.08.2014 / 04:25
1
answer

DB oracle Closed Connection

Introduction I'm developing an application and I have to add data to an oracle database that is local. Using JDBC I make the connection try (Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@" + conexao + ":1521:xe", "system...
asked by 16.09.2014 / 23:08
1
answer

Inserting Selected Objects in Array

I'm doing a Formula 1 Racing program, my program reads various racing files, and creates the test objects. I need to deploy in this program a class that has an array to store only the Pilots that have points above 0, and if the pilot is already...
asked by 16.09.2014 / 18:09
2
answers

Call Java method in Javascript

I have a problem, and I needed to call a Java method inside a Javascript file. Java example: public void Inserir(User user) { //insere usuario } I need, via a .js file, to send the object to the Java class responsible for the Insert...
asked by 25.06.2014 / 16:50
2
answers

How do I get the class name in a static context?

I want to get the name of the class that called my method class A { public static String getClass(){ return getCalledClass(); /*Supondo que exista esse metodo*/ } } class B extends A{ } When I do: System.out.println(A....
asked by 22.06.2014 / 21:33
3
answers

Print Thread ID

I have the following code and I can not print the ID of the Thread, just the size. How do I print the thread array ID? public class MultiplicacaoMatrizesThread { // Matriz A public static int a[][] = { { 5, 4 }, { 3, 3 }, { 2, 4 } }; // Matriz...
asked by 15.03.2016 / 17:41
1
answer

How to list the names of the files that are in the directory?

The output of the following method is:    C: \ Users \ User \ Desktop \ files \ filename.jpg How can I get only the filename.jpg in String format? I tried to use FileUtils but as an output I got this: .ELs / G Yos...
asked by 26.02.2016 / 19:01