Please Be Kind Please

I'm using eclipse to run the following and nothing happens;

import java.io.*;

import java.awt.*;

import javax.swing.*;

import javax.swing.filechooser.*;

public class FileSelector {

private String fileName;

public String getFileName(){

JFileChooser fc;

File TSTTBill;

fc = new JFileChooser("Select the TSTT Bill File to upload");

int returnVal = fc.showOpenDialog(null);

TSTTBill = fc.getSelectedFile();

fileName = TSTTBill.getAbsolutePath();

System.out.println(fileName);

return fileName;

}

public void main(String[] args) {

String tsttFileName;

tsttFileName = getFileName();

}

}

[714 byte] By [mransomea] at [2007-11-27 10:07:54]
# 1
1) use meaningful subject lines2) use that code button when posting code
Aknibbsa at 2007-7-13 0:44:16 > top of Java-index,Java Essentials,New To Java...
# 2
Do you realize your method "main" is not static?
BigDaddyLoveHandlesa at 2007-7-13 0:44:16 > top of Java-index,Java Essentials,New To Java...
# 3
> Do you realize your method "main" is not static?Amazing BDLH - I can't even look at that without shirking about the non-colorization. I bow down to you sir ;-P
Aknibbsa at 2007-7-13 0:44:16 > top of Java-index,Java Essentials,New To Java...
# 4
I practice with Notepad.
BigDaddyLoveHandlesa at 2007-7-13 0:44:16 > top of Java-index,Java Essentials,New To Java...
# 5
I couldn't do it.The lowest I could drop is textpad and still want to program.
Aknibbsa at 2007-7-13 0:44:16 > top of Java-index,Java Essentials,New To Java...
# 6
First thing is that make your main maethod static so that you can use it without any object.Second thing which I thought is that please check your eclipse settings especially class path and JVM settings.
Friend4evera at 2007-7-13 0:44:16 > top of Java-index,Java Essentials,New To Java...
# 7
> Second thing which I thought is that please check> your eclipse settings especially class path and JVM> settings.Why?
georgemca at 2007-7-13 0:44:16 > top of Java-index,Java Essentials,New To Java...
# 8

> First thing is that make your main maethod static so

> that you can use it without any object.

Making it static still won't allow the program to run as the OP is trying to access non-static variables and create non-static objects...

I'd suggest the OP looks at the basic Swing Tutorials before trying to use a JFileChooser

http://java.sun.com/docs/books/tutorial/uiswing/

c0demonk3ya at 2007-7-13 0:44:16 > top of Java-index,Java Essentials,New To Java...
# 9

> > First thing is that make your main maethod static

> so

> > that you can use it without any object.

>

> Making it static still won't allow the program to run

> as the OP is trying to access non-static variables

> and create non-static objects...

>

> I'd suggest the OP looks at the basic Swing Tutorials

> before trying to use a JFileChooser

>

> http://java.sun.com/docs/books/tutorial/uiswing/

I'd suggest he doesn't even bother with Swing at all until he can get "Hello, World" working. I'd suggest he throws Eclipse away, too

georgemca at 2007-7-13 0:44:16 > top of Java-index,Java Essentials,New To Java...
# 10
> I'd suggest he doesn't even bother with Swing at all> until he can get "Hello, World" working.Fair point :D
c0demonk3ya at 2007-7-13 0:44:16 > top of Java-index,Java Essentials,New To Java...
# 11
c0demonk3y,Which video of your theme song do you prefer? http://www.youtube.com/watch?v=v4Wy7gRGgeA http://www.youtube.com/watch?v=aqTaqVi9J8k
BigDaddyLoveHandlesa at 2007-7-13 0:44:16 > top of Java-index,Java Essentials,New To Java...
# 12
> c0demonk3y,> > Which video of your theme song do you prefer?> > http://www.youtube.com/watch?v=v4Wy7gRGgeA> http://www.youtube.com/watch?v=aqTaqVi9J8khmmmmm... thats a tough choice. I shall have to deliberate over a banana
c0demonk3ya at 2007-7-13 0:44:16 > top of Java-index,Java Essentials,New To Java...