Hmmm. The latter two are completely new use cases that you've mentioned now for the first time. :-)
Does the use case that we were talking about at the start of this thread, I guess, the first of the three, now work in the way that you expected? And since you now have 10-vc2 set up, can you fill in the survey, please, after some hours or days of usage of it? Go here for details: https://www.youtube.com/watch?v=G7_OPJ6grvM We need you to fill in that survey, I'm going to be answering more and more e-mails with this simple request -- watch the above YouTube clip and then fill in the survey. Thanks, Gj On Thu, Nov 1, 2018 at 12:15 AM Emma Atkinson <emma.atkins...@gmail.com> wrote: > Hi Geertjan > > Thank you for your email. I tried it out in a few ways. > > Test 1 > I build my test app which looks almost identical to yours. I set project > properties to use JDK-11 for both source and build > I found the application built and ran within the Netbeans environment with > Netbeans 10vc2 using the *--jdkhome* set to running on JDK-11. > > Test 2 > I also tried running the jar file in the dist folder from the command > line. > *prompt> <path-to>/jdk-11/bin/java -jar dist/JavaApplicationXXII.jar* > > That gave an error message > > > > > > > > *Exception in thread "main" java.lang.NoClassDefFoundError: > org/apache/logging/log4j/LogManager at > javaapplicationXXII.JavaApplicationXXII.<clinit>(JavaApplicationXXII.java:17)Caused > by: java.lang.ClassNotFoundException: > org.apache.logging.log4j.LogManager at > java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582) > at > java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) > at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) > ... 1 more* > > > Test 3 > I also tried to build the application with jlink packaging. > This may not be an error: I do not know if one is permitted to use an > automatic module in a jlink packaged build. > > During the clean & build, the following error line appeared at the end of > the clean & build process > > ...* <*snip> ... > > *Error: automatic module cannot be used with jlink: > org.apache.logging.log4j.core from > file:///<path-to>/Log4j2/apache-log4j-2.11.1-bin/log4j-core-2.11.1.jarResult: > 1* > > > > *-post-deploy:deploy:jar:BUILD SUCCESSFUL (total time: 1 second)* > > I hope there is enough information to be useful. Please ask if you would > like me to provide more. > > Regards > > Emma > > > On Wed, 31 Oct 2018 at 09:05, Geertjan Wielenga < > geertjan.wiele...@googlemail.com> wrote: > >> For me, it works, I can use the module-path, together with this in >> module-info: >> >> module org.mycompany { >> requires org.apache.logging.log4j; >> } >> >> And this in the Java source file: >> >> import org.apache.logging.log4j.LogManager; >> import org.apache.logging.log4j.Logger; >> public class MyApp { >> public static final Logger LOGGER = LogManager.getLogger(); >> public static void main(String[] args) { >> LOGGER.error("\n *** Log4j2 error message\n"); >> } >> } >> >> With the JAR on the module-path. >> >> Thanks, >> >> Gj >> >> >> On Wed, Oct 31, 2018 at 9:51 AM Geertjan Wielenga < >> geertjan.wiele...@googlemail.com> wrote: >> >>> Hi Emma, >>> >>> Please confirm that your scenario works now in 10vc2: >>> >>> https://cwiki.apache.org/confluence/display/NETBEANS/10vc2 >>> >>> Gj >>> >>> On Thu, Oct 4, 2018 at 11:56 AM Emma Atkinson <emma.atkins...@gmail.com> >>> wrote: >>> >>>> Hey guys, >>>> What a lovely surprise! I was just about to begin working out the >>>> command line options. >>>> >>>> I'll take a look at the pull request to see if I can learn something. >>>> >>>> Thank you (Denk u wel) >>>> Emma >>>> >>>> On 08:11, Thu, 4 Oct 2018 Geertjan Wielenga, >>>> <geertjan.wiele...@googlemail.com.invalid> wrote: >>>> >>>>> https://github.com/apache/incubator-netbeans/pull/941 >>>>> >>>>> We've identified the problem and done work on fixing it. >>>>> >>>>> Gj >>>>> >>>>> On Wed, Oct 3, 2018 at 1:55 PM Emma Atkinson <emma.atkins...@gmail.com> >>>>> wrote: >>>>> >>>>>> I will try without using Netbeans but I do not have time to work on >>>>>> this until tomorrow. >>>>>> Thank you for devoting your time to helping me solve this. >>>>>> >>>>>> Emma >>>>>> >>>>>> >>>>>> On Wed, 3 Oct 2018 at 12:29, Geertjan Wielenga < >>>>>> geertjan.wiele...@googlemail.com> wrote: >>>>>> >>>>>>> Well, I'd suggest to first get it to work without any tooling at >>>>>>> all. I.e., forget NetBeans for the moment and use the command line to >>>>>>> set >>>>>>> up a simple Java 9 multi-release app that makes use of Log4J. Possibly >>>>>>> the >>>>>>> problem is with Log4J and that's what you can find out by creating such >>>>>>> an >>>>>>> application and for help you could join the Log4J mailing list. I.e., if >>>>>>> something doesn't work outside NetBeans it won't work within NetBeans >>>>>>> either. >>>>>>> >>>>>>> Gj >>>>>>> >>>>>>> >>>>>>> On Wed, Oct 3, 2018 at 1:13 PM Emma Atkinson < >>>>>>> emma.atkins...@gmail.com> wrote: >>>>>>> >>>>>>>> Screenshot.png shows how I have set up Netbeans. I think you can >>>>>>>> see everything. >>>>>>>> >>>>>>>> I normally use the *import* org.apache.logging.log4j.Logger and >>>>>>>> *import* org.apache.logging.log4j.LogManager. The Log4j2 >>>>>>>> module-info.class file exports *org.apache.logging.log4j*. >>>>>>>> >>>>>>>> I have committed a version of the test case with the word logging >>>>>>>> deleted. And then returned it to what I think is correct in the >>>>>>>> subsequent >>>>>>>> commit. >>>>>>>> I have tried it every way, with and without the classpath entries. >>>>>>>> BTW adding a jar to both the modulepath and classpath has been a bit >>>>>>>> hit >>>>>>>> and miss (ignoring adding log4j-api.jar if it is already on the >>>>>>>> modulepath) >>>>>>>> so I used a Library entry for the module path and explicitly added the >>>>>>>> jars >>>>>>>> to the classpath. >>>>>>>> >>>>>>>> Adding the classpath entries with >>>>>>>> *import* org.apache.logging.log4j.Logger >>>>>>>> *import* org.apache.logging.log4j.LogManager >>>>>>>> >>>>>>>> means the editor finds the classes Logger and LogManager as you >>>>>>>> would expect. >>>>>>>> The Compile File error message is that it cannot find the module >>>>>>>> log4j.api. >>>>>>>> https://github.com/cosmiczoo/Log4j2TestCase latest commit is as >>>>>>>> close as I can get. >>>>>>>> >>>>>>>> >>>>>>>> On Wed, 3 Oct 2018 at 11:15, Geertjan Wielenga >>>>>>>> <geertjan.wiele...@googlemail.com.invalid> wrote: >>>>>>>> >>>>>>>>> I also see this on >>>>>>>>> https://logging.apache.org/log4j/2.0/download.html: >>>>>>>>> >>>>>>>>> To use Log4j 2 in your application make sure that both the API and >>>>>>>>> Core jars are in the application’s classpath. Add the dependencies >>>>>>>>> listed >>>>>>>>> below to your classpath. >>>>>>>>> >>>>>>>>> >>>>>>>>> 1. log4j-api-2.11.1.jar >>>>>>>>> 2. log4j-core-2.11.1.jar >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> In short, we need instructions for how exactly to set up the >>>>>>>>> project to match the environment that you have. >>>>>>>>> >>>>>>>>> Gj >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> On Wed, Oct 3, 2018 at 12:11 PM Geertjan Wielenga < >>>>>>>>> geertjan.wiele...@googlemail.com> wrote: >>>>>>>>> >>>>>>>>>> Shouldn't the import statements be this: >>>>>>>>>> >>>>>>>>>> import org.apache.log4j.LogManager; >>>>>>>>>> import org.apache.log4j.Logger; >>>>>>>>>> >>>>>>>>>> ...and not this: >>>>>>>>>> >>>>>>>>>> import org.apache.logging.log4j.LogManager; >>>>>>>>>> import org.apache.logging.log4j.Logger; >>>>>>>>>> >>>>>>>>>> ...if you're using log4j-1.2-api-2.11.1.jar? >>>>>>>>>> >>>>>>>>>> Gj >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> On Wed, Oct 3, 2018 at 11:56 AM Emma Atkinson < >>>>>>>>>> emma.atkins...@gmail.com> wrote: >>>>>>>>>> >>>>>>>>>>> I cannot find a way to make this work, I hope you can help. I >>>>>>>>>>> should be happy to be pointed to an existing answer >>>>>>>>>>> >>>>>>>>>>> *The Problem* >>>>>>>>>>> I have a very simple Java application demonstrating the problem >>>>>>>>>>> I am having with using the latest Log4j2 V2.11.1 as a module >>>>>>>>>>> (log4j.api) >>>>>>>>>>> and building it in Netbeans. The example compiles, builds and runs >>>>>>>>>>> when I >>>>>>>>>>> use the classpath, but cannot compile the module-info.java file >>>>>>>>>>> when I use >>>>>>>>>>> the modulepath. I have uploaded the code and Netbeans files at the >>>>>>>>>>> following link: >>>>>>>>>>> >>>>>>>>>>> https://github.com/cosmiczoo/Log4j2TestCase >>>>>>>>>>> >>>>>>>>>>> Log4j2 V2.11.1 is a Multi-release JAR (MR-JAR). The >>>>>>>>>>> module-info.class file is in log4j-api-2.11.1.jar under the folder >>>>>>>>>>> META-INF/versions/9, which seems correct. >>>>>>>>>>> >>>>>>>>>>> The Netbeans editor can see the module log4j.api because it >>>>>>>>>>> appears in the drop-down menu of completion suggestions and does >>>>>>>>>>> not have >>>>>>>>>>> wiggly red line under it. My simple test program has a >>>>>>>>>>> module-info.java >>>>>>>>>>> file that requires log4j.api and nothing else. This bit works as I >>>>>>>>>>> would >>>>>>>>>>> expect. >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> I have located an unanswered question on StackOverflow asking a >>>>>>>>>>> similar question >>>>>>>>>>> https://stackoverflow.com/questions/50568139/netbeans-java-9-modules-log4j-2-11-module-not-found >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> *To Reproduce My Test * >>>>>>>>>>> >>>>>>>>>>> I *Clean* the project. It completes successfully. >>>>>>>>>>> I then use a RMB option to *Compile File* the module-info.java >>>>>>>>>>> file. >>>>>>>>>>> This generates an error pointing to the line *requires >>>>>>>>>>> log4j.api* in my module-info.java. >>>>>>>>>>> >>>>>>>>>>> <path-to>/Log4j2TestCase/src/module-info.java:7: error: module >>>>>>>>>>> not found: log4j.api >>>>>>>>>>> requires log4j.api; >>>>>>>>>>> 1 error >>>>>>>>>>> ZipFileIndex clearCache failed >>>>>>>>>>> <path-to>/Log4j2TestCase/nbproject/build-impl.xml:1131: The >>>>>>>>>>> following error occurred while executing this line: >>>>>>>>>>> <path-to>/Log4j2TestCase/nbproject/build-impl.xml:358: Compile >>>>>>>>>>> failed; see the compiler error output for details. >>>>>>>>>>> at >>>>>>>>>>> org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:1425) >>>>>>>>>>> at >>>>>>>>>>> org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:1133) >>>>>>>>>>> at >>>>>>>>>>> org.netbeans.modules.java.source.ant.JavacTask.execute(JavacTask.java:120) >>>>>>>>>>> at >>>>>>>>>>> org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292) >>>>>>>>>>> >>>>>>>>>>> and so on. Please let me know if you want more. >>>>>>>>>>> >>>>>>>>>>> I have tried building this program under JDK-9, JDK-10 and >>>>>>>>>>> JDK-11. My Netbeans runs on JDK-10. I am learning how to migrate >>>>>>>>>>> to >>>>>>>>>>> modules by trial, error and reading. I may have made an error, but >>>>>>>>>>> if I >>>>>>>>>>> have, I don't know where. >>>>>>>>>>> >>>>>>>>>>> Thanks in anticipation >>>>>>>>>>> >>>>>>>>>>> Emma >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>>