Topic: 为什么在Jcreator 下的 Basic Java Application 不能在DOS 下运行

  Print this page

1.为什么在Jcreator 下的 Basic Java Application 不能在DOS 下运行 Copy to clipboard
Posted by: mq
Posted on: 2005-07-29 09:06

Stupid

2.Re:为什么在Jcreator 下的 Basic Java Application 不能在DOS 下运行 [Re: mq] Copy to clipboard
Posted by: mq
Posted on: 2005-07-29 09:25

我的classpath=" C:\Java\jdk1.5.0_03\lib\dt.jar;C:\Java\jdk1.5.0_03\lib\tools.jar;C:\Java\jdk1.5.0_03\lib; "

我建了个类:Ff.java
它能在 Jcreator 下运行
在DOS下运行出现了:

F:\javadm\javadm\javamy\Lesson8\TestDialog\ff\src>javac Ff.java
Ff.java:11: 找不到符号
符号: 类 FfFrame
位置: 类 Ff
FfFrame frame = new FfFrame();
^
Ff.java:11: 找不到符号
符号: 类 FfFrame
位置: 类 Ff
FfFrame frame = new FfFrame();
^
2 错误

F:\javadm\javadm\javamy\Lesson8\TestDialog\ff\src>

3.Re:为什么在Jcreator 下的 Basic Java Application 不能在DOS 下运行 [Re: mq] Copy to clipboard
Posted by: Butterfly_125
Posted on: 2005-07-29 14:56

我也碰到这样的问题!
在JCreator下可以编译通过,但在cmd下就报错!
真是奇怪!在cmd下编译其它的程序可以。说明不是设置问题。
我也想得到解答

4.Re:为什么在Jcreator 下的 Basic Java Application 不能在DOS 下运行 [Re: mq] Copy to clipboard
Posted by: ranchgirl
Posted on: 2005-07-29 18:01

FfFrame???? A type you wrote????????

5.Re:为什么在Jcreator 下的 Basic Java Application 不能在DOS 下运行 [Re: mq] Copy to clipboard
Posted by: mq
Posted on: 2005-07-29 22:43

回上,
不是我写的,建工程时自创的,

6.Re:为什么在Jcreator 下的 Basic Java Application 不能在DOS 下运行 [Re: mq] Copy to clipboard
Posted by: Butterfly_125
Posted on: 2005-07-30 00:16

在JCreator下可以编译通过,但在cmd下就报错!
没有人遇到这种情况吗?
为什么JCreator编译出来的class文件名中有$这样的符号?真是奇怪

7.Re:为什么在Jcreator 下的 Basic Java Application 不能在DOS 下运行 [Re: mq] Copy to clipboard
Posted by: ranchgirl
Posted on: 2005-07-30 07:15

mq wrote:
不是我写的,建工程时自创的,


That explains, I guess that you might have to compile use the command such as
javac -classpath . *.java

Look at your directory, you might see an extra java file FfFrame.java there created by jcreator.

I usually don't use the GUI creators of IDE, know even less of jcreator. However, I know jbuilder/VAJ which do some similar things.

8.Re:为什么在Jcreator 下的 Basic Java Application 不能在DOS 下运行 [Re: Butterfly_125] Copy to clipboard
Posted by: ranchgirl
Posted on: 2005-07-30 07:41

Butterfly_125 wrote:
为什么JCreator编译出来的class文件名中有$这样的符号?真是奇怪


It is not strange at all!!!

$ sign class files are usually innerclasses with a classname following the $ sign or anonymous classes without classname. In the later case, you would see a number following the $ sign. In your case, jcreator must have defined some inner/anonymous class(es) for you.

For example:
Test$Sml.class means Test class has a Sml inner class defined in it.
Test$1.class means Test class has an annonymous inner class defined in it.
Test$2.class means Test class has another annonymous inner class defined in it.

Happy learning and good luck!

9.Re:为什么在Jcreator 下的 Basic Java Application 不能在DOS 下运行 [Re: mq] Copy to clipboard
Posted by: Butterfly_125
Posted on: 2005-07-30 18:51

哦,是这样啊,知道了,谢谢了。

10.Re:为什么在Jcreator 下的 Basic Java Application 不能在DOS 下运行 [Re: mq] Copy to clipboard
Posted by: mq
Posted on: 2005-07-31 15:37

运行出现异常下:

F:\javadm\javadm\javamy\Lesson9\Ff>javac Ff.java

F:\javadm\javadm\javamy\Lesson9\Ff>java Ff
Exception in thread "main" java.lang.NoClassDefFoundError: Ff (wrong name: mypro
jects/ff/Ff)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:12
4)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)

F:\javadm\javadm\javamy\Lesson9\Ff>

11.Re:为什么在Jcreator 下的 Basic Java Application 不能在DOS 下运行 [Re: mq] Copy to clipboard
Posted by: mq
Posted on: 2005-07-31 15:49

我用JCreator Pro2.5 来编Ff.java DOS下能编辑,运行时,出现如上贴的异常。
而出现第一贴的,哪种异常是用JCreator Pro3.5 不编辑,也不能运行。

12.Re:为什么在Jcreator 下的 Basic Java Application 不能在DOS 下运行 [Re: mq] Copy to clipboard
Posted by: ranchgirl
Posted on: 2005-07-31 15:49

If you decided not to read the answer for you, I have no way to help you... Sad

13.Re:为什么在Jcreator 下的 Basic Java Application 不能在DOS 下运行 [Re: mq] Copy to clipboard
Posted by: mq
Posted on: 2005-07-31 18:05

如果不能解决这个问题,就只有不用JCreator ,谢谢大家。

14.Re:为什么在Jcreator 下的 Basic Java Application 不能在DOS 下运行 [Re: mq] Copy to clipboard
Posted by: why
Posted on: 2005-07-31 20:38

Please show us the source code and directory listing.
Without any useful information from you, we can't help.

Actually, you could compile Ff.java now, why don't you tell us how.
No one likes communication without feedback.

如果您不能改善这个问题,就只有不理您了。

15.Re:为什么在Jcreator 下的 Basic Java Application 不能在DOS 下运行 [Re: mq] Copy to clipboard
Posted by: mq
Posted on: 2005-08-01 10:51

对不起,我是第一次进入论坛的,我不知有哪些规则。用JCreator Pro2.5 建的Ff.jfava在DOS能编辑,不能运行,而用JCreator Pro3.5 建的,在DOS 不能编辑,也不能运行。在JCreator Pro2.5下代码是:


package myprojects.ff;

import java.awt.*;
import java.awt.event.*;

class Ff extends Frame {
  
  public Ff() {
    addWindowListener(new WindowAdapter() {
      public void windowClosing(WindowEvent e) {
        dispose();
        System.exit(0);
      }
    });
  }

  public static void main(String args[]) {
    System.out.println("Starting Ff...");
    Ff mainFrame = new Ff();
    mainFrame.setSize(400, 400);
    mainFrame.setTitle("Ff");
    mainFrame.setVisible(true);
  }
}

16.Re:为什么在Jcreator 下的 Basic Java Application 不能在DOS 下运行 [Re: mq] Copy to clipboard
Posted by: mq
Posted on: 2005-08-01 11:00

在JCreator pro 3.5 代码是:public class FfFrame extends Frame {

/**
* The constructor.
*/
public FfFrame() {

MenuBar menuBar = new MenuBar();
Menu menuFile = new Menu();
MenuItem menuFileExit = new MenuItem();

menuFile.setLabel("File");
menuFileExit.setLabel("Exit");

// Add action listener.for the menu button
menuFileExit.addActionListener
(
new ActionListener() {
public void actionPerformed(ActionEvent e) {
FfFrame.this.windowClosed();
}
}
);
menuFile.add(menuFileExit);
menuBar.add(menuFile);

setTitle("Ff");
setMenuBar(menuBar);
setSize(new Dimension(400, 400));

// Add window listener.
this.addWindowListener
(
new WindowAdapter() {
public void windowClosing(WindowEvent e) {
FfFrame.this.windowClosed();
}
}
);
}


/**
* Shutdown procedure when run as an application.
*/
protected void windowClosed() {
  
  // TODO: Check if it is safe to close the application
  
// Exit application.
System.exit(0);
}
}
public class Ff {

public static void main(String[] args) {
// Create application frame.
FfFrame frame = new FfFrame();

// Show frame
frame.setVisible(true);
}
}

17.Re:为什么在Jcreator 下的 Basic Java Application 不能在DOS 下运行 [Re: mq] Copy to clipboard
Posted by: Talent666
Posted on: 2005-08-21 21:54

我估计还是你的环境变量配置有问题。实践证明不需要配置什么 classpath
你只要把jdk的bin包加到path就行了。搞多了反而晕

18.JAVA运行出现的问题 [Re: mq] Copy to clipboard
Posted by: cxy123884
Posted on: 2005-09-22 07:24

我安装了JDK。设置了环境变量。然后试写了一个程序。编译能够通过但是在运行的时候出现异常,提示如下:Exception in thread "main" java.lang.NoClassDefFoundError: c:\DemoJDBC.但是我设置的环境变量没有问题。不知道问题出在那里。求高手指点谢谢!!

19.Re:JAVA运行出现的问题 [Re: cxy123884] Copy to clipboard
Posted by: zcjl
Posted on: 2005-09-22 11:51

java -cp . DemoJDBC

20.Re:JAVA运行出现的问题 [Re: zcjl] Copy to clipboard
Posted by: cxy123884
Posted on: 2005-09-22 15:14

zcjl:谢谢了啊。我问题已经解决了。万分感激!!!!!

21.Re:JAVA运行出现的问题 [Re: cxy123884] Copy to clipboard
Posted by: zcjl
Posted on: 2005-09-22 18:39

不客气


   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