File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Please help with my program Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Reply locked New topic
Author

Please help with my program

Tawi Oei
Ranch Hand

Joined: Dec 16, 2012
Posts: 95
So, what should I do? I did use } to solve plenty of the problems but that is not enough, so what should I do next?
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18715
    
  40

fred rosenberger wrote:
This is really such a mess of ugly, terrible code, that I doubt there is any point in salvaging it.



I have to admit, I tend to stay with crappy code more than others -- believing that most bad code can be refactored. Once, I was handed 300 lines of crap code -- it was undocumented, and worked only 99% of the time. It took around a week, before I decide to rewrite the whole thing from scratch. My version was only 50 lines long, and that's including comments...

Anyway, in this case, with three other respected ranchers suggesting "starting over", this may be a consideration. I don't have a direct opinion though -- as I didn't review the code.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11229
    
  16

Everyone here has gone WAY BEYOND what they normally do to help you. You keep ignoring their advice (including mine).

So tell me...Why should anyone continue to help you? What have you done in this conversation apart from a) say "My code doesn't work, how do I fix it", and B) ignore the advice you are given?

I don't understand how you can write this much code and only now discover you don't have a main method. the main method is the FIRST thing you should write. I NEVER write more than 2-3 lines of code at most before I compile. The fact that you have 400 (or 1400, if you uncomment everything) is just profane.


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Tawi Oei
Ranch Hand

Joined: Dec 16, 2012
Posts: 95
Guys, I have no time to rebuild that. I almost run out of my time. I rebuild it very often so please just help me. I did not ignore you. I only have no time. Believe me that from the bottom of my heart, I salute you.
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11229
    
  16

Tawi Oei wrote:Guys, I have no time to rebuild that. I almost run out of my time. I rebuild it very often so please just help me. I did not ignore you. I only have no time. Believe me that from the bottom of my heart, I salute you.

The fact that you "have no time" is really no concern of ours.

If this is for a class, then it is clear to me you did not learn what you were supposed to, and deserve whatever grade you get.

Nobody here is going to write it for you. Apart from the fact that we just don't do that here, I am sure it would be a violation of your school's ethics code.

You are hell-bent on fixing this code. so be it. I will tell you ONE MORE TIME...

We can't help you unless you tell us a) EXACTLY what you are doing, and b) EXACTLY what the compiler tells you. And then, if you want to fix it, you have to follow our advice. If you don't/can't/won't do those two things, you're simply wasting everyone's time.

Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18715
    
  40

Tawi Oei wrote:Guys, I have no time to rebuild that. I almost run out of my time. I rebuild it very often so please just help me. I did not ignore you. I only have no time. Believe me that from the bottom of my heart, I salute you.


Not answering someone, because you have no time (to do what is asked), is ignoring someone. After all, from my point of view, how can I tell the difference??


For example, here is my response to find the NPE issue...

Henry Wong wrote:
Tawi Oei wrote:The program was doing well. The only problems I have are NPE, dual exception, bad display. I can fix bad display, what about dual exception catch and NPE? I removed an exception catch and changed the program so the program is the same with the current program but NetBeans gave me error message that no main class found, what should I do? I cannot recreate the program because I almost run out of time so please just help me to solve the problem ok?



For NPEs, it is probably best to use the stacktrace. Add a printout of the stacktrace in the catch statement..... And as others already mentioned, there is zero chance that I will look at 1300 lines of code in my spare time. I have enough work in my real job.


So, you have no time to to add a call to print out the stack trace, and hence, be able to locate the point of your NPE?? Adding the call will take less than a minute. Isolating the NPE will take a few minutes more. And fixing it, well, that depends on what the cause is.... so you have no time for that? Or is the reason something else?

Regardless, the offer still stands. If you want to fix the NPE issue, then get the stacktrace, and I will help you interpret it, if you run into issues regarding understanding it and hunting down the NPE.

Henry
Dennis Grimbergen
Ranch Hand

Joined: Nov 04, 2009
Posts: 140

Just out of curiosity....what about your deadline? (You were in a hurry right?) Are you a student? Is it for work?
I read all 40+ posts and my idea is that you need to solve some problem, but you don't really care about it.
Are you a junior at programming or is this something you need to do once but isn't very relevant for something else?

(no offense at junior programmers btw )


SCJP, SCWCD, SCJD
Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 6109
    
    6

Tawi Oei wrote:I almost run out of time


Nobody here has any interest at all in your time constraints. I will point out, however, that ignoring the advice you've been given for the last several days or week or however long it's been was very poor time management on your part.

so please just help me to solve the problem ok?


People have been helping you. You've been ignoring that help.
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 4456
    
    6

Maaf, Tawi. Tidak ada yang lebih kami bisa lakukan untuk membantu anda.

Since this is a requirement for a Masters degree, no one here will do your work for you. We can only offer guidance and if for any reason you can't follow the advice you're given, then I'm afraid you're on your own. Good luck.


Junilu - [How to Ask Questions] [How to Answer Questions]
Mack Wilmot
Ranch Hand

Joined: Jul 27, 2011
Posts: 88

Tawi Oei wrote:I make the program myself. The problem is I almost touch the time limit. I must finish this as soon as possible to get my master degree.


What school is it?

I love this thread.
Tawi Oei
Ranch Hand

Joined: Dec 16, 2012
Posts: 95
Mack Wilmot wrote:
Tawi Oei wrote:I make the program myself. The problem is I almost touch the time limit. I must finish this as soon as possible to get my master degree.


What school is it?

I love this thread.


Thanks for loving this thread. Here is my final code:



I have a problem with my main. What should I do to solve it?
Saif Asif
Ranch Hand

Joined: Aug 11, 2011
Posts: 440

Seems to compile and run just fine on my system. A GUI came up with with a button "Lanjut" and a whole lot of other things that I was unable to understand.


Muhammad Saif Asif Mirza
OCJA(5/6) OCJP(6) OCJWCD(6)
Mack Wilmot
Ranch Hand

Joined: Jul 27, 2011
Posts: 88

Tawi Oei wrote:
Mack Wilmot wrote:
Tawi Oei wrote:I make the program myself. The problem is I almost touch the time limit. I must finish this as soon as possible to get my master degree.


What school is it?

I love this thread.


Thanks for loving this thread. Here is my final code:

I have a problem with my main. What should I do to solve it?


Can you answer this question? If you can, you have solved your problem.

Here is the question:

Is main a field, thread, method, class or initializer block?
Tawi Oei
Ranch Hand

Joined: Dec 16, 2012
Posts: 95
Saif Asif wrote:Seems to compile and run just fine on my system. A GUI came up with with a button "Lanjut" and a whole lot of other things that I was unable to understand.


How can that be? The NetBeans told me that I have problems with my main, what is the problem with the notebook that is used by me? Is this the dirty techniques done by some people to give me some obstacles? Does this happens because some of my enemy cannot defeat me or persuade me to sell low so they hijack the notebook that is used by me to make me to be like an idiot or I miss some important settings?
Saif Asif
Ranch Hand

Joined: Aug 11, 2011
Posts: 440

Tawi Oei wrote:
Saif Asif wrote:Seems to compile and run just fine on my system. A GUI came up with with a button "Lanjut" and a whole lot of other things that I was unable to understand.


How can that be? The NetBeans told me that I have problems with my main, what is the problem with the notebook that is used by me?


Is it possible that maybe there is some issue with the project in the netbeans or the settings and configuration of netbeans on your particular notebook ? Try to make a new Hello world project in the same netbeans of this notebook and see if that compiles and run fine.

Is this the dirty techniques done by some people to give me some obstacles?


I have no idea what you mean by here .
Tawi Oei
Ranch Hand

Joined: Dec 16, 2012
Posts: 95
Saif Asif wrote:
Tawi Oei wrote:
Saif Asif wrote:Seems to compile and run just fine on my system. A GUI came up with with a button "Lanjut" and a whole lot of other things that I was unable to understand.


How can that be? The NetBeans told me that I have problems with my main, what is the problem with the notebook that is used by me?


Is it possible that maybe there is some issue with the project in the netbeans or the settings and configuration of netbeans on your particular notebook ? Try to make a new Hello world project in the same netbeans of this notebook and see if that compiles and run fine.

Is this the dirty techniques done by some people to give me some obstacles?


I have no idea what you mean by here .


I am not saying that any folks in here do some things to me but don't you think that there are some things wrong with this?
Saif Asif
Ranch Hand

Joined: Aug 11, 2011
Posts: 440

Did you try what I asked of you ?
Winston Gutkowski
Bartender

