Topic: 请教一个classpath问题

  Print this page

1.请教一个classpath问题 Copy to clipboard
Posted by: sammi8190
Posted on: 2005-05-04 15:09

set classpath=.;D:\Chat\dist\AbsoluteLayout.jar
java -jar D:\Chat\dist\Chat.jar

Chat.jar使用了AbsoluteLayout.jar的类
可是错误why? help me.

2.Re:请教一个classpath问题 [Re: sammi8190] Copy to clipboard
Posted by: why
Posted on: 2005-05-04 20:38

What's the error messsage?

java -classpath D:\Chat\dist\AbsoluteLayout.jar -jar D:\Chat\dist\Chat.jar

3.Re:请教一个classpath问题 [Re: why] Copy to clipboard
Posted by: sammi8190
Posted on: 2005-05-04 21:36

can not find the class in the AbsoluteLayout.jar

4.Re:请教一个classpath问题 [Re: sammi8190] Copy to clipboard
Posted by: sammi8190
Posted on: 2005-05-04 21:42

C:\Documents and Settings\Administrator>java -classpath c:\AbsoluteLayout.jar -jar c:\Chat.jar
Exception in thread "main" java.lang.NoClassDefFoundError: org/netbeans/lib/awtextra/AbsoluteLayout
at chat.ServerConsole.initComponents(ServerConsole.java:247)
at chat.ServerConsole.<init>(ServerConsole.java:200)
at chat.Main.main(Main.java:16)

5.Re:请教一个classpath问题 [Re: sammi8190] Copy to clipboard
Posted by: why
Posted on: 2005-05-04 22:31

sammi8190 wrote:
C:\Documents and Settings\Administrator>java -classpath c:\AbsoluteLayout.jar -jar c:\Chat.jar
Exception in thread "main" java.lang.NoClassDefFoundError: org/netbeans/lib/awtextra/AbsoluteLayout

If AbsoluteLayout.class is not in AbsoluteLayout.jar, you have to get a correct jar or find it somewhere else.

6.Re:请教一个classpath问题 [Re: sammi8190] Copy to clipboard
Posted by: sammi8190
Posted on: 2005-05-05 07:57

wrong,
AbsoluteLayout.jar
| --org
| --netbeans
| --lib
| --awtextra
| --AbsoluteLayout.class

7.Re:请教一个classpath问题 [Re: sammi8190] Copy to clipboard
Posted by: why
Posted on: 2005-05-05 09:26

use Google!

1. http://www.netbeans.org/kb/faqs/gui_editing.html#FAQ_4
Distributing the AbsoluteLayout class with applications
The IDE includes its own layout manager class, called AbsoluteLayout. It
provides design-time support for dragging, resizing and setting absolute
positions and sizes for components.

You can use this layout manager at design time, but you do not need to
use it after you get your UI set up. Once your UI is designed, switch to
GridBagLayout and you'll find your UI looks the same, but you get the
benefits of GridBagLayout without all of the overhead of hand-coding
constraints.

If you want to keep AbsoluteLayout in your GUI application, then you
must distribute the AbsoluteLayout class with it. This is permitted, but
not recommended.

2. http://forum.java.sun.com/thread.jspa?threadID=597783

8.Re:请教一个classpath问题 [Re: why] Copy to clipboard
Posted by: sammi8190
Posted on: 2005-05-05 10:54

not this problem.
I find the command-line: java -classpath filename.jar -jar ex.jar
do not work. I use netbeans, I don't whether because of netbeans or java
If you have the problem like it,
you can add classpath in jar's Manifest.mf file

Manifest-Version: 1.0
Ant-Version: Apache Ant 1.6.2
Created-By: 1.5.0_01-b08 (Sun Microsystems Inc.)
Main-Class: chat.Main
// add this line
Class-Path: dir\*.jar //(jar file name)
X-COMMENT: Main-Class will be added automatically by build


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923