Results 1 to 8 of 8
Thread: Can't compile and run Java code
- 02-24-2011, 06:52 AM #1
Member
- Join Date
- Feb 2011
- Posts
- 4
- Rep Power
- 0
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
- 02-24-2011, 08:07 AM #2
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:
- 02-24-2011, 06:30 PM #3
Member
- Join Date
- Feb 2011
- Posts
- 4
- Rep Power
- 0
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
- 02-24-2011, 06:58 PM #4
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:
- 02-24-2011, 07:02 PM #5
Maybe post the code you are having trouble with as well.
Sorry, I only speak machine language. Yes or a No?:confused:
- 02-25-2011, 03:37 AM #6
Member
- Join Date
- Feb 2011
- Posts
- 4
- Rep Power
- 0
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
- 02-25-2011, 03:41 AM #7
That is a bit drastic. Sounds like somehow Netbeans got borked. You might get better answers in a Netbeans forum.I'll have to reformat my hard drive
- 02-25-2011, 01:58 PM #8
Member
- Join Date
- Feb 2011
- Posts
- 4
- Rep Power
- 0
Similar Threads
-
why java does not compile to native code?
By docesam in forum New To JavaReplies: 43Last Post: 11-25-2010, 03:54 PM -
Java Code Won't Compile
By JavaStudent1990 in forum New To JavaReplies: 4Last Post: 07-29-2010, 09:34 AM -
New to JAVA and code cant compile
By Gayethiri_86 in forum New To JavaReplies: 2Last Post: 03-05-2010, 06:43 AM -
Running .java-files won't work/compile does!(Code inside)
By wyldstyle in forum New To JavaReplies: 6Last Post: 02-06-2009, 08:05 PM -
Compile/Execute code in Java app
By Doctor Cactus in forum New To JavaReplies: 5Last Post: 12-16-2008, 09:58 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks