• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Passing compiler arguments in Eclipse

 
Thirugnanam Saravanan
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to pass arguments to javac or java while executing java applications in Eclipse ? For example how should I execute the following in eclipse?
javac -source 1.4 AssertDemo.java

or
java -ea AssertDemoProgram
 
Alaa Nassef
Ranch Hand
Posts: 471
Hibernate Mac OS X Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, as for the second part, you can right click the java file, choose properties -> Run/Debug Settings -> [Name of run profile] -> Edit -> Arguments, then specify the arguments you want for the JVM ("-ea" in your case).

As for the first part, I'm not sure how you can do that, but for the specific example you out here (compiler compliance level), you can right click on the project and choose properties -> Java Compiler -> Enable project specific settings, and choose the compiler compliance level you want.
 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One way to pass a command-line argument:
  • Right-click the name of the file with the main method in the package explorer
  • Click "run as"
  • Click "run" or in newer versions "open run dialog"
  • Click the 2nd tab which is called arguments.
  • Fill in the arguments. You may be able to fill in -ea on that tab too.
  • click "run"
  •  
    Tim Holloway
    Saloon Keeper
    Pie
    Posts: 18098
    50
    Android Eclipse IDE Linux
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Originally posted by Campbell Ritchie:
    One way to pass a command-line argument:
  • Right-click the name of the file with the main method in the package explorer
  • Click "run as"
  • Click "run" or in newer versions "open run dialog"
  • Click the 2nd tab which is called arguments.
  • Fill in the arguments. You may be able to fill in -ea on that tab too.
  • click "run"

  • That's not Eclipse, however. It's Microsoft Windows Explorer.
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic