I am using @Scheduled and it have been working fine, but can't get the @Async working. I tested it many times, and seems that it is making my method asynchronous. Is there any other thing, configuration, or parameter I am missing? I have one class that has two methods one, the method marked with @Scheduled, executes and calls the second ...
I wrote this code but the mentioned exception thrown. what's wrong, please help?
this is the code :
//-*-*-
FileInputStream input = new FileInputStream("cv.xml");
XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(input);
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
...
I want to make my program initialization a bit "smarter".
I have several classes which represent commands. All these classes are immutable (i.e. creating only one instance of each should be enough for the whole application). All these classes implement Command interface.
I think that the fact that some classes are placed in the same ...
I have to get size of object which type I does not know. It's a template where I want to achieve sth like this:
void sth(T data)
{
System.out.println("Data size = ", sizeof(data));
}
How I can do this in Java?
sizeof - like a C sizeof ;)
...
Hello.
I come across to a strange behavior while trying to override a method with default accessor (ex: void run()).
According to Java spec, a class can use or override default members of base class if classes belongs to the same package.
Everything works correctly while all classes loaded from the same classloader.
But if I try to load...
I have added the jdbc driver to my classpath as far as I know i.e. I added the following to my .profile
export CLASSPATH=$CLASSPATH:location/to/the/jarfile.jar
When I compile my java program I always get this error
javac v9.java
v9.java:8: <identifier> expected
Class.forName("org.postgresql.Driver");//load the driver
^
v9.j...
Hi, I am working on an alarm app. I followed the Android AlarmController tutorial word for word with only some minor changes. For some reason my Broadcast Receiver's onReceive() method is not being called when the alarm goes off. Here's the code:
// the callback received when the user "sets" the time in the dialog
private TimePickerD...
I hava a java program with a JFrame
I am using absolute positioning
here is my main function
public static void main(String[] args) {
ape Ape = new ape();
Ape.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Ape.setSize(1000,1000);
Ape.setMinimumSize(new Dimension(1000,1000));
Ape.setMaximumSize(new Dimension(1000,1...
To get a newString value of "99 bottles":
int x = 99;
String fruit = " bottles";
To form a new String I do this:
String newString = "" + x + fruit;
since this is not allowed:
String newString = x + fruit;
But there's something about using the double quotes here that doesn't seem right.
Is there a better way to do this (without ...
I've learned a lot of programming language, and I think that Java or C# are most likely the best for getting a job, but I was wondering if I am correct in thinking this, or are there other popular languages I should know about?
...
Run time error on main method in MovieList.java.
I'm not sure my program design is fundamentally very good, but I'd like to know why it crashes. Thanks in advance.
package javaPractical.week3;
import javax.swing.*;
public class Movie {
//private attributes
private String title;
private String movieURL;
private String ...
Hello,
I'm looking to build a web service that can compile some entered code (probably C/Java) and can run some tests on it. What kind of design should I follow? What compiler can I place on my server to do the job? Recommendations? Pros? Cons?
...
I have an Enum in .Net. How can I rewrite this Enum in java?
Here is the Enum:
public enum AdCategoryType : short
{
ForSale = 1,
ForBuy = 2,
ForRent = 8,
WantingForRent = 16,
WorkIsWanted = 32,
WorkIsGiven = 64
}
...
This question is in relation to another question I have asked, but what are the reasons as to why you would use openSession() over getCurrentSession()? I know you would use openSession() so that you could self-manage the closing and flushing of the session, however, why would you want to do this manually?
I have used openSession() when...
All,
I was wondering if clearing a StringBuffer contents using the setLength(0) would make sense. i.e. Is it better to do :
while (<some condition>)
{
stringBufferVariable = new StringBuffer(128);
stringBufferVariable.append(<something>)
.append(<more>)
... ;
Append stringBuff...
i need some help writing a for-loop please but i can't get it.
i need to add the numbers 0 to 63 in a table like this:
0 1 2 3 4 5 6 7
8 9 10 11 12 13 14 15
etc.
for (int j = 0; j < 8; j++) {
for (int i = 0; i < 8; i++) {
table.setValueAt(""+(i+(j)), i, j);
}
}
but the inputted values are not correct
can you please help
...
I've an array keeping a list of "Group" objects. I want to set this list to the dropdownchoice component. However I want to show the end user only the name attribute of Group objects, and then get the selected values' id attribute to add database. What to do? Thanks
private List<Group> groupTypes;
DatabaseApp db = new DatabaseApp();
gro...
I have a class which extends JScrollPane, its viewport is another class which extends JComponent and implements Scrollable. When the size of the component changes the JscrollBars do not update unless I call revalidate() however this resets the position of the scroll bars to the top left. Is there a way of updating the size of the scroll ...
Hi,
I am using maven war plugin to exclude some common jar and put them in the classpath. I am able to generate war file properly which excludes specified libs and add them in the classpath but exploded war directory still contains excluded libararies. How can I generate exploded war file which use configuration of maven war plugin.
...
I am retrieving a captcha image from the Java based package "SimpleCaptcha"
On the front end I just put the following in my page and I get a captcha image:
<img src="stickyImg" />
I want to reload this captcha image onclick using javascript.
I tried:
$("#theclickhandler").click(function(){
$("#stickyImg").load('stickyImg', fu...