wood burning stoves 2.0*
The moose likes IDEs, Version Control and other tools and the fly likes Problems running application in Eclipse Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "Problems running application in Eclipse" Watch "Problems running application in Eclipse" New topic
Author

Problems running application in Eclipse

Phill McElroy
Greenhorn

Joined: Jan 28, 2007
Posts: 13
Hi there,

I've been getting this "error" when trying to run my program:

Usage: javaw [-options] class [args...]
(to execute a class)
or javaw [-options] -jar jarfile [args...]
(to execute a jar file)

where options include:
-client to select the "client" VM
-server to select the "server" VM
-hotspot is a synonym for the "client" VM [deprecated]
The default VM is client.

-cp <class search path of directories and zip/jar files>
-classpath <class search path of directories and zip/jar files>
A ; separated list of directories, JAR archives,
and ZIP archives to search for class files.
-D<name>=<value>
set a system property
-verbose[:class|gc|jni]
enable verbose output
-version print product version and exit
-version:<value>
require the specified version to run
-showversion print product version and continue
-jre-restrict-search | -jre-no-restrict-search
include/exclude user private JREs in the version search
-? -help print this help message
-X print help on non-standard options
-ea[:<packagename>...|:<classname>]
-enableassertions[:<packagename>...|:<classname>]
enable assertions
-da[:<packagename>...|:<classname>]
-disableassertions[:<packagename>...|:<classname>]
disable assertions
-esa | -enablesystemassertions
enable system assertions
-dsa | -disablesystemassertions
disable system assertions
-agentlib:<libname>[=<options>]
load native agent library <libname>, e.g. -agentlib:hprof
see also, -agentlib:jdwp=help and -agentlib:hprof=help
-agentpath:<pathname>[=<options>]
load native agent library by full pathname
-javaagent:<jarpath>[=<options>]
load Java programming language agent, see java.lang.instrument

I have no idea what it's trying to tell me. I have no compilation errors or anything. Any ideas?
[ January 29, 2007: Message edited by: Gregg Bolinger ]
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

You are getting that "error" because you haven't executed the javaw command correctly. You are basically seeing the --help dump from the javaw command. If you could show us the command you used when getting this output, then we can help out.


GenRocket - Experts at Building Test Data
Phill McElroy
Greenhorn

Joined: Jan 28, 2007
Posts: 13
Here are the two classes I'm using. It's a very simple program I made just to learn the Swing syntax and stuff.


import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class WindowsApp extends JFrame{

private static final long serialVersionUID = 1L;
JPanel mainWindow;
JPanel buttonPanel;

JButton btnEnter;
JButton btnExit;

JTextField txtInput;

JLabel lblDisplay;

String strInput;

public WindowsApp(){

mainWindow = new JPanel();
buttonPanel = new JPanel();

btnEnter = new JButton();
btnExit = new JButton();

txtInput = new JTextField();

lblDisplay = new JLabel();

buttonPanel.setVisible(true);

btnEnter.setText("Enter");
btnEnter.setVisible(true);
btnExit.setText("Exit");
btnEnter.setVisible(true);

txtInput.setText("Please enter a string");
txtInput.setVisible(true);

lblDisplay.setText("");
lblDisplay.setVisible(true);

mainWindow.setLayout(new BorderLayout());

add(txtInput, BorderLayout.NORTH);
add(lblDisplay, BorderLayout.SOUTH);
add(buttonPanel, BorderLayout.CENTER);
buttonPanel.setLayout(new GridLayout(2,1));
buttonPanel.add(btnEnter);
buttonPanel.add(btnExit);

btnEnter.addActionListener(new BHandlerENTER());
btnExit.addActionListener(new BHandlerExit());

this.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
}

private void changeText(){
lblDisplay.setText(strInput);

}

private void readText(){
strInput = txtInput.getText();
}
private void close(){
this.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
}
class BHandlerENTER implements ActionListener{
public void actionPerformed(ActionEvent e){
readText();
changeText();
}
}
class BHandlerExit implements ActionListener{
public void actionPerformed(ActionEvent e){
close();
}
}
}

AND:


public class Main {
public static void main(String [] args){
WindowsApp winni = new WindowsApp();
winni.setTitle("Yea bitch!");
winni.setSize(200,150);
winni.pack();
winni.setLocation(400,500);
winni.setVisible(true);
winni.setResizable(false);

}
}
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

What I need to see is how you are trying to run/compile this program. EX:

java WindowsApp

??
Phill McElroy
Greenhorn

Joined: Jan 28, 2007
Posts: 13
I don't know what you mean sorry.. I use the exclipse IDE. So, I just have my classes and I use the project menu of the IDE to select build all or build project, and then i run it as a java winows application.
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Aha, so this is an Eclipse problem. We finally get to the bottom of it. Again, the error you are seeing is not because of your code. It's because of how the java.exe program is being used. Moving to our IDE's forum...
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

I've edited your subject to me more meaningful to the problem at hand.
Phill McElroy
Greenhorn

Joined: Jan 28, 2007
Posts: 13
Thanks gregg.

Any ideas on what the issue is?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problems running application in Eclipse
 
Similar Threads
program doesnt run on eclipse
Regarding Thread Dump command
what does java -ea:test1 test1 file2 mean?
Just started learning Java.. Question
Compile from cmd is not working while from IDE is working