public class NewClass {
    public static void main(String[] args) {
        var test="I believe I can fly";
    }
}

I'm assuming you're doing the above since 'var' is local variable type
inference, i.e., LOCAL.

Gj


On Fri, Apr 12, 2019 at 2:22 PM John Nashorn <[email protected]> wrote:

> Thanks Geertjan. I watched your YouTube video and retried but failed
> again. Now I'm trying on Linux with OpenJDK 11 but it's the same.
>
> (1)CHECK: My `java -version` outputs:
> «
> openjdk version "11.0.2" 2019-01-15
> OpenJDK Runtime Environment 18.9 (build 11.0.2+7)
> OpenJDK 64-Bit Server VM 18.9 (build 11.0.2+7, mixed mode, sharing)
> »
>
> (2)CHECK: Freshly unzipped NetBeans 11.0 "Help->About"
> «
> Product Version: Apache NetBeans IDE 11.0 (Build
> incubator-netbeans-release-404-on-20190319)
> Java: 11.0.2; OpenJDK 64-Bit Server VM 11.0.2+7
> Runtime: OpenJDK Runtime Environment 11.0.2+7
> »
>
> (3)CHECK: Installed/updated nbjavac and oracle js parser plugins.
>
> (4)CHECK: Created a new maven web project, added a class, added a field
> like:
> «
> var test="I believe I can fly";
> »
>
> (5)CHECK: Project properties -> Sources -> Source Binary Format => 11
> (6)CHECK: Project properties -> Build -> Compile -> Java Platform => JDK
> 11 (Default)
>
> My test field still doesn't pass valid. If I type "String" instead of
> "var" everything compiles successfully. Limited to Java 1.8.
>
> When I open "View -> IDE Log" I see many occurrences of:
> «
> Even though the source level of
> /home/username/NetBeansProjects/mavenproject1/src/main/java:/home/username/NetBeansProjects/mavenproject1/src/main/webapp:/home/username/NetBeansProjects/mavenproject1/src/main/resources
> is set to: 11, java.util.zip.CRC32C cannot be found on the system module
> path:
> Changing source level to 1.8
> WARNING [null]: Last record repeated again.
> »
>
> On 2019/04/12 09:15:03, Geertjan Wielenga <[email protected]> wrote:
> > "var" declarations were introduced in JDK 10.
> >
> > https://www.youtube.com/watch?v=GB1tY_qrLrU
> >
> > Hope it helps,
> >
> > Gj
> >
> >
> > On Fri, Apr 12, 2019 at 11:00 AM John Nashorn <[email protected]>
> wrote:
> >
> > > Hi All,
> > > I'm currently using convenience binaries of NetBeans 11.0-vc4 on
> Windows
> > > 10 (64 bit system), running with OpenJDK-12 , etc.
> > >
> > > I'm changing my projects source code level from 1.8 to 12 but unable to
> > > use new language features coming with new versions of Java, such as
> local
> > > variable type inference (aka var declarations).
> > >
> > > I've observed these lines in my "IDE Log" repeating multiple times:
> > >
> > > «
> > > Even though the source level of
> > >
> C:\Users\pcUserName\Documents\NetBeansProjects\ProjectName\src\main\webapp;C:\Users\pcUserName\Documents\NetBeansProjects\ProjectName\src\main\resources
> > > is set to: 12, java.util.zip.CRC32C cannot be found on the system
> module
> > > path:
> > > Changing source level to 1.8
> > > »
> > >
> > > I tried using Java 11 but it was the same: couldn't use Java 11 as it
> was
> > > degraded to 1.8.
> > >
> > > I've searched on this mail list and on the internet but couldn't find
> > > anything solid; other than a mail thread Glenn Holmer started as I
> recall,
> > > which didn't end up with a solution.
> > > What can/should I do so that I can use Java 12?
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [email protected]
> > > For additional commands, e-mail: [email protected]
> > >
> > > For further information about the NetBeans mailing lists, visit:
> > > https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
> > >
> > >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
> For further information about the NetBeans mailing lists, visit:
> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>
>

Reply via email to