• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Compile with flags in Java

 
Greenhorn
Posts: 5
Eclipse IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I'm learning Java with the book HeadFirstJava, but I don't completely understand how you can compile with flags.
E.g.:

%cd MyProject/source
%javac -d ../classes com/headfirstjava/PackageExercise.java

Where do you enter this? I believe it's not in the actual code. They give a lot of flags in the book, but they don't tell you how to use them.

Hope someone can help. Thanks.
 
lowercase baba
Posts: 13089
67
Chrome Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
it depends on what operating system you are using. Many of us old-timers on windows call it a DOS prompt. Go to start->run. type "cmd" in the pop up, and you'll get a black box with something like

C:\>

it is there that you enter the commands. If you are on a Mac, I can't help you. If you are on Unix/Linux, you should already know what they are talking about.
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you're using Windows, you'll type in those commands in a command prompt window. If you don't know what a command prompt window is and how to use it, then you can find tutorials for it on the web.

Note: The "%" in those commands should not be typed in, that's not part of the commands.

On Mac OS X or Linux, you'd use a terminal window for the same commands. Some commands might have slightly different syntax on Mac OS X or Linux compared to Windows.
 
Ranch Hand
Posts: 75
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
These commands are executed in the background when you compile your code in your IDE like Netbeans/Eclipse/IntelliJ
You can also compile your code manually without the need of an IDE. That is what is described in the book.
 
fred rosenberger
lowercase baba
Posts: 13089
67
Chrome Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you are just starting out, most folks around here would recommended not using and IDE like Netbeans/Eclipse/IntelliJ. There is enough to learn just with Java that adding in a behemoth like those make it that much harder - and often you end up fighting with the tool rather than the language.

Get a simple text editor (I use ConText, but search around and you will find plenty of recommendations for others) and compile your code by hand on the command line.
 
Robin Trietsch
Greenhorn
Posts: 5
Eclipse IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your replies. I do understand now how to use these commands.
reply
    Bookmark Topic Watch Topic
  • New Topic