[ 
https://issues.apache.org/jira/browse/NETBEANS-4034?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17073563#comment-17073563
 ] 

Vedran commented on NETBEANS-4034:
----------------------------------

Code:

 

{{package hr.vs.mavenproject7;}}

{{public class A {}}
 
{{ static String B = """}}
{{ test}}
{{ """;}}
 
{{ public static void main(String[] args) {}}
{{ System.out.println(B);}}
{{ }}}
{{}}}

 

These are my settings:

 
*Product Version:* Apache NetBeans IDE 11.3

*Java:* 14; OpenJDK 64-Bit Server VM 14+36-1461

 

*Runtime:* OpenJDK Runtime Environment 14+36-1461

*System:* Mac OS X version 10.15.3 running on x86_64; UTF-8; en_GB (nb)

*User directory:* /Users/vedransmid/Library/Application Support/NetBeans/11.3

*Cache directory:* /Users/vedransmid/Library/Caches/NetBeans/11.3

*pom.xml*

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
 <modelVersion>4.0.0</modelVersion>
 <groupId>hr.vs</groupId>
 <artifactId>mavenproject7</artifactId>
 <version>1.0-SNAPSHOT</version>
 <packaging>jar</packaging>
 <build>
 <plugins>
 <plugin>
 <groupId>org.apache.maven.plugins</groupId>
 <artifactId>maven-compiler-plugin</artifactId>
 <version>3.8.1</version>
 <configuration>
 <compilerArgs>
 <arg>--enable-preview</arg>
 </compilerArgs>
 </configuration>
 </plugin>
 </plugins>
 </build>
 <properties>
 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
 <maven.compiler.source>14</maven.compiler.source>
 <maven.compiler.target>14</maven.compiler.target>
 </properties>
</project>

*No nb-javac*

Source/Binary format: 14

Build/Compile: Java Platform JDK 14

Run: VM Options: --enable-preview

 

When run clean and build from NetBeans everything goes well.

When i try to run file from NetBeans i get this:

Error: LinkageError occurred while loading main class hr.vs.mavenproject7.A
 java.lang.UnsupportedClassVersionError: Preview features are not enabled for 
hr/vs/mavenproject7/A (class file version 58.65535). Try running with 
'--enable-preview'

 

>From termina, when i run:

{{java --enable-preview --source 14 src/main/java/hr/vs/mavenproject7/A.java}}

 

i get this:


{{Note: src/main/java/hr/vs/mavenproject7/A.java uses preview language 
features.}}
{{Note: Recompile with -Xlint:preview for details.}}
{{test}}

 

 

 

 

 

 

 

 

> --enable-preview + VM Options problem on MacOS
> ----------------------------------------------
>
>                 Key: NETBEANS-4034
>                 URL: https://issues.apache.org/jira/browse/NETBEANS-4034
>             Project: NetBeans
>          Issue Type: Bug
>          Components: java - Compiler, java - Editor
>    Affects Versions: 11.3
>         Environment: Product Version: Apache NetBeans IDE 11.3
> Java: 14; OpenJDK 64-Bit Server VM 14+36-1461
> Runtime: OpenJDK Runtime Environment 14+36-1461
> System: Mac OS X version 10.15.3 running on x86_64; UTF-8; en_GB (nb)
>            Reporter: Vedran
>            Priority: Blocker
>
> Whatever i do i can't enable preview features in NetBeans. I also see hint 
> 'Text block may not be supported'. I uninstalled nb-javac and i am running 
> NetBeans on JDK 14. I also cleared cache. I can see that --enable-preview 
> flag is set in pom.xml and in VM Options.
> In terminal, java --enable-preview --source 14 A.java executes as expected.
> What i also noticed in previous versions of NetBeans is that VM Options 
> configured under Run are not passed to Maven.
> What am i missing?



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
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