Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

x3verge

[java] Small Gap

This topic is 5388 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a small question I have come across with my new exploration, Java. I am coming across not having the command "javac" when I try to compile my work. My teacher blew me off and told me to use a different version of DOS because she was busy. What do I need to do? Its probably simple, but after a weekend like mine, thoughts come hard. Close your eyes, and die in the dark...

Share this post


Link to post
Share on other sites
Advertisement
Add your java directory to your path (you can set that in autoexec.bat if you''re using DOS, though I have no idea why you would be using DOS).

Share this post


Link to post
Share on other sites
Im new? but not completeley ignorant. What would you suggest using? I am following a cisco curriculm that has a complete course of java and I am doing what it says. If there is an easier method I am all ears...

Share this post


Link to post
Share on other sites
Your system has what''s called a path. Which is just a list of directories. Whenever you type in a command, the system will look in each directory in the path to see if they contain a program by that name, if so it will run it. Otherwise it will claim the program doesn''t exist. javac''s directory is (for some reason) not added to the path when you install java.

If you''re using Windows 95/98:
1) start menu->find, type in javac. Figure out where javac is. If it doesn''t turn up, you didn''t install the JDK. It should be in a directory something like C:\j2sdk1.4.2\bin

2) open up C:\autoexec.bat in notepad. You will probably find a line like

SET PATH=C:\WINDOWS;C:\WINDOWS\COMMAND;

just add on that directory you found

SET PATH=C:\WINDOWS;C:\WINDOWS\COMMAND;C:\j2sdk1.4.2\bin;

reboot and you''re good to go.

if you''re using WindowsNT/2000/XP
1) find javac, start menu->search.

2) right click on My Computer. Select properties. Select the "Advanced" tab. Find the "Environment Variables" button (slightly different location for each OS).

3) click on it, up pops a window. In the system variables section should be Path. Edit it and change it just like above. No need to reboot but you will need to use a new dos shell if you''ve got one open.

Share this post


Link to post
Share on other sites
By DOS do you mean the cmd window? Because that window is really only a DOS emulator -- or you might call it a DOS-Shell, but its really not nearly on the level of a shell. Is that what you mean by DOS?

If so you have to set the CLASSPATH environmental variable -- and doing that depends on which version of Windows you are using.

In win2k and above you can do that from the My Computer Icon -> properties -> advanced settings tab -> environmental variables. And there you can set CLASSPATH. In anything below win2k and you have to edit the autoexec.bat manually ( more or less.) And I don''t remember how to do that ''exactly.'' Sorry.

Share this post


Link to post
Share on other sites
This has nothing to do with the classpath. Not to mention the classpath environment variable should rarely, if ever, be set (not to mention he'd have no idea what to set it to). This is a system path issue, as I outlined in great detail in the post just directly above yours.

And of course he means cmd or command, Java does not exist for DOS.


[edited by - tortoise on October 13, 2003 1:50:54 PM]

Share this post


Link to post
Share on other sites
Ok I am new to java not windows. I understood when I thought about it a sec. Thanks yo...

Close your eyes, and die in the dark...

Share this post


Link to post
Share on other sites
Setting the CLASSPATH is how I learned. And secondly I wasn''t trying to overwrite your post -- we posted nearly at the same time. And you are right i didn''t even say what to set the path to. Oh well.

By the way, what do you mean by rarely? How else does the JVM locate your .class files? Just curious -- I''m no pro-java anything.

And yeah I had a feeling he meant cmd window -- and I was trying to shed some light on the fact that it isn''t DOS...

Is everyone in a pissy mood this week or what?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
No, it''s just that setting a classpath is a really bad idea, in general. It causes all kinds things to break for beginners who don''t know why everything''s breaking.

As for how the compiler and JVM find the classes... They find them either in the bootclasspath (relative to the location of the .exe''s, by default, unless you override it), or relative to where the command was executed from (current directory, or subdirectories according to package name). Or at least since 1.2, that''s how it''s worked. Previous versions of the JVM were broken.

Unless you know why you''d want to change the classpath, you shouldn''t.

Share this post


Link to post
Share on other sites
Ok, guys, what is the prefered method?

Close your eyes, and die in the dark...


NVM. I got it. Thanks guys. Happy programming...

[edited by - x3verge on October 14, 2003 10:01:35 AM]

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!