Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Application Programming › Java throwing up weird errors... Compile fine but running doesn't happen
New Posts  All Forums:Forum Nav:

Java throwing up weird errors... Compile fine but running doesn't happen

post #1 of 19
Thread Starter 
Okay, I'll make this snappy. Haven't used my Java Editor (EditPlus) in over a month and wanted to get some practice for my exams coming up soon. Anyway anything I try and run throws up this error....

Quote:
---------- Run Java ----------
java.lang.NoClassDefFoundError: HelloWorld (wrong name: ch01_intro/HelloWorld)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader. java:632)
at java.lang.ClassLoader.defineClass(ClassLoader.java :616)
at java.security.SecureClassLoader.defineClass(Secure ClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader .java:283)
at java.net.URLClassLoader.access$000(URLClassLoader. java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java: 197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.j ava:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:3 07)
at sun.misc.Launcher$AppClassLoader.loadClass(Launche r.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:2 48)
Could not find the main class: HelloWorld. Program will exit.
Exception in thread "main"
Output completed (0 sec consumed) - Normal Termination
even when I try and run the simplest of code. ie HelloWorld. I still get this. No idea what's up.. Ideas anyone?
Dark Star
(13 items)
 
  
CPUMotherboardGraphicsRAM
Q6600 - Currently Overclocking ;) Gigabyte GA-EP45-UD3P HD 6950 OCZ Blade LC DDR2 PC29200 4GB (GOT) 
Hard DriveOSMonitorKeyboard
640GB for Storage and OCZ Vertex 2e 60GB Windows 7 Ultimate-Signature Edition 3 x 22" -BenQ G2222HDL Logitech G15 
PowerCaseMouse
Corsair TX850 HAF 932 Logitech G500 
  hide details  
Reply
Dark Star
(13 items)
 
  
CPUMotherboardGraphicsRAM
Q6600 - Currently Overclocking ;) Gigabyte GA-EP45-UD3P HD 6950 OCZ Blade LC DDR2 PC29200 4GB (GOT) 
Hard DriveOSMonitorKeyboard
640GB for Storage and OCZ Vertex 2e 60GB Windows 7 Ultimate-Signature Edition 3 x 22" -BenQ G2222HDL Logitech G15 
PowerCaseMouse
Corsair TX850 HAF 932 Logitech G500 
  hide details  
Reply
post #2 of 19
Can you post the code you're using?
Rubbish
(15 items)
 
  
CPUMotherboardGraphicsRAM
E7400 @ 4ghz 1.376v Asus P5Q3 Sapphire HD6870 Kingston 4GB DDR3 1333MHZ 
Hard DriveHard DriveOSOS
Samsung Spinpoint F3 WD Green Windows 7 64bit Lubuntu 64bit 
PowerCaseMouse
OCZ ModXStream 700W Cooler Master 690 II with side window Razer Deathadder Black Edition 
  hide details  
Reply
Rubbish
(15 items)
 
  
CPUMotherboardGraphicsRAM
E7400 @ 4ghz 1.376v Asus P5Q3 Sapphire HD6870 Kingston 4GB DDR3 1333MHZ 
Hard DriveHard DriveOSOS
Samsung Spinpoint F3 WD Green Windows 7 64bit Lubuntu 64bit 
PowerCaseMouse
OCZ ModXStream 700W Cooler Master 690 II with side window Razer Deathadder Black Edition 
  hide details  
Reply
post #3 of 19
Thread Starter 
Code:

package ch01_intro;

// this is my first java program
class HelloWorld {

    public static void main(String[] args) {
        System.out.println("Hello World!");
    }
}
Like I said... Simple stuff...
Dark Star
(13 items)
 
  
CPUMotherboardGraphicsRAM
Q6600 - Currently Overclocking ;) Gigabyte GA-EP45-UD3P HD 6950 OCZ Blade LC DDR2 PC29200 4GB (GOT) 
Hard DriveOSMonitorKeyboard
640GB for Storage and OCZ Vertex 2e 60GB Windows 7 Ultimate-Signature Edition 3 x 22" -BenQ G2222HDL Logitech G15 
PowerCaseMouse
Corsair TX850 HAF 932 Logitech G500 
  hide details  
