Author |
Message |
V4hn
Joined: 27 Nov 2007 Posts: 14
|
|
UpCount - recursive calamity |
|
Ev'ning,
no problems solving it, but since my JavaVM stopped because of a stack overflow, when I tried to run the code, I had to port it to C...
I'm wondering, whether there is any option to increase the default stack-size in java?
_________________
 |
|
Sun Oct 05, 2008 10:16 pm |
|
 |
lechat

Joined: 27 Feb 2008 Posts: 12
|
|
|
|
what about 'java -X'? Then you can use 'java -Xss1024M' for 1Gb stack size...
But do you really need it?
|
|
Mon Oct 06, 2008 6:25 pm |
|
 |
V4hn
Joined: 27 Nov 2007 Posts: 14
|
|
|
|
 |
 |
what about 'java -X'? Then you can use 'java -Xss1024M' for 1Gb stack size... |
Ah, thanks!
I don't work with Java normally, since I don't like bytecode,
so I didn't know any parameters..
 |
 |
But do you really need it? |
Well, not any more, since I've done that challenge,
but we're hacking to learn, aren't we?
And next time I need to run some heavy recursive java code,
I'll know how to increase the stacksize 
_________________
 |
|
Mon Oct 06, 2008 7:07 pm |
|
 |
Donster
Joined: 28 Oct 2008 Posts: 2
|
|
|
|
I get the same problems with the Stackoverflow.
Then I turned the recursive function into an iterative one.
It works fine. 
|
|
Tue Nov 04, 2008 10:25 am |
|
 |
knox
Joined: 01 Oct 2008 Posts: 8
|
|
|
|
I think donster's post is giving to much hint on solving the challenge. Maybe the post should be censored.
|
|
Tue Nov 04, 2008 11:54 am |
|
 |
adum

Joined: 19 Apr 2007 Posts: 392
|
|
|
|
this discussion is a little to give-away, but since the problem is really quite simple i'm not going to worry about it.
|
|
Tue Nov 04, 2008 6:58 pm |
|
 |
superhacker
Joined: 06 Mar 2009 Posts: 7
|
|
|
|
I changed the code to vb and used another method to count up
However the result i get seems to be wrong...
My result is a 5 digit number, does that sound alright?
|
|
Fri Apr 03, 2009 11:46 am |
|
 |
psycore
Joined: 18 Feb 2009 Posts: 8
|
|
|
|
 |
 |
But do you really need it? |
Uhm, since I don't even know the words recursive or iterative (should I? I'm 16), yes.
|
|
Wed Jul 01, 2009 6:01 pm |
|
 |
SandyThiemer
Joined: 06 Mar 2009 Posts: 5
|
|
|
|
Hello,
i have a problem with the upcount challenge. I installed jdk 1.6.0_17 and compiled the class file without any problems but when i run the classfile i got an exception:
Exception in thread "main" java.lang.NoClassDefFoundError: upcount/class
Could not find the main class: upcount.class. Program will exit.
I really dont understand that because i changed nothing in the upcount.java file.
I hope the text above is not a spoiler...
thx in advance(?)
Sandy
|
|
Wed Dec 23, 2009 9:42 pm |
|
 |
DaymItzJack
Joined: 29 Oct 2009 Posts: 106
|
|
|
|
What are you using to run it?
|
|
Wed Dec 23, 2009 10:19 pm |
|
 |
SandyThiemer
Joined: 06 Mar 2009 Posts: 5
|
|
|
|
the simple commandline tool in the jdk named java
|
|
Wed Dec 23, 2009 11:52 pm |
|
 |
DaymItzJack
Joined: 29 Oct 2009 Posts: 106
|
|
|
|
 |
 |
the simple commandline tool in the jdk named java |
How so? You might be doing something wrong.
|
|
Thu Dec 24, 2009 3:54 am |
|
 |
SandyThiemer
Joined: 06 Mar 2009 Posts: 5
|
|
|
|
the classfile from the upcount.jave is in the same directory like java and so i just type in
java upcount.class
then the error appears
|
|
Thu Dec 24, 2009 10:50 am |
|
 |
megatron40
Joined: 10 Aug 2009 Posts: 36 Location: Texas |
|
|
|
When running a Java application from the command line you don't want to append the .class extension. Just the class name. So in your case it would be something like
 |
 |
java upcount
|
_________________ "The man who doesn't read... has no advantage over the man who can't read..." - Mark Twain
Last edited by megatron40 on Thu Dec 24, 2009 7:18 pm; edited 1 time in total |
|
Thu Dec 24, 2009 2:04 pm |
|
 |
SandyThiemer
Joined: 06 Mar 2009 Posts: 5
|
|
|
|
oh youre right! Thx! What a dumb failure 
|
|
Thu Dec 24, 2009 6:43 pm |
|
 |
|