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.
[ NetBeans IDE 5.0 Development version (build 200509122200) ] Hi, I'm working on a form with the new Free Design feature of the Matisse designer and it works perfectly under NetBeans IDE environment but the jar produced can't be run with the command "java -jar Main.jar" because it lacks the extensions used by the IDE in the project; this is the error message: Exception in thread "main" java.lang.NoClassDefFoundError: org/jdesktop/layout/GroupLayout$Group this class can be found in C:\Programmi\netbeans-5.0dev\ide6\modules, but even if I include it in the classpath the error still remains; these extensions can also be found under "Project Properties" --> "Libraries" --> "Swing Layout Extensions"... is there a way to encapsulate the GroupLayout stuff in the jar to run it also part from the IDE? thanks for assistance *best regards*
No, there is not. Swing-layout is a library and it is a good practice not to repack libraries into application jars. There's also no reason to do it, you can simply put the swing-layout.jar (or another library) on the classpath. PS: Please, next time use mailing list (nbusers in this case) when asking questions.
The comments from jstola is typical of the type of programmer that does not want Java to spread. The original question is also not resolved, jstola says the jar or library must be added to the classpath, in this particular case, that does not work, THAT is the issue! This isssue is not resolved. When building the app (with all and any jar's and/or libraries pertaining to the new MATISSE type LAYOUT) is added to the classpath/manifest etc, it DOES NOT WORK. Specifying another type of layout (such as GridBag) without any other changes to the code, makes everything work fine. You can then double-click on the JAR to execute it on a Win PC.
I agree with this being reopened as defect, since there is really no way for users who create a form using Matisse to run easily the application as they are used to when not using Matisse layout. IMO application using Matisse should be self-contained without any need for "hacking" classpath.
simsam7, I also had problem including it in the classpath for jar... did you succeed in make it work correctly? maybe it still need something more from the NetBeans IDE environment? I hope the dev team soon incorporate this thing in the jar, because by now the Matisse application cannot redistributed outside the IDE... :-( * best regards *
I have a suggested fix for this. I did the following manually and it worked fine. A good solution would be for the IDE to do it automatically. 1) Copy "swing-layout-0.7.jar" to the "dist" directory 2) Include the following line in the manifest of the application jar file: Class-Path: swing-layout-0.7.jar You can run the resulting jar file as you normally would: java -jar dist/MyProj.jar [MyMainProgram] A separate issue is that the new FreeForm (Matisse) layout manager should *not* be the default, since it creates a dependency on an external jar file. I will file a new issue for this.
Since the Matisse layout manager is the default, and the team feels that it should remain the default (see Issue 68410), I think this issue needs to be higher priority. As it stands, no new applications are able to be distributed, nor will run outside of NB.
thanks kcr, that's a good workaround, it also worked for me and I also agree it can be easily embedded into the IDE project compiling, so the great Matisse editor should remain the default layout manager as well.
*** Issue 68607 has been marked as a duplicate of this issue. ***
I just put in a little patch to j2seproject to make it print out, on the Ant console, a working Java command line to run an app when you run the jar target (e.g. from Build Main Project). Takes effect only for apps with a manifest and a defined main class (e.g. application project template, not library project template). Uses same classpath that e.g. Run Main Project would from the IDE (~ 'run' target in Ant), except that the dist JAR is used for the main project rather than build/classes (normally subprojects already are included as dist JARs). Sample output: To run this application from the command line without Ant, try: java -cp .../app/dist/app.jar:.../ide6/modules/ext/swing-layout-0.9.jar myapp.Main Also uses full path to java executable if an explicit platform has been set. Not a real solution to the problem, but at least should make it easier for new IDE users (1) to understand that their app may have a classpath beyond the main JAR; (2) to see what that classpath is, and to get a head start on e.g. writing a shell/batch launcher, JNLP wrapper, ad nauseam, without having to dig around to figure out where all the JARs are coming from. Of course the message could be expanded a bit to link to http://wiki.java.net/bin/view/Netbeans/FaqPackagingMatisseBasedProjects or some similar page on the NB Wiki or website, or refer the user to the JavaHelp docs, for more tips on packaging and deployment options. Note: this patch is not a substitute for a fix for issue #47507. For example, if you have a main app which uses a lib which has a Matisse form in it, you will still need to manually add the Swing Layout lib to the main app's run classpath. This has been true since 4.0 and it's an independent issue; you would need to do this just to run the app in the IDE. Once you add the lib to the main app, then it will show up in the displayed Java launcher command, too. committed Up-To-Date 1.66 java/j2seproject/src/org/netbeans/modules/java/j2seproject/resources/build-impl.xsl
http://java.netbeans.org/source/browse/java/j2seproject/build.xml?r1=1.11&r2=1.12 http://java.netbeans.org/source/browse/java/j2seproject/copylibstask/build.xml?rev=1.1&content-type=text/vnd.viewcvs-markup http://java.netbeans.org/source/browse/java/j2seproject/copylibstask/manifest.mf?rev=1.1&content-type=text/vnd.viewcvs-markup http://java.netbeans.org/source/browse/java/j2seproject/copylibstask/nbproject/build-impl.xml?rev=1.1&content-type=text/vnd.viewcvs-markup http://java.netbeans.org/source/browse/java/j2seproject/copylibstask/nbproject/genfiles.properties?rev=1.1&content-type=text/vnd.viewcvs-markup http://java.netbeans.org/source/browse/java/j2seproject/copylibstask/nbproject/project.properties?rev=1.1&content-type=text/vnd.viewcvs-markup http://java.netbeans.org/source/browse/java/j2seproject/copylibstask/nbproject/project.xml?rev=1.1&content-type=text/vnd.viewcvs-markup http://java.netbeans.org/source/browse/java/j2seproject/copylibstask/src/org/netbeans/modules/java/j2seproject/copylibstask/CopyLibs.java?rev=1.1&content-type=text/vnd.viewcvs-markup http://java.netbeans.org/source/browse/java/j2seproject/copylibstask/src/org/netbeans/modules/java/j2seproject/copylibstask/antlib.xml?rev=1.1&content-type=text/vnd.viewcvs-markup http://java.netbeans.org/source/browse/java/j2seproject/nbproject/project.properties?r1=1.20&r2=1.21 http://java.netbeans.org/source/browse/java/j2seproject/src/org/netbeans/modules/java/j2seproject/resources/build-impl.xsl?r1=1.66&r2=1.67 http://ide.netbeans.org/source/browse/ide/golden/files-layout.txt?r1=1.117&r2=1.118 http://java.netbeans.org/source/browse/java/j2seproject/build.xml?r1=1.12&r2=1.13 http://java.netbeans.org/source/browse/java/j2seproject/nbproject/project.properties?r1=1.21&r2=1.22 http://java.netbeans.org/source/browse/java/j2seproject/src/org/netbeans/modules/java/j2seproject/Bundle.properties?r1=1.24&r2=1.25 http://java.netbeans.org/source/browse/java/j2seproject/src/org/netbeans/modules/java/j2seproject/resources/build-impl.xsl?r1=1.67&r2=1.68 http://java.netbeans.org/source/browse/java/j2seproject/src/org/netbeans/modules/java/j2seproject/ui/resources/CopyLibs.xml?rev=1.1&content-type=text/vnd.viewcvs-markup http://java.netbeans.org/source/browse/java/j2seproject/src/org/netbeans/modules/java/j2seproject/ui/resources/layer.xml?r1=1.14&r2=1.15 http://ide.netbeans.org/source/browse/ide/golden/files-layout.txt?r1=1.118&r2=1.119
Verified