Page 1 of 2
UpCount - recursive calamity
Posted: Sun Oct 05, 2008 10:16 pm
by V4hn
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?
Posted: Mon Oct 06, 2008 6:25 pm
by lechat
what about 'java -X'? Then you can use 'java -Xss1024M' for 1Gb stack size...
But do you really need it?
Posted: Mon Oct 06, 2008 7:07 pm
by V4hn
lechat wrote: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
Posted: Tue Nov 04, 2008 10:25 am
by Donster
I get the same problems with the Stackoverflow.
Then I turned the recursive function into an iterative one.
It works fine.
Posted: Tue Nov 04, 2008 11:54 am
by knox
I think donster's post is giving to much hint on solving the challenge. Maybe the post should be censored.
Posted: Tue Nov 04, 2008 6:58 pm
by adum
this discussion is a little to give-away, but since the problem is really quite simple i'm not going to worry about it.
Posted: Fri Apr 03, 2009 11:46 am
by superhacker
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?
Posted: Wed Jul 01, 2009 6:01 pm
by psycore
lechat wrote:But do you really need it?
Uhm, since I don't even know the words recursive or iterative (should I? I'm 16), yes.
Posted: Wed Dec 23, 2009 9:42 pm
by SandyThiemer
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
Posted: Wed Dec 23, 2009 10:19 pm
by DaymItzJack
What are you using to run it?
Posted: Wed Dec 23, 2009 11:52 pm
by SandyThiemer
the simple commandline tool in the jdk named java
Posted: Thu Dec 24, 2009 3:54 am
by DaymItzJack
SandyThiemer wrote:the simple commandline tool in the jdk named java
How so? You might be doing something wrong.
Posted: Thu Dec 24, 2009 10:50 am
by SandyThiemer
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
Posted: Thu Dec 24, 2009 2:04 pm
by megatron40
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
Posted: Thu Dec 24, 2009 6:43 pm
by SandyThiemer
oh youre right! Thx! What a dumb failure