Reply
Dark Star
(13 items)
 
  
CPUMotherboardGraphicsRAM
Q6600 - Currently Overclocking ;) Gigabyte GA-EP45-UD3P HD 6950 OCZ Blade LC DDR2 PC29200 4GB (GOT) 
Hard DriveOSMonitorKeyboard
640GB for Storage and OCZ Vertex 2e 60GB Windows 7 Ultimate-Signature Edition 3 x 22" -BenQ G2222HDL Logitech G15 
PowerCaseMouse
Corsair TX850 HAF 932 Logitech G500 
  hide details  
Reply
post #4 of 19
What is that package ch01_intro;
My System
(13 items)
 
  
CPUMotherboardGraphicsRAM
I5 760 GA-H55N GTX 470 PNY Optima 8GB 
Hard DriveMonitorPowerCase
Spinpoint F4 LG227WTG sg07 PSU Sugo sg07 
Mouse
CM Sentinel 
  hide details  
Reply
My System
(13 items)
 
  
CPUMotherboardGraphicsRAM
I5 760 GA-H55N GTX 470 PNY Optima 8GB 
Hard DriveMonitorPowerCase
Spinpoint F4 LG227WTG sg07 PSU Sugo sg07 
Mouse
CM Sentinel 
  hide details  
Reply
post #5 of 19
look like classpath problems. Consider using Netbeans? It's an awesome IDE, and I guarantee you that you won't have these kinds of problems.

It's free, opensource, and sponsored by Oracle

Netbeans.org
post #6 of 19
Thread Starter 
I used to use netbeans but it has scaling problems... At my university when 200 people are running it simultaneously it just crashes :/ and I can't stand the interface either tbh or the way you have to have project and stuff! Use editplus because of its simplicity...

Weirdly enough this class path problem is running on all my machines :S which makes no sense. No matter what I create or try and run the same problem... I'm gonna look into another IDE or maybe even return back to *gulps* netbeans...
Dark Star
(13 items)
 
  
CPUMotherboardGraphicsRAM
Q6600 - Currently Overclocking ;) Gigabyte GA-EP45-UD3P HD 6950 OCZ Blade LC DDR2 PC29200 4GB (GOT) 
Hard DriveOSMonitorKeyboard
640GB for Storage and OCZ Vertex 2e 60GB Windows 7 Ultimate-Signature Edition 3 x 22" -BenQ G2222HDL Logitech G15 
PowerCaseMouse
Corsair TX850 HAF 932 Logitech G500 
  hide details  
Reply
Dark Star
(13 items)
 
  
CPUMotherboardGraphicsRAM
Q6600 - Currently Overclocking ;) Gigabyte GA-EP45-UD3P HD 6950 OCZ Blade LC DDR2 PC29200 4GB (GOT) 
Hard DriveOSMonitorKeyboard
640GB for Storage and OCZ Vertex 2e 60GB Windows 7 Ultimate-Signature Edition 3 x 22" -BenQ G2222HDL Logitech G15 
PowerCaseMouse
Corsair TX850 HAF 932 Logitech G500 
  hide details  
Reply
post #7 of 19
I use Eclipse IDE for Java. It's really easy to use, has great support, and it's also open source. Not to mention there's plugins for almost every mainstream language (C, C++, Perl, PHP, Python, etc.). I used to use Netbeans for my Java coding, but I switched over to Eclipse when I started doing Android programming. I don't think I'll ever go back
Viking
(13 items)
 
  
CPUMotherboardGraphicsRAM
Intel Core i5 2500K @ 4.8 GHz 1.45V P8Z68-V GEN3 [2x] EVGA GeForce GTX 570 SLI [2x] Kingston HyperX 4GB 1600MHz 
Hard DriveHard DriveCoolingCooling
Crucial M4 128GB [2x] WD 320GB XSPC Single Bay Reservoir Swiftech MCP655 
CoolingCoolingOSPower
XSPC Raystorm XSPC EX240 Windows 7 Pro 64-bit Corsair HX850 
Case
Corsair Obsidian 650D 
  hide details  
Reply
Viking
(13 items)
 
  
CPUMotherboardGraphicsRAM
Intel Core i5 2500K @ 4.8 GHz 1.45V P8Z68-V GEN3 [2x] EVGA GeForce GTX 570 SLI [2x] Kingston HyperX 4GB 1600MHz 
Hard DriveHard DriveCoolingCooling
Crucial M4 128GB [2x] WD 320GB XSPC Single Bay Reservoir Swiftech MCP655 
CoolingCoolingOSPower
XSPC Raystorm XSPC EX240 Windows 7 Pro 64-bit Corsair HX850 
Case
Corsair Obsidian 650D 
  hide details  
