Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

yet another classpath question (Visual Swing 4 Eclipse)

 
Bryan Cairns
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello

I am starting java but I am an experienced programmer in a few other languages.

The classpath issue I have is with adding a third party JAR file.

My program is in:

F:\test\Java01\bin
named frmMain

This is a frame generated by an Eclipse plugin called Visual Swing 4 Eclipse
http://code.google.com/p/visualswing4eclipse/

so i try:

C:\>java -classpath F:\test\Java01\bin; frmMain
And get a dreaded:

Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: org/dyno/
visual/swing/layouts/GroupLayout
at frmMain.initComponents(frmMain.java:19)
at frmMain.<init>(frmMain.java:15)
at frmMain$1.run(frmMain.java:46)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.dyno.visual.swing.layouts.Group
Layout
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 11 more[
C:\>


Reading it I notice the "org/dyno/visual/swing/layouts/GroupLayout", after a bit of searching I find the JAR file and place it in:
F:\test\Java01\bin\.plugins\org.dyno.visual.swing\layoutext

I try appending the classpath:
C:\>java -classpath F:\test\Java01\bin;F:\test\Java01\bin\.plugins\org.dyno.visual.swing\layoutext frmMain

Same error.

Help Please

For the record I did not find much documentation on distributing java programs built with VS4E
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I find the JAR file and place it in: F:\test\Java01\bin\.plugins\org.dyno.visual.swing\layoutext

Ouch What's the JAR name ? Let's say it's called bryan.jar. Put in in F:\test\Java01\bin. Run your program using java -classpath F:\test\Java01\bin;F:\test\Java01\bin\bryan.jar frmMain.
 
Bryan Cairns
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Christophe - thank you so much!

The jar was named: GroupLayout.jar

I modified the command to:


C:\>javaw -classpath F:\test\Java01\bin;F:\test\Java01\bin\.plugins\org.dyno.visual.swing\layoutext\GroupLayout.jar frmMain

I will go back and re-read the chaper on classpath, but isn't there a way to tell it to search any sub folder, maybe "*"

Started perfectly


 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
but isn't there a way to tell it to search any sub folder, maybe "*"

Unfortunately, no. Using a tool like Ant would allow you that, but not the command line.

Note that you don't need to move the whole directory .plugins\org.dyno.visual.swing\layoutext\. You can just move the file GroupLayout.jar under bin.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I thought Java 6 allowed wildcard class paths?
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David Newton wrote:I thought Java 6 allowed wildcard class paths?

But it's only used for all jars in one directory, isn't it ? You can't include subdirectories like **/*, can you ?
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What about multiple entries? In any case, the OP used kind of a random location anyway; only reason it was there was a belief it needed to match Eclipse installation directory hierarchy,
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic