wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes yet another classpath question (Visual Swing 4 Eclipse) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "yet another classpath question (Visual Swing 4 Eclipse)" Watch "yet another classpath question (Visual Swing 4 Eclipse)" New topic
Author

yet another classpath question (Visual Swing 4 Eclipse)

Bryan Cairns
Greenhorn

Joined: Oct 27, 2007
Posts: 10
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

Joined: Nov 24, 2005
Posts: 14688
    
  16

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.


[My Blog]
All roads lead to JavaRanch
Bryan Cairns
Greenhorn

Joined: Oct 27, 2007
Posts: 10
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

Joined: Nov 24, 2005
Posts: 14688
    
  16

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

Joined: Sep 29, 2008
Posts: 12617

I thought Java 6 allowed wildcard class paths?
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

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

Joined: Sep 29, 2008
Posts: 12617

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,
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: yet another classpath question (Visual Swing 4 Eclipse)