Win a copy of Java by Comparison (eBook) this week in the Java in General forum!

Joel Bijapurkar

+ Follow
since Aug 01, 2011
Joel likes ...
Eclipse IDE Java Netbeans IDE
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Joel Bijapurkar

I have created my own generic class as follows:

I have utilized the MyGeneric class in MyGenericUtilizer class as follows:

The functions insertValue and returnValueAt work properly. But the function returnArray() throws the following exception:

What is causing this exception?

I also tried initializing the generic list as follows:

This compiled fine. But on execution the insertValue() function threw java.lang.ArrayStoreException
5 years ago
Sorry for my mistake. I did not copy the first line.

6 years ago
I am using the following code to send an email using java:

I get the following error when I try to run the program:

Error: Could not find main class Demo.SendMailDemo
Exception in thread "main" java.lang.NoClassDefFoundError: Demo.SendMailDemo
at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
Caused by: java.lang.ClassNotFoundException: Demo.SendMailDemo
at$ Source)
at$ Source)
at Method)
at Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 1 more

I am using the Eclipse IDE and I have also included the mail.jar and the activation.jar file in the class path using the Add External Jars option in the Java Build Path window.
I also tried changing the file name but the results are the same. Why am I getting this error and how do I remove it?
6 years ago
Thank you Jeff. I tried executing the following command:

But the file is not executing.

Another problem I am now facing is with the following command:

This command works fine in Netbeans but is returning null value when used in the Eclipse IDE.
6 years ago
Thanks Steve. I found the solution. It is just as you said run the application from the command prompt. But in this case since I wanted to schedule the file for execution at a future time and date, I used a batch file. with the following code:

I then scheduled it using the windows scheduler and the following command:

and its working perfectly.
6 years ago
Thanks Tim and Henry. I tried using the Runtime and ProcessBuilder option. Here is the code i created:

This program executes without any errors or exceptions but the HelloWorld program does not execute. In my HelloWorld program I am writing to a "out.txt" file, but after executing this program when I open the "out.txt" file it is blank.

The HelloWorld program executes fine through the command prompt. But in the command prompt we use the following command set path = "C:\Program File\Java\jdk\bin" . Do I have to do use this command in this case too? If so, how?
6 years ago
I have written the following code to create the .class file:

This code runs properly and the HelloWorld.class file does get generated. How do I execute this .class file?
6 years ago
The javadoc says that when we use the schedule(Timer task, Date time) function the specified task is scheduled for execution but does not explicitly mention if the task will be executed once or repeated. I tried it and it works as long as the NetBeans IDE is running.

When I close the IDE I get the following notification:

Exiting the IDE will close the following processes:
Process- Timer(run)

What should I do so that the program continues execution even after closing the IDE?

Here is the code I have created:

Thank you.
6 years ago
Does the method :

schedule a task for execution only once or does it schedule the task for execution repeatedly on the specified date and time?
6 years ago
I am using a embedded derby database to store my application data. I am using this database for the first time. Is it possible for various files in my application to access the database concurrently?

I also came across the following command:

Should I use the above command after every file performs some operation on the database or should i use it after all the files have finished their operations on the database?
Thanks Jeff. I have decided on using the derby db.
6 years ago
Thanks Gijs and Rob. I need to store certain variable values after some files are executed. I am using a jtable in a certain class to do that. So now each time after the jtable is updated i just have to store its object in a file and retrieve it the next time i need it. Another option I am considering is to use the Derby database. Which is a better option?
6 years ago
Is it possible to retain variable values after program execution is over and access these new values the next time the program is invoked?
6 years ago
Suppose i synchronize a instance method in a class and create two objects A and B of the same class. Now when object A is accessing the synchronized method will B also be able to access it or will it have to wait until A releases the lock?