File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Soft Skills: The software developer's life manual this week in the Jobs Discussion forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Passing compiler arguments in Eclipse

 
Thirugnanam Saravanan
Ranch Hand
Posts: 81
  • 0
  • 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
  • 0
  • 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
Pie
Posts: 47216
52
  • 0
  • 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: 17616
    38
    Android Eclipse IDE Linux
    • 0
    • 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.
     
    It is sorta covered in the JavaRanch Style Guide.
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic