Results 1 to 4 of 4
I am trying to compile java files manually using javac from a terminal. I have read many posts on how to add java into the class path/path/root, etc. But I ...
- 02-24-2010 #1Just Joined!
- Join Date
- Feb 2010
- Posts
- 2
What the heck is in my root path?
I am trying to compile java files manually using javac from a terminal. I have read many posts on how to add java into the class path/path/root, etc. But I have only been using linux for about 3 days now. I have Ubuntu distribution. I installed the latest SDK included with Netbeans. I can't figure out Netbeans at the moment so I want to just write simple applets, compile them from a terminal, and put them on my websites. I tried adding java to my path already, so I would also like to know how to find out what is currently in it.
I really do not understand the file structure in Linux so far. It seems like you don't have drive letters in this operating system? I am quite lost on running commands from the terminal so any help would be appreciated. Seems like I used to be able to type "javac JavaFileName.java" and a class file would be generated. I think the only way to be able to do that is to add java into the System Root Path.
Carter
- 02-24-2010 #2Linux Guru
- Join Date
- Nov 2007
- Posts
- 1,695
When you open a command prompt in Windows, you have a path variable. And just the same, Linux has a path variable.
For any system variables:
To see all variables:Code:echo $PATH
Google: linux filesystemCode:env
- 02-25-2010 #3Just Joined!
- Join Date
- Feb 2010
- Posts
- 2
Hey thanks a lot. That is really helpful. Now I know I don't have java in my system path... So... Can anyone tell me how to get it so that I can compile java files within the terminal without typing out full path everytime?
- 02-25-2010 #4
You have to find where the java compiler was installed. The whereis command may be useful here. Once you locate javac, you'll want to put it into your path. For instance, my javac is located in /opt/jdk1.6.0_11/bin/javac. To get that into my PATH, I would do:
Code:export PATH=$PATH:/opt/jdk1.6.0_11/bin


Reply With Quote