Results 1 to 2 of 2
- 12-07-2009, 12:08 AM #1
Senior Member
- Join Date
- Sep 2009
- Location
- Sweden/Borås
- Posts
- 107
- Rep Power
- 0
Strange behavior with java from command line
<SOLVED>
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 Main.java 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 { Main(){ mstFrame(); } 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.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // mstFrame.setSize(new Dimension(1010,620)); // mstFrame.setLocationRelativeTo(null); // mstFrame.add(mstTabPane); mstFrame.setVisible(true); mstFrame.pack(); 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 12:32 AM. Reason: Solved
- 12-07-2009, 12:26 AM #2
Senior Member
- Join Date
- Sep 2009
- Location
- Sweden/Borås
- Posts
- 107
- Rep Power
- 0
Similar Threads
-
Strange JFILECHOOSER behavior on Macs with ZIP files
By TimHuey in forum New To JavaReplies: 6Last Post: 09-04-2009, 02:48 AM -
Strange behavior with Thread.sleep()
By Steve11235 in forum Advanced JavaReplies: 16Last Post: 05-04-2009, 05:24 AM -
strange refreshing behavior
By diggitydoggz in forum New To JavaReplies: 4Last Post: 12-27-2008, 04:51 PM -
Java command line
By agouzoul in forum New To JavaReplies: 2Last Post: 04-02-2008, 12:12 PM -
Unable to execute command line command in java
By LordSM in forum New To JavaReplies: 1Last Post: 08-08-2007, 12:23 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks