• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Amarjeet Anand
Greenhorn
Posts: 16
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 825
5
Java Python Ruby
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:
 
Campbell Ritchie
Sheriff
Pie
Posts: 47229
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And welcome to the Ranch
 
Amarjeet Anand
Greenhorn
Posts: 16
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks a lot Campbell Ritchie...
 
Wesleigh Pieters
Ranch Hand
Posts: 81
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 47229
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 972
5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 972
5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 81
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok apologies then...
 
Campbell Ritchie
Sheriff
Pie
Posts: 47229
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I never knew that, IJS. Thank you
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic