Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot find symbol symbol: variable FlatLightLaf location: class xxx #13

Closed
t-m-z opened this issue Oct 18, 2019 · 21 comments
Closed

cannot find symbol symbol: variable FlatLightLaf location: class xxx #13

t-m-z opened this issue Oct 18, 2019 · 21 comments
Milestone

Comments

@t-m-z
Copy link

t-m-z commented Oct 18, 2019

Whenn adding the line "FlatLightLaf.install();" to my java-classes, I receiv the error
"cannot find symbol
symbol: variable FlatLightLaf
location: class CarolaHartmannMilesVerlag"
although I addes the jar-file to my classpath.
I am using Netbeans 11.00.
What do I missing?
Kind regards
Thomas

@DevCharly
Copy link
Collaborator

Is this a compiler error?

Then this should help:

import com.formdev.flatlaf.FlatLightLaf;

@t-m-z
Copy link
Author

t-m-z commented Oct 18, 2019 via email

@DevCharly
Copy link
Collaborator

Do you use Java 9 modules? Then you probably have to add following to your module-info.java:

requires com.formdev.flatlaf;

@t-m-z
Copy link
Author

t-m-z commented Oct 18, 2019 via email

@DevCharly
Copy link
Collaborator

Is the problem still there?

Did you try to rebuild project?
Or refresh Maven/Gradle?

@t-m-z
Copy link
Author

t-m-z commented Oct 22, 2019 via email

@DevCharly
Copy link
Collaborator

This seems to be a bug in NetBeans.

@AlexFalappa describes the same issue here: http://mail-archives.apache.org/mod_mbox/netbeans-dev/201911.mbox/%3cCADBn96U94y=fBWnsny_R6tAD-m94YgiawcXQz66Z7SbD8pNfFw@mail.gmail.com%3e

It occurs because:

  1. flatlaf.jar contains .properties files with same basename as .class files (e.g. FlatLightLaf.properties and FlatLightLaf.class)
  2. and flatlaf.jar contains META-INF/versions/9/module-info.class
  3. and Multi-Release=true is true in flatlaf.jar's MANIFEST.MF
  4. and NetBeans project uses JDK 9 or later source/binary format

@AlexFalappa the difference to log4j-api-2.12.1.jar are the .properties files in FlatLaf.

When I remove FlatLightLaf.properties from flatlaf.jar, using class FlatLightLaf in NetBeans editor works. But I still can not use other classes that have corresponding .properties files (e.g. FlatDarkLaf). BTW the extension .properties is irrelevant. The problem occurs also with other extensions.

It also works when I remove Multi-Release=true from MANIFEST.MF and move module-info.class to the root of the JAR. In this case the .properties files do not confuse NetBeans.

Very strange...

@AlexFalappa
Copy link

@DevCharly thank you for the further investigation.

Would you mind answering to that thread in NetBeans dev mailinglist to help the developers troubleshoot the issue?

DevCharly added a commit that referenced this issue Nov 28, 2019
…ry format is set to JDK 9 (or later) in NetBeans project (issue #13)

flatlaf.jar is no longer a multi-release jar
@mparusk
Copy link

mparusk commented Feb 20, 2020

Hi, I have the same issue - is there something I could do to use FlatLaf?

@DevCharly
Copy link
Collaborator

@mparusk Hi Maria, are you using a recent FlatLaf version? Because this issue is actually fixed since FlatLaf 0.20.

Did you add flatlaf.jar to the project modulepath (in Projects dialog)?
And flatlaf.jar is not shown in the Projects view under the Libraries node?
Then you have to create a module-info.java in your application and add FlatLaf as required module.
Use "New File > Java > Java Module Info" to create a module-info.java.
Then add requires com.formdev.flatlaf; to module-info.java. E.g.

module MyApp {
    requires com.formdev.flatlaf;
}

@DevCharly
Copy link
Collaborator

closing because already fixed since FlatLaf 0.20

@r-go
Copy link

r-go commented Apr 30, 2020

Just hit it myself too :
NetBean 11.3
flatlaf-0.33.jar
macOS High Sierra
Java 13

My project is Maven project and it does have flatlaf-0.33.jar dependency included.
As you have explained, the properties files are masking .class files with the same name
I did include module info with the requires com.formdev.flatlaf - but no difference
Note: I see that the .properties files are still mixed up together with the .class files in the same jarr/package folder (i.e. they are not in resources folder as in the source code tree)
Regards

@DevCharly
Copy link
Collaborator

@r-go could you please test whether it works with FlatLaf 0.32?

@DevCharly DevCharly reopened this Apr 30, 2020
@r-go
Copy link

r-go commented Apr 30, 2020

Just did it and it works ! (and now all classes are visible to the code completion wizard too) . Thanks for the quick reply ! (and, btw - this is by far the best L&F ever released for Swing)

@neilcsmith-net
Copy link

@DevCharly just to confirm same issue with NetBeans 12.0-beta3 and Maven project (Ubuntu, Java 11). Downgrading to 0.32 fixes it. Do you know what the change that triggered it was? Thanks!

@DevCharly
Copy link
Collaborator

@neilcsmith-net the reason is probably that flatlaf-0.33.jar is now again a multi-release JAR (MRJ). This was necessary to support Java 9+ multi-resolution images.

When this issue initially came up, flatlaf.jar was also a MRJ for META-INF/versions/9/module-info.class.
In 0.20 I moved META-INF/versions/9/module-info.class to module-info.class and removed MRJ to fix this issue.

@neilcsmith-net
Copy link

@DevCharly Thanks Karl. Just noticed that when diffing the two JARs. So same issue as before? One for the NetBeans side of things then I guess. Maybe that module-info.class could go back under META-INF as MRJ now anyway?

@neilcsmith-net
Copy link

@DevCharly fyi, the problem in NetBeans seems to be at https://github.com/apache/netbeans/blob/master/java/java.source.base/src/org/netbeans/modules/java/source/parsing/CachingFileManager.java#L272 This is using the fully qualified name without extension as a map key when parsing multi-release JARs. Just experimenting with a quick fix.

@DevCharly
Copy link
Collaborator

Just released version 0.34 that includes a workaround for this issue (reorder files in JAR).
So FlatLaf 0.34 can be used in NetBeans 11.3 (and older) without errors.

@codelocksdev
Copy link

I'm having the same compiler error issue.
This line UIManager.setLookAndFeel(new FlatLightLaf()); as well as FlatLightLaf.install() both produce the error

java: cannot find symbol
symbol: class FlatLightLaf

Including the statement import com.formdev.flatlaf.FlatLightLaf; produces the error
java package com.formdev.flatlaf does not exist

I'm running the IntelliJ IDE, Java version 8, using gradle build tools. I have this line in my gradle build dependencies
runtime group: 'com.formdev', name: 'flatlaf', version: '0.35'

Every time I refresh gradle, it shows the package in my list of runtime and test runtime dependencies. I have also tried versions 0.32-0.35 and all produce the same error when compiling.

@DevCharly
Copy link
Collaborator

@sstephans runtime in gradle build dependencies adds FlatLaf only for running the application, but not for compiling.

Use implementation instead of runtime.

Issue #168 might be also provide useful information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants