Results 1 to 2 of 2
  1. #1
    ocean is offline Senior Member
    Join Date
    Sep 2009
    Rep Power

    Default Strange behavior with java from command line


    Evening. Have a small issue. I use NetBeans when i code. It has made a nice Jar file. When i start it using java -jar path class.jar it starts but freeze at main frame. Cant click on the x to close it. All menus and other swing items dont show.

    So i re compiled it from a new directory with fresh .java files using javac *.java from comand line. With the same result.

    Confused I start NetBeans again. and there it works perfect. What does NetBeans do that i dont? or that i need to do. :confused:

    I Have also comment out everything and only compiled only as shown below, with same result.

    Have now tryed diffrent thing.
    One i created a new class with only System.out.print("hello"); Works fine.

    Two. added a simple JFrame with basic parameters. Little Buggy. wont close on x
    every time.

    Three tryed added one of my orginal classes, it shows but freeze. and it uses another font then in NetBeans.

    Mabey need to re install my java ?

    Java Code:
    import java.awt.Dimension;
    import javax.swing.*;
    public class Main {
    private JFrame mstFrame () {
        JLabel label = new JLabel("hello");
        JFrame mstFrame = new JFrame("Mst");
      //  JTabbedPane mstTabPane = new JTabbedPane();
      // mstTabPane.addTab("Start", new Welcome());
      //  mstTabPane.addTab("Create Project", new CreateProject());
      //  mstTabPane.addTab("Customer", new Customer());
      //  mstTabPane.addTab("Product", new Product());
      //   mstFrame.setSize(new Dimension(1010,620));
      //   mstFrame.setLocationRelativeTo(null);
      //  mstFrame.add(mstTabPane);
        return mstFrame;
        public static void main(String[] args) {
           java.awt.EventQueue.invokeLater(new Runnable(){
               public void run(){
                  new Main();
    Last edited by ocean; 12-07-2009 at 01:32 AM. Reason: Solved

  2. #2
    ocean is offline Senior Member
    Join Date
    Sep 2009
    Rep Power

    Default Solved

    Yes it was a re install of JDK that I needed. Now it works fine.

Similar Threads

  1. Replies: 6
    Last Post: 09-04-2009, 03:48 AM
  2. Strange behavior with Thread.sleep()
    By Steve11235 in forum Advanced Java
    Replies: 16
    Last Post: 05-04-2009, 06:24 AM
  3. strange refreshing behavior
    By diggitydoggz in forum New To Java
    Replies: 4
    Last Post: 12-27-2008, 05:51 PM
  4. Java command line
    By agouzoul in forum New To Java
    Replies: 2
    Last Post: 04-02-2008, 01:12 PM
  5. Unable to execute command line command in java
    By LordSM in forum New To Java
    Replies: 1
    Last Post: 08-08-2007, 01:23 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts