Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Page 1 of 2 12 LastLast
Results 1 to 25 of 28

Thread: Something really weird is going on with my code at times.

  1. #1
    Banned
    Join Date
    May 2010
    Location
    North Central Illinois
    Posts
    1,631
    My Mood
    Sleepy
    Thanks
    390
    Thanked 112 Times in 110 Posts

    Angry Something really weird is going on with my code at times.

    Sometimes my code doesn't work...usually when it gets kinda big...but I've tried moving it to others projects, other packages, giving it other names...and it either will just compile at a certain point and ignore any additions..good or bad. I can even delete the entire code pretty much and it'll still run at that point. Other times it pretends like it can't find the class or can't find the main method. This is happening to more than one program. I'm getting pretty ticked. Is there a way I can make Eclipse...which I fear may be the culprit behind all of this somehow...behave so I don't have to waste all this memory...in vain too...to compile code?



    Do you know of any compiler exorcists because I'm starting to wonder if my compiler is possessed?

    Sorry I can't explain better, but I really don't know what the heck is going on myself.
    Last edited by javapenguin; February 3rd, 2011 at 01:12 AM.


  2. #2
    Junior Member
    Join Date
    Jan 2011
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Something really weird is going on with my code at times.

    Quote Originally Posted by javapenguin View Post
    Sometimes my code doesn't work...usually when it gets kinda big...but I've tried moving it to others projects, other packages, giving it other names...and it either will just compile at a certain point and ignore any additions..good or bad. I can even delete the entire code pretty much and it'll still run at that point. Other times it pretends like it can't find the class or can't find the main method. This is happening to more than one program. I'm getting pretty ticked. Is there a way I can make Eclipse...which I fear may be the culprit behind all of this somehow...behave so I don't have to waste all this memory...in vain too...to compile code?



    Do you know of any compiler exorcists because I'm starting to wonder if my compiler is possessed?

    Sorry I can't explain better, but I really don't know what the heck is going on myself.
    Maybe back up you code then reinstall eclipse? Have you tried that yet?

  3. #3
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 294 Times in 227 Posts
    Blog Entries
    4

    Default Re: Something really weird is going on with my code at times.

    I have used Eclipse my entire Java programming life and have never once had a problem like this. Have you tried another IDE to see if you have the same issues?

    If you do, I suggest completely removing Java from your system and then reinstalling everything including Eclipse.
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

  4. #4
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 294 Times in 227 Posts
    Blog Entries
    4

    Default Re: Something really weird is going on with my code at times.

    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

  5. #5
    Member
    Join Date
    Jul 2010
    Location
    Washington, USA
    Posts
    307
    Thanks
    16
    Thanked 43 Times in 39 Posts

    Default Re: Something really weird is going on with my code at times.

    Eclipse was doing weird stuff like that to me. So I switched to Netbeans.

  6. #6
    Banned
    Join Date
    May 2010
    Location
    North Central Illinois
    Posts
    1,631
    My Mood
    Sleepy
    Thanks
    390
    Thanked 112 Times in 110 Posts

    Unhappy Re: Something really weird is going on with my code at times.

    Quote Originally Posted by JavaPF View Post
    I have used Eclipse my entire Java programming life and have never once had a problem like this. Have you tried another IDE to see if you have the same issues?

    If you do, I suggest completely removing Java from your system and then reinstalling everything including Eclipse.
    I'm wondering if it's the project type I'm selecting. Is there some setting that will cause it to halt in memory or something if it reaches like 1000+ lines in code? If so...how do I stop that?

    I haven't tried using a separate workstation...I'd have to move several classes to do that...which wastes memory.

    I'm wondering if it's the type of project. Does Eclipse automatically install new IDEs when they come out for me or do I have to go and do that?

    Will my code transfer to a new IDE?

  7. #7
    Banned
    Join Date
    May 2010
    Location
    North Central Illinois
    Posts
    1,631
    My Mood
    Sleepy
    Thanks
    390
    Thanked 112 Times in 110 Posts

    Lightbulb Re: Something really weird is going on with my code at times.

    Hmmmm....I did some tests and when I fiddle with "Run Configurations" and "Debug Configurations", I get different results...which is a breakthrough...but I can't yet get it to do to the updated stuff...it' still won't compile the code that's there.

    Could you tell me how to use those configurations correctly so maybe this problem will go away?


  8. #8
    Member
    Join Date
    Jul 2010
    Location
    Washington, USA
    Posts
    307
    Thanks
    16
    Thanked 43 Times in 39 Posts

    Default Re: Something really weird is going on with my code at times.

    Quote Originally Posted by javapenguin View Post
    I'm wondering if it's the project type I'm selecting. Is there some setting that will cause it to halt in memory or something if it reaches like 1000+ lines in code? If so...how do I stop that?

    I haven't tried using a separate workstation...I'd have to move several classes to do that...which wastes memory.

    I'm wondering if it's the type of project. Does Eclipse automatically install new IDEs when they come out for me or do I have to go and do that?

    Will my code transfer to a new IDE?
    Your code will transfer to a new IDE.

  9. The Following User Says Thank You to Brt93yoda For This Useful Post:

    javapenguin (February 3rd, 2011)

  10. #9
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,318
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: Something really weird is going on with my code at times.

    I've been using Ecplise for years and only on one or two occasions have had issues. It has been rock solid for me considering what I've put it through. Three suggestions.
    First, go to Project -> clean. I've had problems where it seemed a class file in the project somehow gets corrupted and throws the who project out of wack. Cleaning removes all the compiled files and you can recompile the project from scratch.
    Next, if the Project -> Build Automatically is not set then changes will not take effect until you manually build the project.
    Lastly, if you have multiple mains in a project, make sure you are running the correct one.

  11. The Following User Says Thank You to copeg For This Useful Post:

    javapenguin (February 3rd, 2011)

  12. #10
    Banned
    Join Date
    May 2010
    Location
    North Central Illinois
    Posts
    1,631
    My Mood
    Sleepy
    Thanks
    390
    Thanked 112 Times in 110 Posts

    Unhappy Re: Something really weird is going on with my code at times.

    Quote Originally Posted by copeg View Post
    I've been using Ecplise for years and only on one or two occasions have had issues. It has been rock solid for me considering what I've put it through. Three suggestions.
    First, go to Project -> clean. I've had problems where it seemed a class file in the project somehow gets corrupted and throws the who project out of wack. Cleaning removes all the compiled files and you can recompile the project from scratch.
    Next, if the Project -> Build Automatically is not set then changes will not take effect until you manually build the project.
    Lastly, if you have multiple mains in a project, make sure you are running the correct one.
    Now it appears to be doing it for pretty much all of my programs.

    I was fiddling around with run configurations to see if that would fix it. Now I think I may have just made it worse.

  13. #11
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,318
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: Something really weird is going on with my code at times.

    Quote Originally Posted by javapenguin View Post
    Now it appears to be doing it for pretty much all of my programs.

    I was fiddling around with run configurations to see if that would fix it. Now I think I may have just made it worse.
    Is this the point where we start going in circles? Did you try anything I suggested?

  14. The Following User Says Thank You to copeg For This Useful Post:

    javapenguin (February 3rd, 2011)

  15. #12
    Banned
    Join Date
    May 2010
    Location
    North Central Illinois
    Posts
    1,631
    My Mood
    Sleepy
    Thanks
    390
    Thanked 112 Times in 110 Posts

    Red face Re: Something really weird is going on with my code at times.

    If I hit clean, does it just reload or fix the stuff or does it delete it all? I'm going to try it anyway.

    I think I have backups somewhere anyway for some of these.

    Ok. Have hit "clean".

    Still not quite working. How do you make sure it runs the correct main?

     

    java.lang.NoClassDefFoundError: McWoo/TheList
    Caused by: java.lang.ClassNotFoundException: McWoo.TheList
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    Exception in thread "main"




    Last edited by javapenguin; February 3rd, 2011 at 11:14 PM.

  16. #13
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 294 Times in 227 Posts
    Blog Entries
    4

    Default Re: Something really weird is going on with my code at times.

    Try another IDE..
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

  17. The Following User Says Thank You to JavaPF For This Useful Post:

    javapenguin (February 4th, 2011)

  18. #14
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,318
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: Something really weird is going on with my code at times.

    If I hit clean, does it just reload or fix the stuff or does it delete it all?
    There is a reason why there is a extremely comprehensive help menu in Eclipse, and google is a powerful tool. At this stage of the game you really need to use the information that is right in front of you - you are in a much better position to solve a vague problem such as this than any of us. Problem solving is one of the most important processes of programming, and if you can't even problem solve your IDE then perhaps you should switch to another.

  19. The Following User Says Thank You to copeg For This Useful Post:

    javapenguin (February 4th, 2011)

  20. #15
    Banned
    Join Date
    May 2010
    Location
    North Central Illinois
    Posts
    1,631
    My Mood
    Sleepy
    Thanks
    390
    Thanked 112 Times in 110 Posts

    Smile Re: Something really weird is going on with my code at times.

    Quote Originally Posted by copeg View Post
    There is a reason why there is a extremely comprehensive help menu in Eclipse, and google is a powerful tool. At this stage of the game you really need to use the information that is right in front of you - you are in a much better position to solve a vague problem such as this than any of us. Problem solving is one of the most important processes of programming, and if you can't even problem solve your IDE then perhaps you should switch to another.
    I've narrowed down what probably is the matter.

    I'm thinking that there's some combination of me screwing up the run configurations and also it doesn't know what to do when I have a package or project with more than one main.


    1.) Does my JSE environment matter as I usually just pick the default one?


    2.) I have "Create separate Folder for sources and class files" selected.

    3.) I have "use default location" checked

    4.) Don't know what that stuff that comes up is...but when I compile for the first time...it usually shows a bunch of info that is not code. Have to get to my own computer to show example.

    5.) How do you fix Run Configurations to right spot? Is there a way to reset the configuration? If so, where is it and how do I use it?

    6.) How do you tell a java class that's in a package that has more than one main to use the main in THAT class and not one of the other mains?

  21. #16
    Banned
    Join Date
    May 2010
    Location
    North Central Illinois
    Posts
    1,631
    My Mood
    Sleepy
    Thanks
    390
    Thanked 112 Times in 110 Posts

    Post Re: Something really weird is going on with my code at times.

    Apparently hitting "Clean" seems to have deleted that entire project...which was quite extensive.

    That's not quite what I had in mind.



    I think all the code is there still...it's just acting like it can't run it.

    All is not lost. What do I do to ensure it runs the right main?

    Also, what should I do with Run Configurations?

    Do I alter anything there if there is more than one type or main?

  22. #17
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,318
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: Something really weird is going on with my code at times.

    Apparently hitting "Clean" seems to have deleted that entire project...which was quite extensive.
    I presume you did not again take my advice once again re check the build status, read the help, etc... Sigh...going in circles, advice falling on deaf ears, yada yada yada...BTW, clean does no such thing. It removes the built portion of your project. If your source is gone you did something completely wrong (not only with Eclipse, but most importantly not backing it up). At the risk of once more wasting my time to have my advice ignored again, go to run->run configurations and specify the main class you wish to use. You must have a built project however to run it.

  23. The Following User Says Thank You to copeg For This Useful Post:

    javapenguin (February 4th, 2011)

  24. #18
    Banned
    Join Date
    May 2010
    Location
    North Central Illinois
    Posts
    1,631
    My Mood
    Sleepy
    Thanks
    390
    Thanked 112 Times in 110 Posts

    Default Re: Something really weird is going on with my code at times.

    Quote Originally Posted by copeg View Post
    I presume you did not again take my advice once again re check the build status, read the help, etc... Sigh...going in circles, advice falling on deaf ears, yada yada yada...BTW, clean does no such thing. It removes the built portion of your project. If your source is gone you did something completely wrong (not only with Eclipse, but most importantly not backing it up). At the risk of once more wasting my time to have my advice ignored again, go to run->run configurations and specify the main class you wish to use. You must have a built project however to run it.
    Build automatically has always been checked.

    No, I didn't lose the code.

    I have tried that several times..but the compiler seems to have what I'm telling it fall on deaf ears.

  25. #19
    Member
    Join Date
    Jul 2010
    Location
    Washington, USA
    Posts
    307
    Thanks
    16
    Thanked 43 Times in 39 Posts

    Default Re: Something really weird is going on with my code at times.

    run->run configurations and specify the main class you wish to use.

  26. #20
    Banned
    Join Date
    May 2010
    Location
    North Central Illinois
    Posts
    1,631
    My Mood
    Sleepy
    Thanks
    390
    Thanked 112 Times in 110 Posts

    Unhappy Re: Something really weird is going on with my code at times.

    I've specified the right one by now! I know it. But it's still not working!

    I've tried that Run Configuration thing several times before it was even really suggested that much.



    Says it can't find main type! Do I have to rewrite the computer's circuitry, which I don't know how to, to make it work?

  27. #21
    Super Moderator helloworld922's Avatar
    Join Date
    Jun 2009
    Posts
    2,895
    Thanks
    23
    Thanked 619 Times in 561 Posts
    Blog Entries
    18

    Default Re: Something really weird is going on with my code at times.

    Could you post a screen-shot of the run-configurations you're using?

    Also, have you checked that your source code is correct (there is indeed a main method, it's declared public and static and has a string[] parameter, the package declarations are correct, and the bin folder has the matching folder structure)?

    Have you tried running the compiled classes from the command-line? Did it work? If not, what did it tell you didn't work?

    The easiest way to fix a run configuration is to simply delete it and re-create the run configuration.

    You may want to try creating a new project and importing the source files only via eclipse's import tool (copy/paste might work, but I've had issues with it in the past).

    If all else fails, try creating a new workspace with a new project and import the source files.

  28. The Following User Says Thank You to helloworld922 For This Useful Post:

    javapenguin (February 5th, 2011)

  29. #22
    Banned
    Join Date
    May 2010
    Location
    North Central Illinois
    Posts
    1,631
    My Mood
    Sleepy
    Thanks
    390
    Thanked 112 Times in 110 Posts

    Arrow Re: Something really weird is going on with my code at times.

    I've tried reconfiguring the Run Configurations. However, I don't know how to delete them.

     

    java.lang.NoClassDefFoundError: mainBibleProgram/Bible2
    Caused by: java.lang.ClassNotFoundException: mainBibleProgram.Bible2
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    Exception in thread "main"




    I'm wondering now if it's external configurations. I found that it had listed as the location and the working directory a project directory or at least a package directory, if not both, other than the one I had hoped it to be. But it didn't even work on the right one...though it could've been making that same mistake all along.

    What should I put for location?

    Ok...I tried something but think I have directory and workspace or whatever mixed up or messed up.

    Exception occurred executing command line.
    Cannot run program "C:\Users\Paul\workspace\WillThisWork\src\mainBibl eProgram\Bible2.java" (in directory "C:\Users\Paul\workspace\WillThisWork\src"): CreateProcess error=193, %1 is not a valid Win32 application
    Attached Files Attached Files
    Last edited by javapenguin; February 5th, 2011 at 02:06 PM.

  30. #23
    Super Moderator helloworld922's Avatar
    Join Date
    Jun 2009
    Posts
    2,895
    Thanks
    23
    Thanked 619 Times in 561 Posts
    Blog Entries
    18

    Default Re: Something really weird is going on with my code at times.

    To delete and re-create a run configuration:

    1. Open up the run-configurations window.
    2. Navigate to "Java Applications">your application's run configurations
    3. Click on the little red x above the run configuration's search bar
    4. Close the run configurations window
    5. Open up the class with the main method inside of it.
    6. Choose "Run as">"Java Application"

  31. #24
    Banned
    Join Date
    May 2010
    Location
    North Central Illinois
    Posts
    1,631
    My Mood
    Sleepy
    Thanks
    390
    Thanked 112 Times in 110 Posts

    Default Re: Something really weird is going on with my code at times.

    Here's an error message that might explain things.

    Can't quite figure out how to fix it at the moment.

    Cannot run program "C:\Users\Paul\workspace\WillThisWork\src\mainBibl eProgram\Bible2.java" (in directory "C:\Users\Paul\workspace\WillThisWork\src\mainBibl eProgram"): CreateProcess error=193, %1 is not a valid Win32 application

  32. #25
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 294 Times in 227 Posts
    Blog Entries
    4

    Default Re: Something really weird is going on with my code at times.

    About Java Programming: java.io.IOException: CreateProcess: ... error=193

    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

  33. The Following User Says Thank You to JavaPF For This Useful Post:

    javapenguin (February 7th, 2011)

Page 1 of 2 12 LastLast

Similar Threads

  1. ClassNotFoundException (bit weird)
    By chronoz13 in forum Exceptions
    Replies: 1
    Last Post: April 26th, 2011, 02:15 AM
  2. [SOLVED] Weird calendar.
    By javapenguin in forum What's Wrong With My Code?
    Replies: 7
    Last Post: January 3rd, 2011, 08:19 PM
  3. tick tack toe hard times!!
    By JpJ in forum What's Wrong With My Code?
    Replies: 0
    Last Post: November 12th, 2010, 08:15 AM
  4. Counting How Many Times Program Was Excecuted
    By Override in forum Loops & Control Statements
    Replies: 2
    Last Post: October 30th, 2010, 05:11 PM
  5. GuessWhat- same errors repeated 4 times?
    By iank in forum What's Wrong With My Code?
    Replies: 1
    Last Post: November 5th, 2009, 08:32 PM