• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problems running application in Eclipse

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Phill McElroy
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What I need to see is how you are trying to run/compile this program. EX:

java WindowsApp

??
 
Phill McElroy
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've edited your subject to me more meaningful to the problem at hand.
 
Phill McElroy
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks gregg.

Any ideas on what the issue is?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic