hacker.org Forum Index
RegisterSearchFAQMemberlistUsergroupsLog in
UpCount - recursive calamity
Goto page 1, 2  Next
 
Reply to topic    hacker.org Forum Index » Challenges View previous topic
View next topic
UpCount - recursive calamity
Author Message
V4hn



Joined: 27 Nov 2007
Posts: 14

Post UpCount - recursive calamity Reply with quote
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 View user's profile Send private message Visit poster's website
lechat



Joined: 27 Feb 2008
Posts: 12

Post Reply with quote
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 View user's profile Send private message
V4hn



Joined: 27 Nov 2007
Posts: 14

Post Reply with quote
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..

Quote:
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 Wink

_________________
Mon Oct 06, 2008 7:07 pm View user's profile Send private message Visit poster's website
Donster



Joined: 28 Oct 2008
Posts: 2

Post Reply with quote
I get the same problems with the Stackoverflow.
Then I turned the recursive function into an iterative one.
It works fine. Very Happy
Tue Nov 04, 2008 10:25 am View user's profile Send private message
knox



Joined: 01 Oct 2008
Posts: 8

Post Reply with quote
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 View user's profile Send private message
adum



Joined: 19 Apr 2007
Posts: 391

Post Reply with quote
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 View user's profile Send private message Visit poster's website
superhacker



Joined: 06 Mar 2009
Posts: 7

Post Reply with quote
I changed the code to vb and used another method to count up Wink

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 View user's profile Send private message
psycore



Joined: 18 Feb 2009
Posts: 8

Post Reply with quote
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.
Wed Jul 01, 2009 6:01 pm View user's profile Send private message
SandyThiemer



Joined: 06 Mar 2009
Posts: 5

Post Reply with quote
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 View user's profile Send private message Send e-mail Yahoo Messenger
DaymItzJack



Joined: 29 Oct 2009
Posts: 106

Post Reply with quote
What are you using to run it?
Wed Dec 23, 2009 10:19 pm View user's profile Send private message
SandyThiemer



Joined: 06 Mar 2009
Posts: 5

Post Reply with quote
the simple commandline tool in the jdk named java
Wed Dec 23, 2009 11:52 pm View user's profile Send private message Send e-mail Yahoo Messenger
DaymItzJack



Joined: 29 Oct 2009
Posts: 106

Post Reply with quote
SandyThiemer wrote:
the simple commandline tool in the jdk named java
How so? You might be doing something wrong.
Thu Dec 24, 2009 3:54 am View user's profile Send private message
SandyThiemer



Joined: 06 Mar 2009
Posts: 5

Post Reply with quote
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 View user's profile Send private message Send e-mail Yahoo Messenger
megatron40



Joined: 10 Aug 2009
Posts: 36
Location: Texas

Post Reply with quote
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

Code:

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 View user's profile Send private message Visit poster's website AIM Address
SandyThiemer



Joined: 06 Mar 2009
Posts: 5

Post Reply with quote
oh youre right! Thx! What a dumb failure Very Happy
Thu Dec 24, 2009 6:43 pm View user's profile Send private message Send e-mail Yahoo Messenger
Display posts from previous:    
Reply to topic    hacker.org Forum Index » Challenges All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.