error: package org.jdesktop.layout does not exist

Trewq picture Trewq · Mar 8, 2014 · Viewed 8.7k times · Source

I would like to compile the Universal-G-Code-Sender without using eclipse. I am on OS X 10.9.2 and When I type ant, I eventually get the following error:

[javac] Compiling 25 source files to /Users/trewq/Downloads/Universal-G-Code-Sender/build/classes
[javac] /Users/trewq/Downloads/Universal-G-Code-Sender/src/com/willwinder/universalgcodesender/MainWindow.java:212: error: package org.jdesktop.layout does not exist
[javac]         org.jdesktop.layout.GroupLayout commandsPanelLayout = new org.jdesktop.layout.GroupLayout(commandsPanel);

When I checkout the repo, I do see ./lib/swing-layout-1.0.4.jar in there. I did set the CLASSPATH to :lib/swing-layout-1.0.4.jar:/Users/trewq/Downloads/Universal-G-Code-Sender/lib/swing-layout-1.0.4.jar but I did not see any change. I would be grateful for any pointers

UPDATED:

I would prefer not to change the source code. I believe the problem is that ant is not able to find the library and this is available in swing-layout-1.0.4.jar, and when I did jar -xf swing-layout-1.0.4.jar, I do see these classes I believe is what ant is complaining about. I found this site that shows the classes are there. Here is what I see in my lib directory:

 org
  └── jdesktop
     └── layout
       ├── GroupLayout.class
       ├── LayoutStyle.class

I understand that this project was created using netbeans, but I would like to see if it is possible to edit CLASSPATH (or some other var) in build.xml - I did try this approach but same error. I do not want to install netbeans.

Answer

Andrew Thompson picture Andrew Thompson · Mar 8, 2014

Pointer: GroupLayout was incorporated into the JSE in Java 6. Change the import to the JSE version of the class.