Joined: Mar 17, 2011
Posts: 7643
    
  19

Tawi Oei wrote:I am not saying that any folks in here do some things to me but don't you think that there are some things wrong with this?

The only thing wrong here is that you're STILL not listening to a word anyone's saying.

At least, that's all I can assume, since, after being told umpteen times not to post so much
code, you post it YET AGAIN.

If I see it again, I will lock this thread.

Winston

Isn't it funny how there's always time and money enough to do it WRONG?
Articles by Winston can be found here
Mack Wilmot
Ranch Hand

Joined: Jul 27, 2011
Posts: 88

Can you answer my question?


Is main a field, thread, method, class or initializer block?


Oh, by the way, I am curious, have you found a woman that will obey your every order yet?
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11229
    
  16

Tawi Oei wrote: Here is my final code:

<snip>

I have a problem with my main. What should I do to solve it?


How can I make this any clearer:

TELL US WHAT THE PROBLEM IS.

Nobody can help you unless you give us the exact text of the error you get. Nobody can help you unless you also tell us what you are doing that gives you this error.

Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18715
    
  40



Okay ranchers. C'mon. Remember the "be nice" rule.


Thanks to Saif, the OP has isolated the issue -- and is looking to fix the netbeans project. Although, the OP isn't really listening much, we are actually helping -- and isn't that more important?

Henry
Mack Wilmot
Ranch Hand

Joined: Jul 27, 2011
Posts: 88

The last code posted is not a NetBeans project problem, it's a code problem. Relative to main and getting it to execute is a code problem.
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14107
    
  16

Tawi Oei wrote:I have a problem with my main. What should I do to solve it?

Tawi, listen please!

There are lots of people here who would love to help you. After all, we are all volunteers here, and we are here on this forum because we like answering questions. But if you want help, you have to provide all the relevant information that you have, so that people can understand what problems you have exactly.

Only saying "I have a problem with my main" is by far not enough information.

WHAT problem do you have with your main? Does NetBeans or Java show you any error messages? If yes, then copy and paste the exact text of the error messages into a reply, or make a screenshot and post it in a reply here.

What you are doing now, is like when your car is broken, and you call up a car repair service, and you tell them "My car is broken. I need it to be fixed in an hour. Tell me what I need to fix, right now!". You must understand that if you do not tell the mechanic on the phone what exactly is wrong with your car, he cannot help you.

You must TellTheDetails. If you don't, nobody can help you. And you've let it go so far that people are getting enough that you are ignoring their advice, so this thread is going to be closed soon, if you don't provide all the relevant information. It looks as if you don't want to be helped!

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 4456
    
    6

Tawi Oei wrote:How can that be? The NetBeans told me that I have problems with my main, what is the problem with the notebook that is used by me?

It might very well be a problem with your local configuration. We can't really be sure until you TellTheDetails, although Mack has been nice enough to actually try to figure it out for you. Multiple requests have been made for you to TellTheDetails, but I haven't seen a response from you that does that. That's why people are getting impatient with you.

By "tell the details" we mean,

If the computer output is "Unexpected error (FrameBaru.java:25)", then you have to tell us "The computer is saying 'Unexpected error (FrameBaru.java:25)'". It is NOT ENOUGH to just tell us that "The NetBeans told me that unexpected error."

Do you understand what we mean now by TellTheDetails and "tell us EXACTLY what error are you getting"?
Dennis Grimbergen
Ranch Hand

Joined: Nov 04, 2009
Posts: 140

Tawi....I looked at your last posted code. I needed to change one thing to make it compile and run. Put the main method somewhat higher in the code...it does not belong to the class above.
I hope you learned something here....not about Java..but about how to ask questions and how to get help...good luck
Tawi Oei
Ranch Hand

Joined: Dec 16, 2012
Posts: 95
Dennis Grimbergen wrote:Tawi....I looked at your last posted code. I needed to change one thing to make it compile and run. Put the main method somewhat higher in the code...it does not belong to the class above.
I hope you learned something here....not about Java..but about how to ask questions and how to get help...good luck


Ok, I solved my problem with main but, I get some other problems, how to solve it? This is the error code:

Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - Erroneous sym type: getContentPane
at proyektesis.ProyekTesis.<init>(ProyekTesis.java:18)
at proyektesis.ProyekTesis.main(ProyekTesis.java:723)
Java Result: 1

