File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes IDEs, Version Control and other tools and the fly likes Passing compiler arguments in Eclipse Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "Passing compiler arguments in Eclipse" Watch "Passing compiler arguments in Eclipse" New topic
Author

Passing compiler arguments in Eclipse

Thirugnanam Saravanan
Ranch Hand

Joined: Dec 13, 2007
Posts: 81
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


Saravanan
SCJP 5.0(98%), SCWCD 5.0 (100%), OCA
Alaa Nassef
Ranch Hand

Joined: Jan 28, 2008
Posts: 467
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.


Visit my blog: http://jnassef.blogspot.com/
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 40052
    
  28
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

    Joined: Jun 25, 2001
    Posts: 16305
        
      21

    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.


    Customer surveys are for companies who didn't pay proper attention to begin with.
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: Passing compiler arguments in Eclipse