GeeCON Prague 2014*
The moose likes Java in General and the fly likes compile simple test.java program using % javac test.java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Java in General
Bookmark "compile simple test.java program using % javac test.java" Watch "compile simple test.java program using % javac test.java" New topic
Author

compile simple test.java program using % javac test.java

Amarjeet Anand
Greenhorn

Joined: Nov 09, 2012
Posts: 9
hai.
i was going through HEAD FIRST JAVA>> chapter 1. I got confused on the issue to compile the test.java

till now, i was using javac test.java then java testClassName.

but in this book i have viewed use of % java test

but it doesnot work and error as % is not recognized as internal or external command.
Kemal Sokolovic
Bartender

Joined: Jun 19, 2010
Posts: 825
    
    5

Didn't read that book, but '%' sign must have been used to denote command line prompt and it's not part of the javac command. Like if you would read text on how to compile Java source using Linux distribution, most of them would put '$' sign before command to denote the same thing:


The quieter you are, the more you are able to hear.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39044
    
  23
And welcome to the Ranch
Amarjeet Anand
Greenhorn

Joined: Nov 09, 2012
Posts: 9
thanks a lot Campbell Ritchie...
Wesleigh Pieters
Ranch Hand

Joined: Sep 04, 2012
Posts: 81
in the command prompt pictures throughout that book you will always see %, it is just meaning the directory they are working in, so like on your side it will be like:

B:\Desktop>javac Test.java

etc
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39044
    
  23
Wesleigh Pieters wrote: . . . %, it is just meaning the directory they are working in, . . .
No, the % or $ or whatever is part of the prompt and (I think) represents the user. It may be accompanied by bracket symbols eg ] or >. I have only seen % on Windows, but on *nix you get $ for ordinary users and # for superusers.
The symbol for current directory is . and you will occasionally see .. which means parent directory of current directory.
Ivan Jozsef Balazs
Rancher

Joined: May 22, 2012
Posts: 867
    
    5
Campbell Ritchie wrote:
on *nix you get $ for ordinary users and # for superusers.


It actually depends on the shell you are using and on its settings.
The default prompt of the sh-derived shells (sh, ksh, bash) is "$ " for normal users and "#" for the super-user, but it can be overridden and it is % for csh (the C shell).

http://onlamp.com/pub/a/bsd/2000/09/20/FreeBSD_Basics.html
Ivan Jozsef Balazs
Rancher

Joined: May 22, 2012
Posts: 867
    
    5

oracle@izsak:~> echo $PS1
\[\e[1;33m\]\u\[\e[0m\]@\[\e[1;32m\]izsak\[\e[0m\]:\[\e[1;36m\]\w\[\e[0m\]>
oracle@izsak:~> PS1="% "
%
% echo $PS1
%
% pwd
/home/oracle
% ps -p $$
PID TTY TIME CMD
2912 pts/2 00:00:00 bash
%

Wesleigh Pieters
Ranch Hand

Joined: Sep 04, 2012
Posts: 81
ok apologies then...
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39044
    
  23
I never knew that, IJS. Thank you
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: compile simple test.java program using % javac test.java