Michael Weber

Greenhorn
+ Follow
since May 11, 2005
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Michael Weber

Thanks a lot Fahd and Ernest!
Problem solved
18 years ago
Here is the code (just in case):

import java.awt.*;
import java.awt.event.*;
class Party{
public void buildInvite(){

Frame f = new Frame();
Label l = new Label("Party at Tim's");
Button b = new Button("You bet");
Button c = new Button("Shoot me");
Panel p = new Panel();
p.add(l);
}
}

And the error I posted earlier - I get that when I try to run the application (it has already been successfully compiled).
18 years ago
I am trying to compile a simple java application but getting this error:
"Exception in thread "main" java.lang.NoSuchMethodError: main"

I am pretty sure that the code is ok. I used the same one as in the book What could be the error
Thanks in advance
18 years ago
Command Path:
PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Java\jdk1.5.0_03\bin ;C:\Program Files\Common Files\Autodesk Shared\

Command Java -version:
java version "1.5.0_03"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_03-b07)
Java HotSpot(TM) Client VM (build 1.5.0_03-b07, mixed mode, sharing)

C:\Program Files\Java\jdk1.5.0_03\bin>javac
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
-nowarn Generate no warnings
-verbose Output messages about what the compiler is doing
-deprecation Output source locations where deprecated APIs are u
sed
-classpath <path> Specify where to find user class files
-cp <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
-endorseddirs <dirs> Override location of endorsed standards path
-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
-version Version information
-help Print a synopsis of standard options
-X Print a synopsis of nonstandard options
-J<flag> Pass <flag> directly to the runtime system


Note that the starting command prompt does not start from the Java\bin but from Docummens and Settings\... (I had to change that to get javac output).
Thanks
18 years ago

Originally posted by Michael Plourde:
I was having the same exact error today, I had to make sure javac and the party.java was in the same bin folder and that fixed it for me, besides the left out semicolon after the button c line.

I am there with you, hang in there!



It's good to know there is more of us out there
Cheers mate
18 years ago
I made a clean install of everything and still the same thing
If I try to compile a file that is placed in the bin folder I just get the same line again such as C:\Program Files\Java\jdk1.5.0_03\bin - nothing else.

The path variable I have is "%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\Java\jdk1.5.0_03\bin ;C:\Program Files\Common Files\Autodesk Shared\"

Is there a solution to this night mare
18 years ago
Now its even worse, when I try to compile a file I get an error "javac is not recognized as an internal or external command"
18 years ago

Originally posted by Jon Egan:
A couple of common problems:

1. What editor did you use to create the file with your java source code? Typically when you're just starting out, it's best to use something simple like Notepad on the PC or vi on UNIX, so the output files are actually plain text - a common mistake is to edit them in something like Word, and save them as MyFile.java, only to realize later they've been saved as "MyFile.java.doc", in Word format.

2. Case (UPPER/lower) matters, with the class name inside the source file, and with the filename. Perhaps you made a source file named "MyClass.java", but you're trying to compile with "javac myclass.java"? If you had a problem with the capitalization of the class name in the file, the compiler should give a more informative error.

3. Is the class declared as public? It should be.

Past that, I don't know... If you can, copy/paste into your post exactly the command line and the error you are getting, because I wasn't able to recognize the error you paraphrased in your most recent post. Also include relevant info, like the name of the file (maybe also paste in a DIR listing, too, so you can have several extra sets of eyes looking for the problem).

Good luck
-- Jon



Hi Jon. Thanks for your post. Here is the path variable that I have defined under environment variables "%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Java\jdk1.5.0_03\bin"

Initally I made a mistake by deleting the current path, but this is what I have now. I saved a basic java file that I wanted to use just to check if the compiler is working, and I named it Party.java
Party.java is saved in the bin directory. When I try to compile it using the javac Party.java I get the following output:
"Error: cannot read: Party.java
1 Error"

Do you recognize by any chance where am I going wrong here

Thanks a lot for your help guys
18 years ago

Originally posted by Mark Spritzler:
"Sony"-
Welcome to the JavaRanch! Please adjust your displayed name to meet the

JavaRanch Naming Policy.

You can change it

here.

Thanks! and welcome to the JavaRanch!

Mark



Hi Mark. Thanks for welcoming me . I changed the display name
18 years ago

Originally posted by Layne Lund:


Change the last entry in the path list above by appending "\bin" on the end. This should fix the problem.

Layne



Just did it. Now I am not getting the message like before, but I am getting an error on every attempt to compile applications which are written as in the book (so there can't be an application that's wrong). The error says: "Error. Cannot read: "Application's name. 1 error."

If I use just javac application (without .java extention), then I get just a default compile code not related to my application). If I use the extention, like I am supposed to, the error I already mentioned occurs.
18 years ago

Originally posted by Marcus Laubli:
Sony,

The javac.exe is the java compiler. java.exe is the runtime launcher. both of them are needed if you want to do any development with Java.



Yes, they are both there, but still I can't compile any files
What do you think it's the problem?
18 years ago

Originally posted by Stuart Gray:
Check inside the C:\Java\jdk1.5.0_03 directory. There should be a bin directory in there. Inside the bin directory should be javac.exe



I checked it before as well. Yes, it's there. What do I do with it? When I start it, nothing really happens. Thanks.
18 years ago

Originally posted by Arjun K:
If your jdk is copied in c:\jdk1.5 directory then try the one below.
c:\jdk1.5\bin\javac yourApp.java



My JDK is placed at C:\Java\jdk1.5.0_03
Even though I tried what you suggested, I get the message "The System cannot find the path specified."

The path I've put in system is "%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Java\jdk1.5.0_03"

I tried many things so far, but none has worked
Thanks for your comments guys.


18 years ago
I don't type in the percentage sign, and still the same problem occurs. Thanks for replying though.
18 years ago
Hi everyone,
I just installed jdk and jre 1.5, but I can't seem to compile anything. My cmd starts with C:\Java, and when I type %javac MyWorldApp I get the following: "%javac is not recognized as an internal or external command, operable program or batch file."

This happens no mather which application I try to compile. I would appreciate your guys' help on this one. Thanks in advance.
18 years ago