Results 1 to 10 of 10
Thread: javac
- 07-24-2011, 07:53 PM #1
Member
- Join Date
- Jul 2011
- Posts
- 2
- Rep Power
- 0
javac
I have done everything on "Hello World!" for Microsoft Windows (The Java™ Tutorials > Getting Started > The "Hello World!" Application)
that page correctly, and as it said to. I installed the JDK correctly, and java -version
works correctly. When I try to compile it the way that page says, I can't. What am I doing wrong? I saved it in C:\java
I used cd C:\java
Everything there is the same as mine, except the computer type, I use 7 instead of XP. And javac doesn't work. Please help. Need extra info, just tell me what.
- 07-24-2011, 08:02 PM #2
Member
- Join Date
- Jul 2011
- Posts
- 43
- Rep Power
- 0
if your are getiing javac not regonised as internal or extral command use this
set the path
got to my computer->properties->advanced->environment vairable->
click new for user vairables for admistrator
enter the name as:path
address as: C:\Program Files\Java\jdk1.6.0\bin
- 07-24-2011, 09:19 PM #3
Member
- Join Date
- Jul 2011
- Posts
- 2
- Rep Power
- 0
Tried that, didn't work, moved the jdk to my java folder in plain C:, then updated variabl path. That didn't work. So I moved the javac in the bin folder to the java folder, tried that, it didn't work, and requsted jli.dll, so I moved that to. I then got this error:
C:\Java>javac HelloWorldApp.java
Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/tools/javac/M
ain
Caused by: java.lang.ClassNotFoundException: com.sun.tools.javac.Main
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
Could not find the main class: com.sun.tools.javac.Main. Program will exit.
C:\Java>
I then tried to move everything in bin folder over, and got same error. What am I doing wrong?
-
You don't want to move things around like that, and if you have done so, you'll want to move them back. This is why you must post your full error message in your first post so we don't guess wrong as to the problem and its solution. Can you post your code and the exact file name?
- 07-26-2011, 11:12 AM #5
i have the same problem with you few days ago... go to my computer->properties->advanced->environment variable look for "path" and use ";" for add the address of your "bin" folder on java folder on program files. but btw, i'm using xp don't know if it works for you...
- 07-26-2011, 12:01 PM #6
Moderator
- Join Date
- Apr 2009
- Posts
- 10,460
- Rep Power
- 16
- 08-05-2011, 01:45 AM #7
Member
- Join Date
- Aug 2011
- Posts
- 1
- Rep Power
- 0
javac configuring--easy
Please find the steps as below:
1. Create a temporary folder C:\mywork. Using Notepad or another text editor, create a small Java file HelloWorld.java with the following text:
public class HelloWorld
{
public static void main(String[] args)
{
System.out.println("Hello, World!");
}
}
Save your file as HelloWorld.java in C:\mywork. To make sure your file name is HeloWorld.java, (not HelloWorld.java.txt), first choose "Save as file type:" All files, then type in the file name HelloWorld.java.
2. Run Command Prompt (found under All Programs/Accessories in the Start menu). Type
C:\> cd \mywork
This makes C:\mywork the current directory.
C:\mywork> dir
This displays the directory contents. You should see HelloWorld.java among the files.
C:\mywork> set path=%path%;C:\Program Files\Java\jdk1.5.0_09\bin
This tells the system where to find JDK programs.
C:\mywork> javac HelloWorld.java
This runs javac.exe, the compiler. You should see nothing but the next system prompt...
C:\mywork> dir
javac has created the HelloWorld.class file. You should see HelloWorld.java and HelloWorld.class among the files.
C:\mywork> java HelloWorld
This runs the Java interpreter. You should see the program output:
Hello, World!
If the system cannot find javac, check the set path command. If javac runs but you get errors, check your Java text. If the program compiles but you get an exception, check the spelling and capitalization in the file name and the class name and the java HelloWorld command. Java is case-sensitive!
3.It is possible to make the path setting permanent but you have to be very careful because your system might crash if you make a mistake. Proceed with extreme caution!
In Windows XP, go to Control Panel, choose "System," click on the "Advanced" tab, click on the "Environment variables" button. In the lower list, "System variables," click on Path:
Click "Edit" and at the end append
;C:\Program Files\Java\jdk1.5.0_09\bin
(or the path to the appropriate folder where the latest version of JDK is installed). Do not put spaces before the appended path string.
Click OK on the path edit box and OK on the Ennvironment Variables box. The new setting will go into effect next time you run Command Prompt.
i found it on some Java forum javamazon
- 08-05-2011, 04:45 AM #8
- Join Date
- Jan 2011
- Location
- Richmond, Virginia
- Posts
- 3,069
- Blog Entries
- 3
- Rep Power
- 7
Also make sure you aren't taking the exact directory link they are posting, instead find it and copy whatever yours is. Right click anything in the folder containing javac and click properties, then copy that dir and set it as your path variable. You may also have to reinstall, you should avoid moving the java stuff around unless you know what you are doing.
- 08-05-2011, 07:51 AM #9
Member
- Join Date
- Mar 2011
- Posts
- 16
- Rep Power
- 0
use cd java
- 08-05-2011, 08:00 AM #10
Similar Threads
-
need help with javac
By pawanmutalik in forum New To JavaReplies: 10Last Post: 02-03-2011, 06:56 AM -
javac
By PhilArmstrong in forum New To JavaReplies: 31Last Post: 11-21-2009, 03:46 PM -
javac?
By sardare in forum EclipseReplies: 1Last Post: 06-14-2008, 02:06 AM -
javac DOS
By rdunne in forum New To JavaReplies: 3Last Post: 01-01-2008, 11:49 AM -
Help with javaC
By Daniel in forum New To JavaReplies: 2Last Post: 07-04-2007, 02:44 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks