|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Greetings all,
I am running Redhat Linux 7.2 and installed both the J2SDK and J2RE 1.4.0 from SUN via .rpm I setup my PATH to accomodate my tools, javac etc but it looks like my CLASSPATH is wrong. vi Test.java public class Test { public static void main( String args[] ) { System.out.println( "Testing..." ); } } javac Test.java java Test.class Exception in thread "main" java.lang.NoClassDefFoundError; Test/class What do I have to do? I tried java -cp /home/mydir/Test.class and it spits out a list of switch options. This is what happens when I try an applet vi HelloWorld.java import java.applet.*; import java.awt.*; public class HelloWorld class extends Applet { public void paint(Graphics g) { g.drawString("Hello World!", 50, 25); } } vi Hello.html <HTML> <HEAD> <TITLE>Hello Applet</TITLE> </HEAD> <BODY> <APPLET CODE="HelloWorld.class" WIDTH=150 HEIGHT=25> </APPLET> </BODY> </HTML> javac HelloWorld.java HelloWorld.java:4: '{' expected public class HelloWorld class extends Applet { HelloWorld.java:8: '{' expected } 3 errors Thanks in advance for your help |
|
#2
|
|||
|
|||
|
Hi,
Don't put the ".class" bit in i.e. java Test OR java /home/mydir/Test Though you'll probably have other CLASSPATH type problems, but this'll get you past the current error. Mind you, if the compile worked it probably has access to the stuff it needs. Give it a go... Oscagne |
|
#3
|
|||
|
|||
|
Doh!
![]() Thanks. |
|
#4
|
|||
|
|||
|
u have included class keyword in two places...
public class HelloWorld class extends Applet -- wrong public class HelloWorld extends Applet -- right --aabha |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Java Help > Problems compiling/Running Java Apps and Applets |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|