This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Created attachment 112485 [details] Ant diagnostic when running the project Hallo there. One of the applications that I am programming uses java 1.5 and previously been developed in netbeans 6.5 and Windows XP. The enviorement where the application runs have java 1.5. I have now installed Netbeans 7.01 and java 6 in my deveolping machine that runs on WIN 7. I have installed Java 1.5 in a different folder to compile the application we have. My current settings looks like the following as i am using and and maven: Java: Put JAVA_HOME as C:\Java1_5 and %JAVA_HOME%\bin in enviroment variables Under Options->Misc->Profiler and Profiler Java Platform JDK 1.5 that points to the folder Java1_5 Under Projekt->Properties->Build->Compile says Java Platform 1.5 Maven: Under Options->Misc->Maven: Java1_5\apache-maven-2.0.9 Ant: Put ANT_HOME as C:\Java1_5\apache-ant-1.7.1 and %ANT_HOME%\bin in enviroment variables Under Options->Misc->Ant: Java1_5\apache-ant-1.7.1 *Classpath Java1_5\apache-ant-1.7.1\lib\maven-ant-tasks-2.0.9.jar I can open the project without problems, compile it and such on but when we run as batches it seems that Ant still uses Java6 that comes with Netbeans when building and the servers that later run the application says there a missmatch in version number: run-import: [echo] ALCodeServerFTP started [java] java.lang.UnsupportedClassVersionError: Bad version number in .class file When I open the Jars META-INF I see: Manifest-Version: 1.0 Ant-Version: Apache Ant 1.7.1 Created-By: 20.0-b11 (Sun Microsystems Inc.) Build-Date: September 5 2011 Main-Class: com.see.main_server.batch.rev.Main_App Version: No Label September 5 2011 Class-Path: lib/log4j-1.2.14.jar lib/sqljdbc-1.2.jar lib/fw-1.1.8.jar lib/activation-1.1.jar lib/mail-1.4.1.jar when the older ones show: Manifest-Version: 1.0 Ant-Version: Apache Ant 1.7.1 Created-By: 1.5.0_12-b04 (Sun Microsystems Inc.) Build-Date: September 2 2011 Main-Class: com.see.main_server.batch.rev.Main_App Version: No Label September 2 2011 Class-Path: lib/log4j-1.2.14.jar lib/sqljdbc-1.2.jar lib/fw-1.1.8.jar lib/activation-1.1.jar lib/mail-1.4.1.jar Running java -version or javac in command prompt displays: java version "1.5.0_12-b04" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_12-b04) Java HotSpot(TM) Client VM (build 1.5.0_22-b03, mixed mode, sharing) javac 1.5.0_12-b04 The only thing we can think of is that there is some bug with Netbeans 7.0.1 and 6.9.1 as we tried both thoose versions that Ant only uses the IDE-specified java instead of the java that the project have. We also tried this now on 6.5.1 and it worked there without problem as it the Ant script built it with java5. When running the ant script in netbeans 6.5.1 Detected Java version: 1.5 in: C:\Program Files (x86)\Java\jdk1.5.0_22\jre Detected OS: Windows 7 Can also say that it works with Netbeans 6.7.1 and 6.8 if you choose to have Java5 as Netbeans IDE java.
No instructions given to reproduce problem from scratch. Likely a user error. Check the source/target level setting on your project.
Hallo, I see there was missing a way to reproduce this error. Import a project built with java 1.5 and uses ant into netbeans >= 6.9 Set all that the project compiles/builds with java 1.5 into a war file or similiar that uses ant to be created with. Check what "Created by" java version it shows in the Manifest/META-INF. win, or maybe not (:
The project selected platform is used for compiling and running the application, so the project is compiled with a compiler from selected platform executed on selected platform. But the Ant script is executed by internal execution (it does not fork a new VM as it needs to see IDE classes and it's significantly faster). So the "Created-By" is from Ant but both compiler and runtime comes from correct platform.
As I dont have any java 1.5 environment to test this on I will have to take your word for it, then wouldn't it be still a bug that Ant writes the wrong "created by" ad should be fixed? Need to report a new bug for this or?