Win a copy of Escape Velocity: Better Metrics for Agile Teams this week in the Agile and Other Processes forum!

Ramesh Pramuditha Rathnayake

Ranch Hand
+ Follow
since Oct 31, 2012
Ramesh Pramuditha likes ...
Netbeans IDE MySQL Database Java
Sri Lanka
Cows and Likes
Cows
Total received
2
In last 30 days
0
Total given
0
Likes
Total received
25
Received in last 30 days
0
Total given
14
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Ramesh Pramuditha Rathnayake

I found the answer..

There is a method in ObjectInputStream class called, resolveClass(ObjectStreamClass desc). It is called once every time the Stream meets a new type of object. The default implementation of this method is,

where loader is the default ClassLoader of the JVM.

I just had to override this method with my own ClassLoader. I edited my readObject() method in FileIOManager class as follows.


While the people in other forum go way even without looking at my problem, here you talked to me and inspired me with your ideas even though you didn't have an answer. Thank you for that..


7 years ago
I tried that too. The result is same. ClassNotFoundException in 3rd line.

As I see, the loaded class by classLoader is not accessible for the ObjectInputStream. If there is an another way to load a class to ObjectInputStream manually, I think my problem will be solved..
7 years ago
This question was asked in a different forum too. But I didn't get an answer..

I have a class file and a saved object of that class. My java application doesn't have that class in its libraries. When I tried to load the object using ObjectInputStream, it gives an ClassNotFoundException.

Then I use the following code.



But this code also gives me the same exception when reading the object. Hope for a help to do my task..
MyClass doesn't have a package name.
FileIOManager.readObject() is a method I created to read a object and it works fine for other object which have classes inside my libraries.

7 years ago
Thank you for help. Windows API is really helpful.
And easier than command lines..
7 years ago
Using command reg windows registry can be changed.
There is a function called system in C which can be used to execute commands in command prompt. Using that I can execute reg command and change registry.
I couldn't find an easier way than that.

I think that way is easier than using native libraries..
7 years ago
Is there a way to read, edit and delete keys and values in windows registry using C..? I googled. But couldn't find a way to do it using C.
Are there libraries libraries available for that..?
Please help..
7 years ago
I think you call the Report() method after the JInternalFrame has shown. (That means after calling setVisible(true))
If you have done that you have to re-validate your JInternalFrame. To do that type revalidate() after adding the viewer.

If you don't know why revalidate() should be called, search google or read API.
I can't see a reason why all the text are selected after typing 3 characters.
However, if it happens type ((JTextField)fliessgewaesserComboBox.getEditor().getEditorComponent()).setCaretPosition(searchString.length()); at the end of the keyReleased() event.
But after you entered this, when you release any key, the cursor goto the end. I think you can find a way to avoid that..
8 years ago
It would be better if you state how did you try it without using static..?

But I can suggest you,
you can use a method called getObservableList() returning the observable list in the first class so that you can access that observable list in second class. When accessing do not create a new instance of first class. I think you know why..
8 years ago
Think there is only one thread. And then it takes 8 seconds to finish the job.
We can assume that both threads start simultaneously. Therefore do1() is run by both threads simultaneously and it takes 1 sec to run by both threads. As do2() is synchronized it takes 2 sec to run by both threads. And that means to execute one cycle it takes 3 seconds.
Answer => 3x4=12 seconds
8 years ago
I run your first code and I didn't get any runtime exceptions.
And you don't have to use another Scanner and search line by line. The next() method of the Scanner will keep search in the next line if the current line has end.



What do think will print here..? 12.3456.. No, here you get that runtime error. But, if there weren't that abcd answer will be 12.3456

Scanner lineScanner = new Scanner(line);
while (lineScanner.hasNextDouble()){
System.out.print(lineScanner.next() + " " + "\n");



The text on the file do not contain double value in the first place, except the first line. Therefore hasNextDouble() works only for first line.

So you have to keep searching for a double value, if find one print it. And if it is not the end of the file, keep doing that thing.



Actually, your question was to print the names, not the doubles. I think this may help.
8 years ago
No..
Now there is no need of those methods.
8 years ago
The condition is checked compile time, but the value of the variable is not checked. That means, though you initialize the int with 1, compiler don't know whether the value of the variable. So there is only a possibility to run that code.
But the value of final variables are known by the compiler. So you get an error here.
8 years ago
I don't understand what is precedence explicit..?

Anyway, I don't think that there is a deference between two lines, when we use split method and also replace methods. But there is a capturing group in the former and no need to think about that when using those methods.
8 years ago
I think the methods teenWord(int), tenWord(int), ... are there for return the String that gives the spelling to an input number. But you have done all of them in threeDigitSpelling method.
And in each case you have to write word+=reading but not word=reading. That is one mistake.
In early post, I told you to erase all the Random codings. But you have left one in threeDigitSpelling method. You have to remove that and you should return word in that method as it has the spelling of the number.
The array verse is also an demonstration only. It is not necessary to the software.
8 years ago