Results 1 to 8 of 8
  1. #1
    quicksun is offline Member
    Join Date
    Feb 2011
    Posts
    4
    Rep Power
    0

    Angry Can't compile and run Java code

    Hi,
    I am new to Java and I am using NetBeans IDE 6.9.1. In the past few days I have coded a number of simple files and ran them and they worked fine. But recently I must have done something that is causing a compiling error to all the files I have written in the past. Now I can't run any code that has run in the past. I am getting a whole series of errors that start with....Could not load class ... followed by a whole series of errors of the same type but referring to different files. I don't know what I did to cause this problem. Thinking I must have thrown some NetBeans switch someplace, I tried uninstalling NetBeans and reinstalling it again to get a fresh install and hopefully reset the software to it's original state, but that didn't help. As it is right now, I can't seem to run any Jave code in NetBeans. Any suggestions?? I am stuck!!
    Thanks,
    quicksun

  2. #2
    BiteMuncher's Avatar
    BiteMuncher is offline Member
    Join Date
    Feb 2011
    Location
    South Africa
    Posts
    51
    Rep Power
    0

    Default

    Are you sure the java source code files are in the correct folder. By default they are under 'Your_Project_Name/src'. Are you sure you haven't messed around with JDK?
    Sorry, I only speak machine language. Yes or a No?:confused:

  3. #3
    quicksun is offline Member
    Join Date
    Feb 2011
    Posts
    4
    Rep Power
    0

    Default Can't compile and run Java code

    Thanks BitMuncher for getting back to me. Yes the source codes are in the right place, but I don't know what you mean when you refer to the "JDK". I copied one error message which reads: Could not load class (org.apache.tools.ant.taskdefs.optional.ejb.WLStop ) for type wlstop. I hope this helps. It seems the vast majority of the errors I am getting refers to the Apache.Tools.Ant files. The simple code I am trying to run is visible in the NetBean window and there are no obvious errors in the code. This is true for a number of practice files I am coping out of a book. Sorry, but I am just starting to study Java. When I uninstall NetBeans, why doesn't this wipe out the entire application so when I reinstall it, it is a new program with no memory of what the setup was before I uninstalled it?
    quicksun

  4. #4
    BiteMuncher's Avatar
    BiteMuncher is offline Member
    Join Date
    Feb 2011
    Location
    South Africa
    Posts
    51
    Rep Power
    0

    Default

    Not sure about the error. Maybe someone else can help with that. Netbeans 9.6.1 cannot function without the correct java documents. You need jdk 1.6.0. Check under your java folders. You might want to download jdk1.6.0 and replace your current one. Netbeans needs to know where this folder is located. I'm also relatively new to Netbeans so I am not sure to manually set the location. Normally on installation Netbeans automatically detects the location of your jdk.
    Sorry, I only speak machine language. Yes or a No?:confused:

  5. #5
    BiteMuncher's Avatar
    BiteMuncher is offline Member
    Join Date
    Feb 2011
    Location
    South Africa
    Posts
    51
    Rep Power
    0

    Default

    Maybe post the code you are having trouble with as well.
    Sorry, I only speak machine language. Yes or a No?:confused:

  6. #6
    quicksun is offline Member
    Join Date
    Feb 2011
    Posts
    4
    Rep Power
    0

    Default Can't compile and run Java code

    Hi BitMuncher,

    I have the latest NetBean 6.9.1 software installed and I have removed it and installed it several times using the default setting suggested by the software. You suggested that I include the code that is giving me a problem. Here it is:

    class Root {
    public static void main (String[] args) {
    int number=625;
    System.out.println("The square root of "
    + number
    + " is "
    + Math.sqrt (number)
    );
    }
    }

    As you can see it is a very simple code and it has no errors. I have run this code before and it worked fine. I attempted to solve this problem by uninstalling both software packages, jdk6, and netbeans and reinstalling them to no avail. If this problem can't be solved, I think I'll have to reformat my hard drive and start over, but that will be a big job.
    Thanks,
    quicksun

  7. #7
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,798
    Rep Power
    7

    Default

    I'll have to reformat my hard drive
    That is a bit drastic. Sounds like somehow Netbeans got borked. You might get better answers in a Netbeans forum.

  8. #8
    quicksun is offline Member
    Join Date
    Feb 2011
    Posts
    4
    Rep Power
    0

Similar Threads

  1. why java does not compile to native code?
    By docesam in forum New To Java
    Replies: 43
    Last Post: 11-25-2010, 03:54 PM
  2. Java Code Won't Compile
    By JavaStudent1990 in forum New To Java
    Replies: 4
    Last Post: 07-29-2010, 09:34 AM
  3. New to JAVA and code cant compile
    By Gayethiri_86 in forum New To Java
    Replies: 2
    Last Post: 03-05-2010, 06:43 AM
  4. Replies: 6
    Last Post: 02-06-2009, 08:05 PM
  5. Compile/Execute code in Java app
    By Doctor Cactus in forum New To Java
    Replies: 5
    Last Post: 12-16-2008, 09:58 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •