New Posts  All Forums:Forum Nav:

Beginning Java

post #1 of 17
Thread Starter 
I've started an intro to programming class which is in java, and I have problems running the programs that I write on my own computers. I know the code is right since the school lab can execute them just fine. I can compile the code of say a simple Helloworld.java file but when I try to run the said file I get this message:



java.lang.NoClassDefFoundError: C:\\Users\\Asgard\\Desktop\\Project1/java
Caused by: java.lang.ClassNotFoundException: C:\\Users\\Asgard\\Desktop\\Project1.java
at java.net.URLClassLoader$1.run(URLClassLoader.java: 202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.j ava:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:3 06)
at sun.misc.Launcher$AppClassLoader.loadClass(Launche r.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:2 47)
Could not find the main class: C:\\Users\\Asgard\\Desktop\\Project1.java. Program will exit.
Exception in thread "main"
Tool completed with exit code 1


Anybody have any ideas how to fix this?
MCP
(17 items)
 
Loki
(2 items)
 
Rinzler
(13 items)
 
CPUMotherboardGraphicsRAM
Intel 2700K 5GHz Asus P8Z68 Deluxe Gen3 EVGA GTX-1080Ti (4x8GB) Crucial Balistix 1600 MHz 
Hard DriveOptical DriveCoolingOS
A bunch of SSD's LG DVD Combo Apogee Xt Rev 1.0, 360 Rad + D5 Fedora 25 
OSMonitorMonitorMonitor
Windows 10 Acer 32" 4k Acer 32" 4k Wacom Cintiq 27 QHD 
KeyboardPowerCaseMouse
Ducky Corsair AX850 Coolermaster HAF-X Corsair 
Audio
Xonar DG 
CPUGraphics
Intel i7-4558U Intel Iris 
CPUMotherboardGraphicsRAM
i7 720QM Proprietary GTX 260M 4 gb DDR3 1066 
Hard Drive
500 GB WD Caviar Black 
  hide details  
Reply
MCP
(17 items)
 
Loki
(2 items)
 
Rinzler
(13 items)
 
CPUMotherboardGraphicsRAM
Intel 2700K 5GHz Asus P8Z68 Deluxe Gen3 EVGA GTX-1080Ti (4x8GB) Crucial Balistix 1600 MHz 
Hard DriveOptical DriveCoolingOS
A bunch of SSD's LG DVD Combo Apogee Xt Rev 1.0, 360 Rad + D5 Fedora 25 
OSMonitorMonitorMonitor
Windows 10 Acer 32" 4k Acer 32" 4k Wacom Cintiq 27 QHD 
KeyboardPowerCaseMouse
Ducky Corsair AX850 Coolermaster HAF-X Corsair 
Audio
Xonar DG 
CPUGraphics
Intel i7-4558U Intel Iris 
CPUMotherboardGraphicsRAM
i7 720QM Proprietary GTX 260M 4 gb DDR3 1066 
Hard Drive
500 GB WD Caviar Black 
  hide details  
Reply
post #2 of 17
what does the code look like in its entirety?

how are you compiling then executing the code?

Are you using two different operating systems?
MooCwzRck
(16 items)
 
 
CPUMotherboardGraphicsGraphics
Intel Core i7-2600K 4.6Ghz Maximus IV Extreme NVIDIA GeForce GTX 460 NVIDIA GeForce GTX 460 
RAMHard DriveHard DriveCooling
Corsair Vengeance 8GB (2 x 4GB) Intel 510 SSD (2 x 120GB RAID 0) Western Digital Caviar Black (2 x 1TB RAID 1) Zalman CPNS 9900 NT 
OSMonitorKeyboardPower
Windows 7 Ultimate 64 bit Samsung 40" LED TV 6300 1080p Logitech K800 Corsair AX850 
CaseMouseAudioAudio
Cooler Master HAF X nVidia Edition Logitech M505 Monster Beats Pro's Creative External 5.1 Soundcard 
  hide details  
Reply
MooCwzRck
(16 items)
 
 
CPUMotherboardGraphicsGraphics
Intel Core i7-2600K 4.6Ghz Maximus IV Extreme NVIDIA GeForce GTX 460 NVIDIA GeForce GTX 460 
RAMHard DriveHard DriveCooling
Corsair Vengeance 8GB (2 x 4GB) Intel 510 SSD (2 x 120GB RAID 0) Western Digital Caviar Black (2 x 1TB RAID 1) Zalman CPNS 9900 NT 
OSMonitorKeyboardPower
Windows 7 Ultimate 64 bit Samsung 40" LED TV 6300 1080p Logitech K800 Corsair AX850 
CaseMouseAudioAudio
Cooler Master HAF X nVidia Edition Logitech M505 Monster Beats Pro's Creative External 5.1 Soundcard 
  hide details  
Reply
post #3 of 17
Thread Starter 
Windows 7 x64 Ultimate and Pro
Using Textpad 5 software and using java and javac from the the jdk bin folder I also tried in command prompt and got the same message.




/* Programmed by Wes
* Date: 6/6/11
* File: Desktop\\hello.java
* Desc: Display a hello message
*/

public class Hello
{
public static void main(String args[])
{
System.out.println
("Hello. This is my first Java program");
} //end of main method

} //end of hello class
MCP
(17 items)
 
Loki
(2 items)
 
Rinzler
(13 items)
 
CPUMotherboardGraphicsRAM
Intel 2700K 5GHz Asus P8Z68 Deluxe Gen3 EVGA GTX-1080Ti (4x8GB) Crucial Balistix 1600 MHz 
Hard DriveOptical DriveCoolingOS
A bunch of SSD's LG DVD Combo Apogee Xt Rev 1.0, 360 Rad + D5 Fedora 25 
OSMonitorMonitorMonitor
Windows 10 Acer 32" 4k Acer 32" 4k Wacom Cintiq 27 QHD 
KeyboardPowerCaseMouse
Ducky Corsair AX850 Coolermaster HAF-X Corsair 
Audio
Xonar DG 
CPUGraphics
Intel i7-4558U Intel Iris 
CPUMotherboardGraphicsRAM
i7 720QM Proprietary GTX 260M 4 gb DDR3 1066 
Hard Drive
500 GB WD Caviar Black 
  hide details  
Reply
MCP
(17 items)
 
Loki
(2 items)
 
Rinzler
(13 items)
 
CPUMotherboardGraphicsRAM
Intel 2700K 5GHz Asus P8Z68 Deluxe Gen3 EVGA GTX-1080Ti (4x8GB) Crucial Balistix 1600 MHz 
Hard DriveOptical DriveCoolingOS
A bunch of SSD's LG DVD Combo Apogee Xt Rev 1.0, 360 Rad + D5 Fedora 25 
OSMonitorMonitorMonitor
Windows 10 Acer 32" 4k Acer 32" 4k Wacom Cintiq 27 QHD 
KeyboardPowerCaseMouse
Ducky Corsair AX850 Coolermaster HAF-X Corsair 
Audio
Xonar DG 
CPUGraphics
Intel i7-4558U Intel Iris 
CPUMotherboardGraphicsRAM
i7 720QM Proprietary GTX 260M 4 gb DDR3 1066 
Hard Drive
500 GB WD Caviar Black 
  hide details  
Reply
post #4 of 17
try capitalizing the H in the file name,

and I'm assuming you are correctly compiling and executing the program?
first:

javac Hello.java

then:

java Hello
MooCwzRck
(16 items)
 
 
CPUMotherboardGraphicsGraphics
Intel Core i7-2600K 4.6Ghz Maximus IV Extreme NVIDIA GeForce GTX 460 NVIDIA GeForce GTX 460 
RAMHard DriveHard DriveCooling
Corsair Vengeance 8GB (2 x 4GB) Intel 510 SSD (2 x 120GB RAID 0) Western Digital Caviar Black (2 x 1TB RAID 1) Zalman CPNS 9900 NT 
OSMonitorKeyboardPower
Windows 7 Ultimate 64 bit Samsung 40" LED TV 6300 1080p Logitech K800 Corsair AX850 
CaseMouseAudioAudio
Cooler Master HAF X nVidia Edition Logitech M505 Monster Beats Pro's Creative External 5.1 Soundcard 
  hide details  
Reply
MooCwzRck
(16 items)
 
 
CPUMotherboardGraphicsGraphics
Intel Core i7-2600K 4.6Ghz Maximus IV Extreme NVIDIA GeForce GTX 460 NVIDIA GeForce GTX 460 
RAMHard DriveHard DriveCooling
Corsair Vengeance 8GB (2 x 4GB) Intel 510 SSD (2 x 120GB RAID 0) Western Digital Caviar Black (2 x 1TB RAID 1) Zalman CPNS 9900 NT 
OSMonitorKeyboardPower
Windows 7 Ultimate 64 bit Samsung 40" LED TV 6300 1080p Logitech K800 Corsair AX850 
CaseMouseAudioAudio
Cooler Master HAF X nVidia Edition Logitech M505 Monster Beats Pro's Creative External 5.1 Soundcard 
  hide details  
Reply
post #5 of 17
Thread Starter 
No difference still getting the no class def found. Yes I used both of those, it has to be a configuration on both of my machines cause the dell's at school had no problem running the program.
MCP
(17 items)
 
Loki
(2 items)
 
Rinzler
(13 items)
 
CPUMotherboardGraphicsRAM
Intel 2700K 5GHz Asus P8Z68 Deluxe Gen3 EVGA GTX-1080Ti (4x8GB) Crucial Balistix 1600 MHz 
Hard DriveOptical DriveCoolingOS
A bunch of SSD's LG DVD Combo Apogee Xt Rev 1.0, 360 Rad + D5 Fedora 25 
OSMonitorMonitorMonitor
Windows 10 Acer 32" 4k Acer 32" 4k Wacom Cintiq 27 QHD 
KeyboardPowerCaseMouse
Ducky Corsair AX850 Coolermaster HAF-X Corsair 
Audio
Xonar DG 
CPUGraphics
Intel i7-4558U Intel Iris 
CPUMotherboardGraphicsRAM
i7 720QM Proprietary GTX 260M 4 gb DDR3 1066 
Hard Drive
500 GB WD Caviar Black 
  hide details  
Reply
MCP
(17 items)
 
Loki
(2 items)
 
Rinzler
(13 items)
 
CPUMotherboardGraphicsRAM
Intel 2700K 5GHz Asus P8Z68 Deluxe Gen3 EVGA GTX-1080Ti (4x8GB) Crucial Balistix 1600 MHz 
Hard DriveOptical DriveCoolingOS
A bunch of SSD's LG DVD Combo Apogee Xt Rev 1.0, 360 Rad + D5 Fedora 25 
OSMonitorMonitorMonitor
Windows 10 Acer 32" 4k Acer 32" 4k Wacom Cintiq 27 QHD 
KeyboardPowerCaseMouse
Ducky Corsair AX850 Coolermaster HAF-X Corsair 
Audio
Xonar DG 
CPUGraphics
Intel i7-4558U Intel Iris 
CPUMotherboardGraphicsRAM
i7 720QM Proprietary GTX 260M 4 gb DDR3 1066 
Hard Drive
500 GB WD Caviar Black 
  hide details  
Reply
post #6 of 17
Quote:
Originally Posted by Aesir View Post
No difference still getting the no class def found. Yes I used both of those, it has to be a configuration on both of my machines cause the dell's at school had no problem running the program.
I had no problem running it either...do you have JDK 1.6 correctly installed?

http://www.oracle.com/technetwork/ja...ads/index.html
MooCwzRck
(16 items)
 
 
CPUMotherboardGraphicsGraphics
Intel Core i7-2600K 4.6Ghz Maximus IV Extreme NVIDIA GeForce GTX 460 NVIDIA GeForce GTX 460 
RAMHard DriveHard DriveCooling
Corsair Vengeance 8GB (2 x 4GB) Intel 510 SSD (2 x 120GB RAID 0) Western Digital Caviar Black (2 x 1TB RAID 1) Zalman CPNS 9900 NT 
OSMonitorKeyboardPower
Windows 7 Ultimate 64 bit Samsung 40" LED TV 6300 1080p Logitech K800 Corsair AX850 
CaseMouseAudioAudio
Cooler Master HAF X nVidia Edition Logitech M505 Monster Beats Pro's Creative External 5.1 Soundcard 
  hide details  
Reply
MooCwzRck
(16 items)
 
 
CPUMotherboardGraphicsGraphics
Intel Core i7-2600K 4.6Ghz Maximus IV Extreme NVIDIA GeForce GTX 460 NVIDIA GeForce GTX 460 
RAMHard DriveHard DriveCooling
Corsair Vengeance 8GB (2 x 4GB) Intel 510 SSD (2 x 120GB RAID 0) Western Digital Caviar Black (2 x 1TB RAID 1) Zalman CPNS 9900 NT 
OSMonitorKeyboardPower
Windows 7 Ultimate 64 bit Samsung 40" LED TV 6300 1080p Logitech K800 Corsair AX850 
CaseMouseAudioAudio
Cooler Master HAF X nVidia Edition Logitech M505 Monster Beats Pro's Creative External 5.1 Soundcard 
  hide details  
Reply
post #7 of 17
Thread Starter 
I'm going to try installing it again, just rebooted, we'll see if it makes a difference.
MCP
(17 items)
 
Loki
(2 items)
 
Rinzler
(13 items)
 
CPUMotherboardGraphicsRAM
Intel 2700K 5GHz Asus P8Z68 Deluxe Gen3 EVGA GTX-1080Ti (4x8GB) Crucial Balistix 1600 MHz 
Hard DriveOptical DriveCoolingOS
A bunch of SSD's LG DVD Combo Apogee Xt Rev 1.0, 360 Rad + D5 Fedora 25 
OSMonitorMonitorMonitor
Windows 10 Acer 32" 4k Acer 32" 4k Wacom Cintiq 27 QHD 
KeyboardPowerCaseMouse
Ducky Corsair AX850 Coolermaster HAF-X Corsair 
Audio
Xonar DG 
CPUGraphics
Intel i7-4558U Intel Iris 
CPUMotherboardGraphicsRAM
i7 720QM Proprietary GTX 260M 4 gb DDR3 1066 
Hard Drive
500 GB WD Caviar Black 
  hide details  
Reply
MCP
(17 items)
 
Loki
(2 items)
 
Rinzler
(13 items)
 
CPUMotherboardGraphicsRAM
Intel 2700K 5GHz Asus P8Z68 Deluxe Gen3 EVGA GTX-1080Ti (4x8GB) Crucial Balistix 1600 MHz 
Hard DriveOptical DriveCoolingOS
A bunch of SSD's LG DVD Combo Apogee Xt Rev 1.0, 360 Rad + D5 Fedora 25 
OSMonitorMonitorMonitor
Windows 10 Acer 32" 4k Acer 32" 4k Wacom Cintiq 27 QHD 
KeyboardPowerCaseMouse
Ducky Corsair AX850 Coolermaster HAF-X Corsair 
Audio
Xonar DG 
CPUGraphics
Intel i7-4558U Intel Iris 
CPUMotherboardGraphicsRAM
i7 720QM Proprietary GTX 260M 4 gb DDR3 1066 
Hard Drive
500 GB WD Caviar Black 
  hide details  
Reply
post #8 of 17
Quote:
Originally Posted by Aesir View Post
I'm going to try installing it again, just rebooted, we'll see if it makes a difference.
Try this installation guide if it helps, this is how I installed it on my Win 7 x64 machine:

http://courses.ncsu.edu/csc116/common/java_install/
MooCwzRck
(16 items)
 
 
CPUMotherboardGraphicsGraphics
Intel Core i7-2600K 4.6Ghz Maximus IV Extreme NVIDIA GeForce GTX 460 NVIDIA GeForce GTX 460 
RAMHard DriveHard DriveCooling
Corsair Vengeance 8GB (2 x 4GB) Intel 510 SSD (2 x 120GB RAID 0) Western Digital Caviar Black (2 x 1TB RAID 1) Zalman CPNS 9900 NT 
OSMonitorKeyboardPower
Windows 7 Ultimate 64 bit Samsung 40" LED TV 6300 1080p Logitech K800 Corsair AX850 
CaseMouseAudioAudio
Cooler Master HAF X nVidia Edition Logitech M505 Monster Beats Pro's Creative External 5.1 Soundcard 
  hide details  
Reply
MooCwzRck
(16 items)
 
 
CPUMotherboardGraphicsGraphics
Intel Core i7-2600K 4.6Ghz Maximus IV Extreme NVIDIA GeForce GTX 460 NVIDIA GeForce GTX 460 
RAMHard DriveHard DriveCooling
Corsair Vengeance 8GB (2 x 4GB) Intel 510 SSD (2 x 120GB RAID 0) Western Digital Caviar Black (2 x 1TB RAID 1) Zalman CPNS 9900 NT 
OSMonitorKeyboardPower
Windows 7 Ultimate 64 bit Samsung 40" LED TV 6300 1080p Logitech K800 Corsair AX850 
CaseMouseAudioAudio
Cooler Master HAF X nVidia Edition Logitech M505 Monster Beats Pro's Creative External 5.1 Soundcard 
  hide details  
Reply
post #9 of 17
Thread Starter 
Still getting the same error, this is frustrating. I was thinking it might be a CLASSPATH error, but I don't know how to deal with that.

Edit: Didnt see your next post watching the video now.
MCP
(17 items)
 
Loki
(2 items)
 
Rinzler
(13 items)
 
CPUMotherboardGraphicsRAM
Intel 2700K 5GHz Asus P8Z68 Deluxe Gen3 EVGA GTX-1080Ti (4x8GB) Crucial Balistix 1600 MHz 
Hard DriveOptical DriveCoolingOS
A bunch of SSD's LG DVD Combo Apogee Xt Rev 1.0, 360 Rad + D5 Fedora 25 
OSMonitorMonitorMonitor
Windows 10 Acer 32" 4k Acer 32" 4k Wacom Cintiq 27 QHD 
KeyboardPowerCaseMouse
Ducky Corsair AX850 Coolermaster HAF-X Corsair 
Audio
Xonar DG 
CPUGraphics
Intel i7-4558U Intel Iris 
CPUMotherboardGraphicsRAM
i7 720QM Proprietary GTX 260M 4 gb DDR3 1066 
Hard Drive
500 GB WD Caviar Black 
  hide details  
Reply
MCP
(17 items)
 
Loki
(2 items)
 
Rinzler
(13 items)
 
CPUMotherboardGraphicsRAM
Intel 2700K 5GHz Asus P8Z68 Deluxe Gen3 EVGA GTX-1080Ti (4x8GB) Crucial Balistix 1600 MHz 
Hard DriveOptical DriveCoolingOS
A bunch of SSD's LG DVD Combo Apogee Xt Rev 1.0, 360 Rad + D5 Fedora 25 
OSMonitorMonitorMonitor
Windows 10 Acer 32" 4k Acer 32" 4k Wacom Cintiq 27 QHD 
KeyboardPowerCaseMouse
Ducky Corsair AX850 Coolermaster HAF-X Corsair 
Audio
Xonar DG 
CPUGraphics
Intel i7-4558U Intel Iris 
CPUMotherboardGraphicsRAM
i7 720QM Proprietary GTX 260M 4 gb DDR3 1066 
Hard Drive
500 GB WD Caviar Black 
  hide details  
Reply
post #10 of 17
Thread Starter 
Awesome thank you that video definitely helped a lot, I can now run the program from the command prompt but text pad doesn't seem to like running it, I might re install it too.
MCP
(17 items)
 
Loki
(2 items)
 
Rinzler
(13 items)
 
CPUMotherboardGraphicsRAM
Intel 2700K 5GHz Asus P8Z68 Deluxe Gen3 EVGA GTX-1080Ti (4x8GB) Crucial Balistix 1600 MHz 
Hard DriveOptical DriveCoolingOS
A bunch of SSD's LG DVD Combo Apogee Xt Rev 1.0, 360 Rad + D5 Fedora 25 
OSMonitorMonitorMonitor
Windows 10 Acer 32" 4k Acer 32" 4k Wacom Cintiq 27 QHD 
KeyboardPowerCaseMouse
Ducky Corsair AX850 Coolermaster HAF-X Corsair 
Audio
Xonar DG 
CPUGraphics
Intel i7-4558U Intel Iris 
CPUMotherboardGraphicsRAM
i7 720QM Proprietary GTX 260M 4 gb DDR3 1066 
Hard Drive
500 GB WD Caviar Black 
  hide details  
Reply
MCP
(17 items)
 
Loki
(2 items)
 
Rinzler
(13 items)
 
CPUMotherboardGraphicsRAM
Intel 2700K 5GHz Asus P8Z68 Deluxe Gen3 EVGA GTX-1080Ti (4x8GB) Crucial Balistix 1600 MHz 
Hard DriveOptical DriveCoolingOS
A bunch of SSD's LG DVD Combo Apogee Xt Rev 1.0, 360 Rad + D5 Fedora 25 
OSMonitorMonitorMonitor
Windows 10 Acer 32" 4k Acer 32" 4k Wacom Cintiq 27 QHD 
KeyboardPowerCaseMouse
Ducky Corsair AX850 Coolermaster HAF-X Corsair 
Audio
Xonar DG 
CPUGraphics
Intel i7-4558U Intel Iris 
CPUMotherboardGraphicsRAM
i7 720QM Proprietary GTX 260M 4 gb DDR3 1066 
Hard Drive
500 GB WD Caviar Black 
  hide details  
Reply
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Coding and Programming