I did not create other hello world program because I have not enough time. Can any folks help me? If you want me to put the updated code, I need to go to an internet cafe to do this because I cannot post it with my modem ok?

I cannot answer this question:

Is main a field, thread, method, class or initializer block?

What is the answer to answer this question?

Ok go to http://www.tawijakarta.blogspot.com under Java Program III again, I post the code to that site because I cannot post it here.
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18715
    
  40

Tawi Oei wrote:
Ok, I solved my problem with main but, I get some other problems, how to solve it? This is the error code:

Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - Erroneous sym type: getContentPane
at proyektesis.ProyekTesis.<init>(ProyekTesis.java:18)
at proyektesis.ProyekTesis.main(ProyekTesis.java:723)
Java Result: 1



Looks like a netbeans bug...

https://netbeans.org/bugzilla/show_bug.cgi?id=199293

Henry
Steve Fahlbusch
Bartender

Joined: Sep 18, 2000
Posts: 559
    
    7

It appears you may have a netbeans bug......


so compile your code from the command line / terminal.

Also if you can not spend 2 minutes writing / running a HelloWorld program then you are really in a world of hurt.

I suggest that you go thru the tutorials to make sure you are ok with the concepts.

-steve
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14107
    
  16

Henry Wong wrote:Looks like a netbeans bug...

https://netbeans.org/bugzilla/show_bug.cgi?id=199293

Note that the bug database says this bug is fixed, it should be OK in NetBeans 7.3.

Tawi, you can try downloading and installing NetBeans 7.3 and see if the problem is solved.

Tawi Oei wrote:I did not create other hello world program because I have not enough time.

I don't believe that - writing a Hello World program takes less time than typing in a reply on the forum here.
Tawi Oei
Ranch Hand

Joined: Dec 16, 2012
Posts: 95
Jesper de Jong wrote:
Henry Wong wrote:Looks like a netbeans bug...

https://netbeans.org/bugzilla/show_bug.cgi?id=199293

Note that the bug database says this bug is fixed, it should be OK in NetBeans 7.3.

Tawi, you can try downloading and installing NetBeans 7.3 and see if the problem is solved.

Tawi Oei wrote:I did not create other hello world program because I have not enough time.

I don't believe that - writing a Hello World program takes less time than typing in a reply on the forum here.


I am using the NetBeans 7.3 and the error messages are generated by the NetBeans 7.3 itself, so what should I do? Beside, what other problems do I have? Why can't I extend the FrameBaru? How to avoid to open multiple windows? With CardLayout, can you show me the example? Ok, I typed it and? What next?
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18715
    
  40

Tawi Oei wrote:
I am using the NetBeans 7.3 and the error messages are generated by the NetBeans 7.3 itself, so what should I do? Beside, what other problems do I have? Why can't I extend the FrameBaru? How to avoid to open multiple windows? With CardLayout, can you show me the example? Ok, I typed it and? What next?


Well, you can also try the work-around mentioned in the bug report. Other than that, perhaps you can try reinstalling netbeans? Or using the command line tools instead?

Henry
Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 6109
    
    6

Henry Wong wrote:
Well, you can also try the work-around mentioned in the bug report. Other than that, perhaps you can try reinstalling netbeans? Or using the command line tools instead?


Or doing what people have been suggesting for days or weeks now--break the problem down into smaller parts.
Mansukhdeep Thind
Ranch Hand

Joined: Jul 27, 2010
Posts: 1157

Well Jeff, it seems to me that there is a vast language/cultural barrier here that is obstructing Tawa from explaining his problem properly. This is what I could conclude from reading through the last what, 70 odd posts. Yes, he is providing incomplete information. But my bet is that that the language/cultural barrier is huge. But hats off to you guys that you are so patient.


~ Mansukh
Tawi Oei
Ranch Hand

Joined: Dec 16, 2012
Posts: 95
Well, guys, do you have other suggestions? Do I have to change the code? What things must be changed? Can I call a class from main with if?
Steve Fahlbusch
Bartender

Joined: Sep 18, 2000
Posts: 559
    
    7

First thing to do is to compile / run this from the command line.

This will isolate Java issues from Netbean issues.

After you do that, let us know what (very specifically) you did, what happened and what you expected.

Good Luck.

-steve
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Please help with my program