0

For whatever reason I had to change pc's as a result of the change I now have to use Java 6 (the final update) Instead of java 7. When importing my existing project to Java 6 I get the following error in my auto generated code that was generated by Netbeans and is not modifiable

cannot find symbol symbol: variable Type location: class Window frame.setType(java.awt.Window.Type.POPUP); //Type is underlined 

The output for the error is as follows:

javac: invalid target release: 1.7 Usage: javac <options> <source files> use -help for a list of possible options C:\Users\Adminstrator\Downloads\NetBeansProjects\NetBeansProjects\Pat0.3\nbproject\build-impl.xml:915: The following error occurred while executing this line: C:\Users\Adminstrator\Downloads\NetBeansProjects\NetBeansProjects\Pat0.3\nbproject\build-impl.xml:268: Compile failed; see the compiler error output for details. 

What does this do? Is it necessary, would deleting that the component help? Which component is it, is there a quick fix?

10
  • Why don't you simply install Java 7 then? You're administrator, you should be able to. Also: Java 6 is approach its end of life. Commented Oct 7, 2013 at 17:58
  • @JoachimSauer Well I did have Java 7 then my teacher said that he would not accept Java 7.3 so I tried installing java 7.2(his copy) and the install failed and all the versions of java i had broke so after "cleaning up java 6 was the only update that worked also I have a limited bandwidth Commented Oct 7, 2013 at 18:02
  • Actually i used the other pc because of the messed up java builds Commented Oct 7, 2013 at 18:04
  • There is no "Java 7.3" or "Java 7.2" so I don't know what you're talking about. There's only "Java 7" (with updates 1 to 40 (with some holes), but those don't change the language in any way). You might be talking about Netbeans versions, are you? Commented Oct 7, 2013 at 18:05
  • open netbeans and change project plattform and put java 6. Commented Oct 7, 2013 at 18:05

2 Answers 2

2

Your build.xml specifies the target="1.7" flag to javac, which java 6 doesn't know how to interpret. Changing it to 1.6 will technically get past that error.

However, the enum Window.Type was added in Java 7, so you simply can't expect changing the target to work; your project's source uses Java 7 features. I'm sure that's not the only one.

Your options are therefore to methodically go through and remove/replace all Java 7 code (likely introducing some bugs) or just to.. install Java 7.

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

2 Comments

Thanks your suggestion to change the xml file target helped I also Deleted some unused database persistence files and it ran perfectly
Also what does Window.Type do ??
0

There is somewhere in your project a setting for the java compiler that tells it to generate classes for jre7. javac from jdk6 cannot generate classes for that version, hence the error. So you should look into the properties of your project and set up javac to generate classes for jr6. You might also have fix some of your non-generated code if for example you have used features that came with java 7 such as diamond operator or multy catch block etc.

Also the javadoc for Window.Type states it is available only since 1.7. You might want to re-generate that code or better yet just install jdk7.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.