0

How do I compile a java program in a different version if I have 1.6 and I want it compiled in 1.5? Would it be like...

javac -target1.5 tileGen

But when I do that I get:

error: Class names, 'tileGen', are only accepted if annotation processing is exp licitly requested 1 error

1
  • 1
    Also, be careful of the difference between the "target" and "source" command line options. "target" specifies the version for the output of the compiler; i.e., the class files. "source" specifies the version for the source code; i.e., the *.java files. I know your error in the above statement is that you left off the ".java" extension, but I think this clarification on the source and target arguments is worth having associated with this question. Commented Feb 24, 2012 at 1:32

2 Answers 2

4

The problem is that javac takes the name of a source file (ending in `.java) not the name of a class.

Try

javac -target 1.5 tileGen.java

instead.

Sign up to request clarification or add additional context in comments.

3 Comments

Oh WHOOPS! Rookie mistake. Haha!
Thanks you and digitalsanctum
No problem. It's one of the least helpful error messages I've come across!
1

Try adding .java to your class name

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.