Skip to Main Content

Java APIs

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Compiling with another extension than .java : ex : *.jav files

843810Nov 20 2008 — edited Feb 18 2009
Hi,

The extension .java is the one by default recognized by Sun's Compiler and many others. But is it possible to force compiling files using another extension ?

With Sun's JDK 1.4.2_07, if we try
> javac TestJav.jav
We got :
javac: invalid flag: TestJav.jav
Usage: javac <options> <source files>
where possible options include:
  -g                        Generate all debugging info
  ....
Same result if calling tools.jar/com.sun.tools.javac.Main.compile from a java source

Idem with the eclipse internal compiler :
# from a command line
>java -jar org.eclipse.jdt.core_3.2.0.v_671.jar TestJava.java
=> ok, .class created, but with :
>java -jar org.eclipse.jdt.core_3.2.0.v_671.jar TestJav.jav
directory does not exist: TestJav.jav
# programmatically from a Java file :
org.eclipse.jdt.internal.compiler.batch.Main.main(
   new String[] {"TestJav.jav"});
// or :
org.eclipse.jdt.internal.compiler.batch.Main.compile("TestJav.jav");
=> exception apparently during Main.configure("TestJav.jav") :
org.eclipse.jdt.core.compiler.InvalidInputException: directory 
does not exist: TestJav.jav
Is there a way to solve this ? Using javax.tools.JavaCompiler from JSDK1.6, but using a previous compiler like JDK1.4.2 ?

Thanks for any help !


Yann
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 18 2009
Added on Nov 20 2008
20 comments
581 views