hi,
i install j2sdk-1_3_1_08 window-i 586 on win 2000.
i tried to compile my program on MSDOC but it doesn't work, please help:
exception in thread "main" java.lang.noclassdeffounderror:hello
hi,
would explain to me this"javac needs a .java file as argument, ie javac Hello.java
Also, make sure the path and classpath are correct".
sorry, i'm beginner on java,
what does it mean classpath,?
where i can find it??
sincerly salutations.
1. javac file.java is the required syntax. The extension is kind of a "final check" to let the compiler know that you are compiling a java file.
2. classpath can be set under control panel on windows. add a variable (if not there) called CLASSPATH and add the value to point to this directory. For instance, I use servlets.jar (comes with tomcat) for my app, so I have this classpath added:-
CLASSPATH c:\tomcat41\common\lib\servlet.jar
3. add path stmt in your environment settings:-
path c:\jdk14\bin
so if you're running from the command prompt, it can find all the needed exe's like javac.exe etc.
hi,
i checked out that java was well installed with all packages:
i have this classpath: c:\tank\binso, i tried to compile this:
c:\tank\bin\javac casting.java
i have the following error:
error: cannot read : casting.java
hi, to maxpower, please would you explain more your message:
classpath can be set under control panel on windows. add a variable (if not there) called CLASSPATH and add the value to point to this directory. For instance, I use servlets.jar (comes with tomcat) for my app, so I have this classpath added:-
here you re:
public class hello
{
public static void main (string[] args)
{
system.out.println("bonjour de Reda"
}
}
i saved it in c:\tomcat\lib
hi,
sorry to be late for the answer.
i still have the same problem, as i said i'm beginner on java.
please, would you describe to me the good version of java that you have on your computer, where did you take it from?,
and provide me some simple examples so i worked with.
thank you for replying.
hi,
i saved my class "hello" in classpath :
c:\j2sdk1.4.0_01\bin
and i have the following error when i tried to compile it.
javac : invalid flag : hello
Usage: javac <options> <source files>
where possible options include:
-g Generate all debugging info
-g:none Generate no debugging info
-g:{lines,vars,source} Generate only some debugging info
-O Optimize; may hinder debugging or enlarge class file
-nowarn Generate no warnings
-verbose Output messages about what the compiler is doing
-deprecation Output source locations where deprecated APIs are us
ed
-classpath <path> Specify where to find user class files
-sourcepath <path> Specify where to find input source files
-bootclasspath <path> Override location of bootstrap class files
-extdirs <dirs> Override location of installed extensions
-d <directory> Specify where to place generated class files
-encoding <encoding> Specify character encoding used by source files
-source <release> Provide source compatibility with specified release
-target <release> Generate class files for specific VM version
-help Print a synopsis of standard options
First off - Read The Manual, buy a book or something !
Second. Start again.
open a console /msdos window.
(Don't type the actual quotation marks for the following)
Type "set JAVA_HOME=C:/j2sdk1.4" (The directroy name will need to change to where you installed your JDK)
Type "set PATH=%PATH%;%JAVA_HOME%\bin"
Type "set CLASSPATH=%CLASSPATH%;JAVA_HOME%\jre\lib"
These variables are called "environment variables" and lets the Java compiler and interpreter know where the programmes necessary to compile and run your code live. Thet should ideally be set permanently by going to Start >> Control Panel >> System and finding the tab for "Environment Variables".
Go to a directory such as C:\tmp and create a new file called "Hello.java"
In this file add the code below :
public class Hello {
public static void main(String[] args) {
System.out.println("bonjour de Reda"
}
}
Then type "javac Hello.java"
This should have created file called "Hello.class"
Firstm thanks for replying;
sure, i have a book, but sometimes it isn't clear on a book.
i did all the instructions to the letter.
so i have this following lines:
C:\j2sdk1.4.0_01\bin>java -cp.hello
Unrecognized option: -cp.hello
Could not create the Java virtual machine.
Take a look of my test below.
Check whether or not you type <ClassName>.class as performing a java class.
Maybe it is helpful for you.
Recommend you a good Java book: Java in a Nutshell.
C:\Documents and Settings\ertjimc\My Documents\WorkShop\Experiences\Java\StandaloneScribble>javac StandaloneScribble.java
Note: StandaloneScribble.java uses or overrides a deprecated API.
Note: Recompile with -deprecation for details.
C:\Documents and Settings\ertjimc\My Documents\WorkShop\Experiences\Java\StandaloneScribble>java StandaloneScribble
C:\Documents and Settings\ertjimc\My Documents\WorkShop\Experiences\Java\StandaloneScribble>java StandaloneScribble.class
Exception in thread "main" java.lang.NoClassDefFoundError: StandaloneScribble/class
C:\Documents and Settings\ertjimc\My Documents\WorkShop\Experiences\Java\StandaloneScribble>
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.