Reply
post #8 of 19
Thread Starter 
Looking for something pretty lightweight tbh... Like EditPlus. But I'm downloading Eclipse atm... So I'll have a look see...
Dark Star
(13 items)
 
  
CPUMotherboardGraphicsRAM
Q6600 - Currently Overclocking ;) Gigabyte GA-EP45-UD3P HD 6950 OCZ Blade LC DDR2 PC29200 4GB (GOT) 
Hard DriveOSMonitorKeyboard
640GB for Storage and OCZ Vertex 2e 60GB Windows 7 Ultimate-Signature Edition 3 x 22" -BenQ G2222HDL Logitech G15 
PowerCaseMouse
Corsair TX850 HAF 932 Logitech G500 
  hide details  
Reply
Dark Star
(13 items)
 
  
CPUMotherboardGraphicsRAM
Q6600 - Currently Overclocking ;) Gigabyte GA-EP45-UD3P HD 6950 OCZ Blade LC DDR2 PC29200 4GB (GOT) 
Hard DriveOSMonitorKeyboard
640GB for Storage and OCZ Vertex 2e 60GB Windows 7 Ultimate-Signature Edition 3 x 22" -BenQ G2222HDL Logitech G15 
PowerCaseMouse
Corsair TX850 HAF 932 Logitech G500 
  hide details  
Reply
post #9 of 19
Eclipse is pretty lightweight for being as feature rich as it is. Plus it doesn't require an install, so you can just throw it on a jumpdrive and use it anywhere
Viking
(13 items)
 
  
CPUMotherboardGraphicsRAM
Intel Core i5 2500K @ 4.8 GHz 1.45V P8Z68-V GEN3 [2x] EVGA GeForce GTX 570 SLI [2x] Kingston HyperX 4GB 1600MHz 
Hard DriveHard DriveCoolingCooling
Crucial M4 128GB [2x] WD 320GB XSPC Single Bay Reservoir Swiftech MCP655 
CoolingCoolingOSPower
XSPC Raystorm XSPC EX240 Windows 7 Pro 64-bit Corsair HX850 
Case
Corsair Obsidian 650D 
  hide details  
Reply
Viking
(13 items)
 
  
CPUMotherboardGraphicsRAM
Intel Core i5 2500K @ 4.8 GHz 1.45V P8Z68-V GEN3 [2x] EVGA GeForce GTX 570 SLI [2x] Kingston HyperX 4GB 1600MHz 
Hard DriveHard DriveCoolingCooling
Crucial M4 128GB [2x] WD 320GB XSPC Single Bay Reservoir Swiftech MCP655 
CoolingCoolingOSPower
XSPC Raystorm XSPC EX240 Windows 7 Pro 64-bit Corsair HX850 
Case
Corsair Obsidian 650D 
  hide details  
Reply
post #10 of 19
Thread Starter 
I can see how it'd be useful. Compiling things on the fly etc... Compiling the **** out of mt though...
Dark Star
(13 items)
 
  
CPUMotherboardGraphicsRAM
Q6600 - Currently Overclocking ;) Gigabyte GA-EP45-UD3P HD 6950 OCZ Blade LC DDR2 PC29200 4GB (GOT) 
Hard DriveOSMonitorKeyboard
640GB for Storage and OCZ Vertex 2e 60GB Windows 7 Ultimate-Signature Edition 3 x 22" -BenQ G2222HDL Logitech G15 
PowerCaseMouse
Corsair TX850 HAF 932 Logitech G500 
  hide details  
Reply
Dark Star
(13 items)
 
  
CPUMotherboardGraphicsRAM
Q6600 - Currently Overclocking ;) Gigabyte GA-EP45-UD3P HD 6950 OCZ Blade LC DDR2 PC29200 4GB (GOT) 
Hard DriveOSMonitorKeyboard
640GB for Storage and OCZ Vertex 2e 60GB Windows 7 Ultimate-Signature Edition 3 x 22" -BenQ G2222HDL Logitech G15 
PowerCaseMouse
Corsair TX850 HAF 932 Logitech G500 
  hide details  
Reply
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Application Programming
Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Application Programming › Java throwing up weird errors... Compile fine but running doesn't happen